static const struct popup_ops charge_error_high_ops;
static const struct popup_ops battery_disconnected_ops;
+#define DEVICED_BUS_NAME "org.tizen.system.deviced"
+#define POWER_OBJECT_PATH "/Org/Tizen/System/DeviceD/Power"
+#define POWER_INTERFACE_NAME DEVICED_BUS_NAME".power"
+
+#define POWER_METHOD "reboot"
+#define POWER_OPERATION_OFF "poweroff"
+
static int lowbattery_launch(bundle *b, const struct popup_ops *ops);
static int remove_other_lowbattery_popups(const struct popup_ops *ops)
static void poweroff_clicked(const struct popup_ops *ops)
{
- _I("Power off the phone");
- unload_simple_popup(ops);
+ static int bPowerOff = 0;
+ char *param[2];
+ char data[8];
+ int ret;
- if (vconf_set_int(VCONFKEY_SYSMAN_POWER_OFF_STATUS,
- VCONFKEY_SYSMAN_POWER_OFF_DIRECT) != 0)
- _E("Failed to request poweroff to deviced");
+ if (bPowerOff == 1)
+ return;
+ bPowerOff = 1;
- terminate_if_no_popup();
+ unload_simple_popup(ops);
+
+ param[0] = POWER_OPERATION_OFF;
+ snprintf(data, sizeof(data), "0");
+ param[1] = data;
+ ret = popup_dbus_method_sync(DEVICED_BUS_NAME,
+ POWER_OBJECT_PATH,
+ POWER_INTERFACE_NAME,
+ POWER_METHOD,
+ "si", param);
+ if (ret < 0)
+ _E("Failed to request poweroff to deviced (%d)", ret);
}
static void charge_error_ok_clicked(const struct popup_ops *ops)