Remove popup and timer before powering off 53/204353/1 accepted/tizen/unified/20190423.113457 submit/tizen/20190423.082506
authorlokilee73 <changjoo.lee@samsung.com>
Tue, 23 Apr 2019 08:14:16 +0000 (17:14 +0900)
committerlokilee73 <changjoo.lee@samsung.com>
Tue, 23 Apr 2019 08:15:45 +0000 (17:15 +0900)
1. Remove popup before powering off
Low and critical popups are shown beforehand according to battery level.
So, to show popup before powering off is duplicated action.

2. Remove poweroff timer
The purpose of power off timer is to have time to show popup before powering off.
But we don't need it any more.
Morever, popup can be shown or not shown by remained battery capacity.
It can confuse users.

Change-Id: I8cc67999cfe7be56e4c882012b4be29800cd4159
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
src/battery/lowbat-handler.c

index 19c1c35..bd2d204 100644 (file)
@@ -48,8 +48,6 @@
 #define CHARGE_POWERSAVE_FREQ_ACT      "charge_powersave_freq_act"
 #define CHARGE_RELEASE_FREQ_ACT                "charge_release_freq_act"
 
-#define POWER_OFF_CHECK_TIMER  (30)
-
 #define BATTERY_CHARGING       65535
 #define BATTERY_UNKNOWN                -1
 #define BATTERY_DISABLED       0
@@ -74,9 +72,6 @@
 #define LOWBAT_CPU_CTRL_ID     "id6"
 #define LOWBAT_CPU_FREQ_RATE   (0.7)
 
-#define POWER_OFF_UNLOCK       0
-#define POWER_OFF_LOCK         1
-
 #define VCONF_KEY_BATTERY_WARNING_LEVEL "db/sysman/battery_warning_level"
 
 enum low_battery_type {
@@ -106,8 +101,6 @@ static struct battery_config_info battery_info = {
 
 static dd_list *lpe;
 static int scenario_count;
-static int power_off_lock = POWER_OFF_UNLOCK;
-static guint power_off_timer;
 
 static int lowbat_monitor_init(void *data);
 
@@ -220,53 +213,6 @@ out:
        return done;
 }
 
-static void power_off_pm_lock(void)
-{
-       if (power_off_lock == POWER_OFF_UNLOCK) {
-               if (disp_plgn.pm_lock_internal)
-                       disp_plgn.pm_lock_internal(INTERNAL_LOCK_LOWBAT, LCD_OFF, STAY_CUR_STATE, 0);
-               power_off_lock = POWER_OFF_LOCK;
-       }
-}
-
-static void power_off_pm_unlock(void)
-{
-       if (power_off_lock == POWER_OFF_LOCK) {
-               if (disp_plgn.pm_unlock_internal)
-                       disp_plgn.pm_unlock_internal(INTERNAL_LOCK_LOWBAT, LCD_OFF, PM_SLEEP_MARGIN);
-               power_off_lock = POWER_OFF_UNLOCK;
-       }
-}
-
-static gboolean power_off_cb(void *data)
-{
-       power_off_pm_unlock();
-       power_execute(POWER_POWEROFF);
-       return G_SOURCE_REMOVE;
-}
-
-void power_off_timer_start(void)
-{
-       if (power_off_timer)
-               return;
-       _I("Power off after %d.", POWER_OFF_CHECK_TIMER);
-       power_off_pm_lock();
-       power_off_timer = g_timeout_add_seconds(POWER_OFF_CHECK_TIMER,
-                               power_off_cb, NULL);
-       if (power_off_timer == 0)
-               _E("Failed to add battery init timer during booting.");
-}
-
-void power_off_timer_stop(void)
-{
-       if (!power_off_timer)
-               return;
-       _I("Cancel power off.");
-       power_off_pm_unlock();
-       g_source_remove(power_off_timer);
-       power_off_timer = 0;
-}
-
 static int get_lowbat_noti_value(int low_battery_type, char **active_noti, char **event_noti)
 {
        int len;
@@ -482,51 +428,42 @@ direct_launch:
 
 static int battery_check_act(void *data)
 {
-       power_off_timer_stop();
        return lowbat_popup(CHARGE_CHECK_ACT);
 }
 
 static int battery_warning_low_act(void *data)
 {
-       power_off_timer_stop();
        return lowbat_popup(WARNING_LOW_BAT_ACT);
 }
 
 static int battery_critical_low_act(void *data)
 {
-       power_off_timer_stop();
        return lowbat_popup(CRITICAL_LOW_BAT_ACT);
 }
 
 int battery_power_off_act(void *data)
 {
-       int ret;
-       ret = lowbat_popup(CRITICAL_LOW_BAT_ACT);
-       power_off_timer_start();
-       return ret;
+       power_execute(POWER_POWEROFF);
+       return 0;
 }
 
 int battery_charge_err_act(void *data)
 {
-       power_off_timer_stop();
        return lowbat_popup(CHARGE_ERROR_ACT);
 }
 
 int battery_charge_err_low_act(void *data)
 {
-       power_off_timer_stop();
        return lowbat_popup(CHARGE_ERROR_LOW_ACT);
 }
 
 int battery_charge_err_high_act(void *data)
 {
-       power_off_timer_stop();
        return lowbat_popup(CHARGE_ERROR_HIGH_ACT);
 }
 
 int battery_charge_err_ovp_act(void *data)
 {
-       power_off_timer_stop();
        return lowbat_popup(CHARGE_ERROR_OVP_ACT);
 }