Change-Id: I9d637e567446e3ac9ce061e7ff77c0fb5b71eb7c
Signed-off-by: jy910.yun <jy910.yun@samsung.com>
#include <fcntl.h>
#include <device-node.h>
#include <bundle.h>
+#include <stdbool.h>
+
#include "core/log.h"
#include "core/launch.h"
#include "core/noti.h"
return 0;
}
-int ss_lowbat_set_charge_on(int onoff)
+int ss_lowbat_set_charge_on(int on)
{
- if(vconf_set_int(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, onoff) != 0) {
+ static bool state = -1;
+
+ if (state == on)
+ return 0;
+
+ if (vconf_set_int(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, on) != 0) {
_E("fail to set charge vconf value");
- return -1;
+ return -EPERM;
}
+
if (update_pm_setting)
- update_pm_setting(SETTING_CHARGING, onoff);
+ update_pm_setting(SETTING_CHARGING, on);
+
+ state = on;
return 0;
}