Add patch that 'battery disconnected' popup shows only during charging. 22/14922/2
authorsh.pi <sh.pi@samsung.com>
Thu, 9 May 2013 06:21:57 +0000 (15:21 +0900)
committerKrzysztof Sasiak <k.sasiak@samsung.com>
Thu, 16 Jan 2014 10:38:45 +0000 (11:38 +0100)
If battery present node is zero, 'battery disconnected' popup shows.
Now it shows only during charging.

Change-Id: If68a6a741d14d3968d10b18364035bde78d6508b
Signed-off-by: Krzysztof Sasiak <k.sasiak@samsung.com>
src/core/device-change-handler.c

index 613905f..cfc7b58 100644 (file)
@@ -377,13 +377,23 @@ static void charge_cb(struct ss_main_data *ad)
 
        ss_lowbat_monitor(NULL);
 
+       if (device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CHARGE_NOW, &charge_now) != 0 ||
+           device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CAPACITY, &capacity) != 0)
+               _E("fail to get battery node value");
+       if (charge_now == 0 && capacity == 0) {
+               _E("target will be shut down");
+               battery_power_off_act(NULL);
+               return;
+       }
+
        ret = device_get_property(DEVICE_TYPE_POWER, PROP_POWER_PRESENT, &val);
        if (ret != 0)
                _E("fail to get battery present value");
        if (val == 0 && present_status == 1) {
                present_status = 0;
                _E("battery cf is opened");
-               ss_action_entry_call_internal(PREDEF_BATTERY_CF_OPENED, 0);
+               if (charge_now)
+                       ss_action_entry_call_internal(PREDEF_BATTERY_CF_OPENED, 0);
        }
 
        if (val == 1 && present_status == 0) {
@@ -391,15 +401,6 @@ static void charge_cb(struct ss_main_data *ad)
                _E("battery cf is closed again");
        }
 
-       if (device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CHARGE_NOW, &charge_now) != 0 ||
-           device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CAPACITY, &capacity) != 0)
-               _E("fail to get battery node value");
-       if (charge_now == 0 && capacity == 0) {
-               _E("target will be shut down");
-               battery_power_off_act(NULL);
-               return;
-       }
-
        if (device_get_property(DEVICE_TYPE_POWER, PROP_POWER_HEALTH, &val) == 0) {
                if (val==BATTERY_OVERHEAT || val==BATTERY_COLD) {
                        _E("Battery health status is not good (%d)", val);