From e4a5f20676cb9b32e0735c1e28f6b8185a5d8265 Mon Sep 17 00:00:00 2001 From: Yunhee Seo Date: Mon, 12 Jun 2023 20:43:41 +0900 Subject: [PATCH] display: Remove lcd_on_expired()/stop_lock_timer()/check_lock_screen() These functions are used when the EVENT_INPUT occurs from the below situation, S_SLEEP/S_LCDOFF --> EVENT_INPUT --> S_NORMAL check_lock_screen() checks lock_screen state, If lock_screen is not launched, this adds timeout callback for lcd_on_procedure(). stop_lock_timer() removes callback from above description. lcd_on_expired() is callback for lcd_on_procedure() after timeout. Simply, that functions checks lock screen status, and then If lock screen is not launched, go to lcd_on_procedure after timeout value. However, according to the default_action code logic, it goes to lcd_on_procedure() regardless of check_lock_screen(). Also, meaningless lcd_on_procedure() call occurs. Thus, lcd_on_expired()/stop_lock_timer()/check_lock_screen() is removed. Change-Id: Ie82889e951678260ac10e1b7c86546040aff3fc8 Signed-off-by: Yunhee Seo --- plugins/iot-headed/display/core.c | 55 +-------------------------------------- plugins/mobile/display/core.c | 55 +-------------------------------------- plugins/tv/display/core.c | 55 +-------------------------------------- plugins/wearable/display/core.c | 55 +-------------------------------------- 4 files changed, 4 insertions(+), 216 deletions(-) diff --git a/plugins/iot-headed/display/core.c b/plugins/iot-headed/display/core.c index 74eb8fd..240eb3b 100644 --- a/plugins/iot-headed/display/core.c +++ b/plugins/iot-headed/display/core.c @@ -100,7 +100,6 @@ static enum device_ops_status status = DEVICE_OPS_STATUS_UNINIT; static int system_wakeup_flag = false; static char *custom_change_name; -static guint lock_timeout_id; static struct timeval lcdon_tv; /* * The two variables(lcdon_broadcast, pmstate_suspend) must be set initial @@ -723,51 +722,6 @@ static void sig_hup(int signo) pm_save_logdump(); } -static gboolean lcd_on_expired(void *data) -{ - int lock_state, ret; - - if (lock_timeout_id) - lock_timeout_id = 0; - - /* check state of lock */ - ret = vconf_get_int(VCONFKEY_IDLE_LOCK_STATE, &lock_state); - if (ret > 0 && lock_state == VCONFKEY_IDLE_LOCK) - return G_SOURCE_REMOVE; - else if (ret < 0) - _E("Failed to get vconf value for idle lock state: %d", vconf_get_ext_errno()); - - /* lock screen is not launched yet, but lcd is on */ - if (check_lcd_is_on() == false) - lcd_on_procedure(LCD_NORMAL, NORMAL_MODE); - - return G_SOURCE_REMOVE; -} - -static inline void stop_lock_timer(void) -{ - if (lock_timeout_id) { - g_source_remove(lock_timeout_id); - lock_timeout_id = 0; - } -} - -static void check_lock_screen(void) -{ - int lock_state, ret; - - stop_lock_timer(); - - /* check state of lock */ - ret = vconf_get_int(VCONFKEY_IDLE_LOCK_STATE, &lock_state); - if (ret < 0 || lock_state == VCONFKEY_IDLE_LOCK) - return; - - /* Use time to check lock is done. */ - lock_timeout_id = g_timeout_add(display_conf.lock_wait_time, - lcd_on_expired, NULL); -} - /* default enter action function */ static int default_action(int timeout) { @@ -826,9 +780,7 @@ static int default_action(int timeout) * normal state : backlight on and restore * the previous brightness */ - if ((get_pm_old_state() == S_LCDOFF) || (get_pm_old_state() == S_SLEEP)) - check_lock_screen(); - else if (get_pm_old_state() == S_LCDDIM) + if (get_pm_old_state() == S_LCDDIM) display_backlight_update_by_default_brightness(); if (check_lcd_is_on() == false) @@ -850,7 +802,6 @@ static int default_action(int timeout) case S_LCDOFF: if ((get_pm_old_state() != S_SLEEP) && (get_pm_old_state() != S_LCDOFF)) { - stop_lock_timer(); /* lcd off state : turn off the backlight */ if (display_panel_get_dpms_cached_state() == DPMS_ON) lcd_off_procedure(LCD_OFF_BY_TIMEOUT); @@ -863,9 +814,6 @@ static int default_action(int timeout) break; case S_SLEEP: - if ((get_pm_old_state() != S_SLEEP) && (get_pm_old_state() != S_LCDOFF)) - stop_lock_timer(); - if (display_panel_get_dpms_cached_state() == DPMS_ON) lcd_off_procedure(LCD_OFF_BY_TIMEOUT); @@ -1015,7 +963,6 @@ static int update_setting(int key_idx, int val) display_panel_get_dpms_cached_state() != DPMS_ON && is_lcdon_blocked() == LCDON_BLOCK_NONE) lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT); - stop_lock_timer(); display_state_transition_update_display_state_timeout_by_priority(); if (get_pm_cur_state() == S_NORMAL) display_state_transition_do_state_transition(get_pm_cur_state(), EVENT_INPUT); diff --git a/plugins/mobile/display/core.c b/plugins/mobile/display/core.c index 6d1244d..51daaac 100644 --- a/plugins/mobile/display/core.c +++ b/plugins/mobile/display/core.c @@ -102,7 +102,6 @@ static enum device_ops_status status = DEVICE_OPS_STATUS_UNINIT; static int system_wakeup_flag = false; static char *custom_change_name; -static guint lock_timeout_id; static struct timeval lcdon_tv; /* * The two variables(lcdon_broadcast, pmstate_suspend) must be set initial @@ -733,51 +732,6 @@ static void sig_hup(int signo) pm_save_logdump(); } -static gboolean lcd_on_expired(void *data) -{ - int lock_state, ret; - - if (lock_timeout_id) - lock_timeout_id = 0; - - /* check state of lock */ - ret = vconf_get_int(VCONFKEY_IDLE_LOCK_STATE, &lock_state); - if (ret > 0 && lock_state == VCONFKEY_IDLE_LOCK) - return G_SOURCE_REMOVE; - else if (ret < 0) - _E("Failed to get vconf value for idle lock state: %d", vconf_get_ext_errno()); - - /* lock screen is not launched yet, but lcd is on */ - if (check_lcd_is_on() == false) - lcd_on_procedure(LCD_NORMAL, NORMAL_MODE); - - return G_SOURCE_REMOVE; -} - -static inline void stop_lock_timer(void) -{ - if (lock_timeout_id) { - g_source_remove(lock_timeout_id); - lock_timeout_id = 0; - } -} - -static void check_lock_screen(void) -{ - int lock_state, ret; - - stop_lock_timer(); - - /* check state of lock */ - ret = vconf_get_int(VCONFKEY_IDLE_LOCK_STATE, &lock_state); - if (ret < 0 || lock_state == VCONFKEY_IDLE_LOCK) - return; - - /* Use time to check lock is done. */ - lock_timeout_id = g_timeout_add(display_conf.lock_wait_time, - lcd_on_expired, NULL); -} - /* default enter action function */ static int default_action(int timeout) { @@ -836,9 +790,7 @@ static int default_action(int timeout) * normal state : backlight on and restore * the previous brightness */ - if ((get_pm_old_state() == S_LCDOFF) || (get_pm_old_state() == S_SLEEP)) - check_lock_screen(); - else if (get_pm_old_state() == S_LCDDIM) + if (get_pm_old_state() == S_LCDDIM) display_backlight_update_by_default_brightness(); if (check_lcd_is_on() == false) @@ -860,7 +812,6 @@ static int default_action(int timeout) case S_LCDOFF: if ((get_pm_old_state() != S_SLEEP) && (get_pm_old_state() != S_LCDOFF)) { - stop_lock_timer(); /* lcd off state : turn off the backlight */ if (display_panel_get_dpms_cached_state() == DPMS_ON) lcd_off_procedure(LCD_OFF_BY_TIMEOUT); @@ -873,9 +824,6 @@ static int default_action(int timeout) break; case S_SLEEP: - if ((get_pm_old_state() != S_SLEEP) && (get_pm_old_state() != S_LCDOFF)) - stop_lock_timer(); - if (display_panel_get_dpms_cached_state() == DPMS_ON) lcd_off_procedure(LCD_OFF_BY_TIMEOUT); @@ -1025,7 +973,6 @@ static int update_setting(int key_idx, int val) display_panel_get_dpms_cached_state() != DPMS_ON && is_lcdon_blocked() == LCDON_BLOCK_NONE) lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT); - stop_lock_timer(); display_state_transition_update_display_state_timeout_by_priority(); if (get_pm_cur_state() == S_NORMAL) display_state_transition_do_state_transition(get_pm_cur_state(), EVENT_INPUT); diff --git a/plugins/tv/display/core.c b/plugins/tv/display/core.c index 33072ae..05826a9 100644 --- a/plugins/tv/display/core.c +++ b/plugins/tv/display/core.c @@ -100,7 +100,6 @@ static enum device_ops_status status = DEVICE_OPS_STATUS_UNINIT; static int system_wakeup_flag = false; static char *custom_change_name; -static guint lock_timeout_id; static struct timeval lcdon_tv; /* * The two variables(lcdon_broadcast, pmstate_suspend) must be set initial @@ -723,51 +722,6 @@ static void sig_hup(int signo) pm_save_logdump(); } -static gboolean lcd_on_expired(void *data) -{ - int lock_state, ret; - - if (lock_timeout_id) - lock_timeout_id = 0; - - /* check state of lock */ - ret = vconf_get_int(VCONFKEY_IDLE_LOCK_STATE, &lock_state); - if (ret > 0 && lock_state == VCONFKEY_IDLE_LOCK) - return G_SOURCE_REMOVE; - else if (ret < 0) - _E("Failed to get vconf value for idle lock state: %d", vconf_get_ext_errno()); - - /* lock screen is not launched yet, but lcd is on */ - if (check_lcd_is_on() == false) - lcd_on_procedure(LCD_NORMAL, NORMAL_MODE); - - return G_SOURCE_REMOVE; -} - -static inline void stop_lock_timer(void) -{ - if (lock_timeout_id) { - g_source_remove(lock_timeout_id); - lock_timeout_id = 0; - } -} - -static void check_lock_screen(void) -{ - int lock_state, ret; - - stop_lock_timer(); - - /* check state of lock */ - ret = vconf_get_int(VCONFKEY_IDLE_LOCK_STATE, &lock_state); - if (ret < 0 || lock_state == VCONFKEY_IDLE_LOCK) - return; - - /* Use time to check lock is done. */ - lock_timeout_id = g_timeout_add(display_conf.lock_wait_time, - lcd_on_expired, NULL); -} - /* default enter action function */ static int default_action(int timeout) { @@ -826,9 +780,7 @@ static int default_action(int timeout) * normal state : backlight on and restore * the previous brightness */ - if ((get_pm_old_state() == S_LCDOFF) || (get_pm_old_state() == S_SLEEP)) - check_lock_screen(); - else if (get_pm_old_state() == S_LCDDIM) + if (get_pm_old_state() == S_LCDDIM) display_backlight_update_by_default_brightness(); if (check_lcd_is_on() == false) @@ -850,7 +802,6 @@ static int default_action(int timeout) case S_LCDOFF: if ((get_pm_old_state() != S_SLEEP) && (get_pm_old_state() != S_LCDOFF)) { - stop_lock_timer(); /* lcd off state : turn off the backlight */ if (display_panel_get_dpms_cached_state() == DPMS_ON) lcd_off_procedure(LCD_OFF_BY_TIMEOUT); @@ -863,9 +814,6 @@ static int default_action(int timeout) break; case S_SLEEP: - if ((get_pm_old_state() != S_SLEEP) && (get_pm_old_state() != S_LCDOFF)) - stop_lock_timer(); - if (display_panel_get_dpms_cached_state() == DPMS_ON) lcd_off_procedure(LCD_OFF_BY_TIMEOUT); @@ -1015,7 +963,6 @@ static int update_setting(int key_idx, int val) display_panel_get_dpms_cached_state() != DPMS_ON && is_lcdon_blocked() == LCDON_BLOCK_NONE) lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT); - stop_lock_timer(); display_state_transition_update_display_state_timeout_by_priority(); if (get_pm_cur_state() == S_NORMAL) display_state_transition_do_state_transition(get_pm_cur_state(), EVENT_INPUT); diff --git a/plugins/wearable/display/core.c b/plugins/wearable/display/core.c index de873cb..a47192f 100644 --- a/plugins/wearable/display/core.c +++ b/plugins/wearable/display/core.c @@ -112,7 +112,6 @@ static enum device_ops_status status = DEVICE_OPS_STATUS_UNINIT; static int system_wakeup_flag = false; static char *custom_change_name; -static guint lock_timeout_id; static guint transit_timer; static struct timeval lcdon_tv; /* @@ -1119,51 +1118,6 @@ static int default_trans(int evt) return 0; } -static gboolean lcd_on_expired(void *data) -{ - int lock_state, ret; - - if (lock_timeout_id) - lock_timeout_id = 0; - - /* check state of lock */ - ret = vconf_get_int(VCONFKEY_IDLE_LOCK_STATE, &lock_state); - if (ret > 0 && lock_state == VCONFKEY_IDLE_LOCK) - return G_SOURCE_REMOVE; - else if (ret < 0) - _E("Failed to get vconf value for idle lock state: %d", vconf_get_ext_errno()); - - /* lock screen is not launched yet, but lcd is on */ - if (check_lcd_is_on() == false) - lcd_on_procedure(LCD_NORMAL, NORMAL_MODE); - - return G_SOURCE_REMOVE; -} - -static inline void stop_lock_timer(void) -{ - if (lock_timeout_id) { - g_source_remove(lock_timeout_id); - lock_timeout_id = 0; - } -} - -static void check_lock_screen(void) -{ - int lock_state, ret; - - stop_lock_timer(); - - /* check state of lock */ - ret = vconf_get_int(VCONFKEY_IDLE_LOCK_STATE, &lock_state); - if (ret < 0 || lock_state == VCONFKEY_IDLE_LOCK) - return; - - /* Use time to check lock is done. */ - lock_timeout_id = g_timeout_add(display_conf.lock_wait_time, - lcd_on_expired, NULL); -} - /* default enter action function */ static int default_action(int timeout) { @@ -1234,9 +1188,7 @@ static int default_action(int timeout) * normal state : backlight on and restore * the previous brightness */ - if ((get_pm_old_state() == S_LCDOFF) || (get_pm_old_state() == S_SLEEP)) - check_lock_screen(); - else if (get_pm_old_state() == S_LCDDIM) + if (get_pm_old_state() == S_LCDDIM) display_backlight_update_by_default_brightness(); if (check_lcd_is_on() == false) @@ -1258,7 +1210,6 @@ static int default_action(int timeout) case S_LCDOFF: if ((get_pm_old_state() != S_SLEEP) && (get_pm_old_state() != S_LCDOFF)) { - stop_lock_timer(); /* lcd off state : turn off the backlight */ if (display_panel_get_dpms_cached_state() == DPMS_ON) lcd_off_procedure(LCD_OFF_BY_TIMEOUT); @@ -1271,9 +1222,6 @@ static int default_action(int timeout) break; case S_SLEEP: - if ((get_pm_old_state() != S_SLEEP) && (get_pm_old_state() != S_LCDOFF)) - stop_lock_timer(); - if (display_panel_get_dpms_cached_state() == DPMS_ON) lcd_off_procedure(LCD_OFF_BY_TIMEOUT); @@ -1421,7 +1369,6 @@ static int update_setting(int key_idx, int val) display_panel_get_dpms_cached_state() != DPMS_ON && is_lcdon_blocked() == LCDON_BLOCK_NONE) lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT); - stop_lock_timer(); display_state_transition_update_display_state_timeout_by_priority(); if (get_pm_cur_state() == S_NORMAL) states[get_pm_cur_state()].trans(EVENT_INPUT); -- 2.7.4