From 9f9ed65f7211990425d03b5a79719a7e0efe5869 Mon Sep 17 00:00:00 2001 From: Youngjae Cho Date: Tue, 13 Jun 2023 12:36:07 +0900 Subject: [PATCH] display: Remove unused holdkeyblock code Change-Id: I28ad71cca7b84f459adf333765ac213e6eb31929 Signed-off-by: Youngjae Cho --- plugins/iot-headed/display/core.c | 27 ++++------------- plugins/iot-headed/display/key-filter.c | 33 +++++++++------------ plugins/mobile/display/core.c | 27 ++++------------- plugins/mobile/display/key-filter.c | 33 +++++++++------------ plugins/tv/display/core.c | 27 ++++------------- plugins/tv/display/key-filter.c | 33 +++++++++------------ plugins/wearable/display/core.c | 26 ++++------------ plugins/wearable/display/key-filter.c | 33 +++++++++------------ src/display/core.h | 2 +- src/display/display-lock.c | 51 ++------------------------------ src/display/display-lock.h | 7 +---- src/display/plugin-common/display-dbus.c | 13 ++++---- src/display/plugin-common/poll.c | 3 -- src/display/poll.h | 3 -- src/libdeviced/display.c | 9 +----- 15 files changed, 91 insertions(+), 236 deletions(-) diff --git a/plugins/iot-headed/display/core.c b/plugins/iot-headed/display/core.c index 484832f..a547016 100644 --- a/plugins/iot-headed/display/core.c +++ b/plugins/iot-headed/display/core.c @@ -259,7 +259,6 @@ int custom_lcdoff(enum device_flags flag) check_processes(S_NORMAL); check_processes(S_LCDDIM); - /* check holdkey block flag in lock node */ if (check_lock_condition(S_NORMAL) || check_lock_condition(S_LCDDIM)) { /* * When another proccess is normal lock, device is received call then, @@ -343,7 +342,6 @@ int display_off_by_reason(const char *reason) check_processes(S_NORMAL); check_processes(S_LCDDIM); - /* check holdkey block flag in lock node */ if (check_lock_condition(S_NORMAL) || check_lock_condition(S_LCDDIM)) { _I("skip platform lcd off by gesture"); return -ECANCELED; @@ -442,7 +440,7 @@ static void proc_condition_lock(PMMsg *data) char pname[PATH_MAX]; pid_t pid = data->pid; enum state_t state; - int holdkey_block, ret; + int ret; bool value = true; unsigned int flags; const char *lock_type = NULL; @@ -458,8 +456,7 @@ static void proc_condition_lock(PMMsg *data) (pm_get_power_lock() == POWER_UNLOCK)) proc_change_state(data->cond, INTERNAL_LOCK_PM); - holdkey_block = GET_COND_FLAG(data->cond) & PM_FLAG_BLOCK_HOLDKEY; - tmp = display_lock_add_pmlock_node(state, pid, holdkey_block, data->timeout); + tmp = display_lock_add_pmlock_node(state, pid, data->timeout); if (!tmp) { _E("Failed to acquire lock, state: %d, pid: %d.", state, pid); return; @@ -491,8 +488,8 @@ static void proc_condition_lock(PMMsg *data) } } - _SD("be requested LOCK info pname(%s), holdkeyblock(%d) flags(%d)", - pname, holdkey_block, flags); + _SD("be requested LOCK info pname(%s), flags(%d)", + pname, flags); set_lock_time(pid, pname, state); device_notify(DEVICE_NOTIFIER_DISPLAY_LOCK, (void *)&value); @@ -821,7 +818,7 @@ static const char *errMSG[INIT_END] = { [INIT_DBUS] = "d-bus init error", }; -int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) +int set_lcd_timeout(int on, int dim, const char *name) { unsigned int custom_normal_timeout = 0; unsigned int custom_dim_timeout = 0; @@ -843,14 +840,6 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) if (get_pm_cur_state() == S_NORMAL) display_state_transition_do_state_transition(get_pm_cur_state(), EVENT_INPUT); - if (holdkey_block) { - display_lock_set_custom_holdkey_block(true); - _I("Hold key disabled."); - } else { - display_lock_set_custom_holdkey_block(false); - _I("Hold key enabled."); - } - if (custom_change_name) { free(custom_change_name); custom_change_name = 0; @@ -858,9 +847,7 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) display_state_transition_get_custom_timeout(S_NORMAL, &custom_normal_timeout); display_state_transition_get_custom_timeout(S_LCDDIM, &custom_dim_timeout); - if (custom_normal_timeout == 0 && - custom_dim_timeout == 0 && - !holdkey_block) + if (custom_normal_timeout == 0 && custom_dim_timeout == 0) return 0; custom_change_name = strndup(name, strlen(name)); @@ -868,7 +855,6 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) _E("Failed to malloc."); display_state_transition_set_custom_timeout(S_NORMAL, 0); display_state_transition_set_custom_timeout(S_LCDDIM, 0); - display_lock_set_custom_holdkey_block(false); return -ENOMEM; } @@ -895,7 +881,6 @@ void reset_lcd_timeout(GDBusConnection *conn, custom_change_name = 0; display_state_transition_set_custom_timeout(S_NORMAL, 0); display_state_transition_set_custom_timeout(S_LCDDIM, 0); - display_lock_set_custom_holdkey_block(false); display_state_transition_update_display_state_timeout_by_priority(); if (get_pm_cur_state() == S_NORMAL) diff --git a/plugins/iot-headed/display/key-filter.c b/plugins/iot-headed/display/key-filter.c index c6aa7d1..a2f7b34 100644 --- a/plugins/iot-headed/display/key-filter.c +++ b/plugins/iot-headed/display/key-filter.c @@ -389,17 +389,14 @@ static int lcdoff_powerkey(void) check_processes(S_NORMAL); check_processes(S_LCDDIM); - if (!check_holdkey_block(S_NORMAL) && - !check_holdkey_block(S_LCDDIM)) { - if (display_info.update_auto_brightness) - display_info.update_auto_brightness(false); - switch_off_lcd(); - delete_condition(S_NORMAL); - delete_condition(S_LCDDIM); - display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY); - if (disp_plgn->pm_change_internal) - disp_plgn->pm_change_internal(INTERNAL_LOCK_POWERKEY, LCD_OFF); - } + if (display_info.update_auto_brightness) + display_info.update_auto_brightness(false); + switch_off_lcd(); + delete_condition(S_NORMAL); + delete_condition(S_LCDDIM); + display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY); + if (disp_plgn->pm_change_internal) + disp_plgn->pm_change_internal(INTERNAL_LOCK_POWERKEY, LCD_OFF); } else { ignore = false; skip_combination = false; @@ -507,15 +504,13 @@ static int process_screenlock_key(struct input_event *pinput) check_processes(S_NORMAL); check_processes(S_LCDDIM); - if (!check_holdkey_block(S_NORMAL) && !check_holdkey_block(S_LCDDIM)) { - delete_condition(S_NORMAL); - delete_condition(S_LCDDIM); - display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY); + delete_condition(S_NORMAL); + delete_condition(S_LCDDIM); + display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY); - /* LCD off forcly */ - if (disp_plgn->pm_change_internal) - disp_plgn->pm_change_internal(-1, LCD_OFF); - } + /* LCD off forcly */ + if (disp_plgn->pm_change_internal) + disp_plgn->pm_change_internal(-1, LCD_OFF); return true; } diff --git a/plugins/mobile/display/core.c b/plugins/mobile/display/core.c index b6f15f0..8ea1bf6 100644 --- a/plugins/mobile/display/core.c +++ b/plugins/mobile/display/core.c @@ -266,7 +266,6 @@ int custom_lcdoff(enum device_flags flag) check_processes(S_NORMAL); check_processes(S_LCDDIM); - /* check holdkey block flag in lock node */ if (check_lock_condition(S_NORMAL) || check_lock_condition(S_LCDDIM)) { /* * When another proccess is normal lock, device is received call then, @@ -350,7 +349,6 @@ int display_off_by_reason(const char *reason) check_processes(S_NORMAL); check_processes(S_LCDDIM); - /* check holdkey block flag in lock node */ if (check_lock_condition(S_NORMAL) || check_lock_condition(S_LCDDIM)) { _I("skip platform lcd off by gesture"); return -ECANCELED; @@ -452,7 +450,7 @@ static void proc_condition_lock(PMMsg *data) char pname[PATH_MAX]; pid_t pid = data->pid; enum state_t state; - int holdkey_block, ret; + int ret; bool value = true; unsigned int flags; const char *lock_type = NULL; @@ -468,8 +466,7 @@ static void proc_condition_lock(PMMsg *data) (pm_get_power_lock() == POWER_UNLOCK)) proc_change_state(data->cond, INTERNAL_LOCK_PM); - holdkey_block = GET_COND_FLAG(data->cond) & PM_FLAG_BLOCK_HOLDKEY; - tmp = display_lock_add_pmlock_node(state, pid, holdkey_block, data->timeout); + tmp = display_lock_add_pmlock_node(state, pid, data->timeout); if (!tmp) { _E("Failed to acquire lock, state: %d, pid: %d.", state, pid); return; @@ -500,8 +497,8 @@ static void proc_condition_lock(PMMsg *data) _E("Failed to send dbus signal PowerLock."); } } - _SD("be requested LOCK info pname(%s), holdkeyblock(%d) flags(%d)", - pname, holdkey_block, flags); + _SD("be requested LOCK info pname(%s), flags(%d)", + pname, flags); set_lock_time(pid, pname, state); device_notify(DEVICE_NOTIFIER_DISPLAY_LOCK, (void *)&value); @@ -830,7 +827,7 @@ static const char *errMSG[INIT_END] = { [INIT_DBUS] = "d-bus init error", }; -int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) +int set_lcd_timeout(int on, int dim, const char *name) { unsigned int custom_normal_timeout = 0; unsigned int custom_dim_timeout = 0; @@ -852,14 +849,6 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) if (get_pm_cur_state() == S_NORMAL) display_state_transition_do_state_transition(get_pm_cur_state(), EVENT_INPUT); - if (holdkey_block) { - display_lock_set_custom_holdkey_block(true); - _I("Hold key disabled."); - } else { - display_lock_set_custom_holdkey_block(false); - _I("Hold key enabled."); - } - if (custom_change_name) { free(custom_change_name); custom_change_name = 0; @@ -867,9 +856,7 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) display_state_transition_get_custom_timeout(S_NORMAL, &custom_normal_timeout); display_state_transition_get_custom_timeout(S_LCDDIM, &custom_dim_timeout); - if (custom_normal_timeout == 0 && - custom_dim_timeout == 0 && - !holdkey_block) + if (custom_normal_timeout == 0 && custom_dim_timeout == 0) return 0; custom_change_name = strndup(name, strlen(name)); @@ -877,7 +864,6 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) _E("Failed to malloc."); display_state_transition_set_custom_timeout(S_NORMAL, 0); display_state_transition_set_custom_timeout(S_LCDDIM, 0); - display_lock_set_custom_holdkey_block(false); return -ENOMEM; } @@ -904,7 +890,6 @@ void reset_lcd_timeout(GDBusConnection *conn, custom_change_name = 0; display_state_transition_set_custom_timeout(S_NORMAL, 0); display_state_transition_set_custom_timeout(S_LCDDIM, 0); - display_lock_set_custom_holdkey_block(false); display_state_transition_update_display_state_timeout_by_priority(); if (get_pm_cur_state() == S_NORMAL) diff --git a/plugins/mobile/display/key-filter.c b/plugins/mobile/display/key-filter.c index a8dbe81..b687754 100644 --- a/plugins/mobile/display/key-filter.c +++ b/plugins/mobile/display/key-filter.c @@ -379,17 +379,14 @@ static int lcdoff_powerkey(void) check_processes(S_NORMAL); check_processes(S_LCDDIM); - if (!check_holdkey_block(S_NORMAL) && - !check_holdkey_block(S_LCDDIM)) { - if (display_info.update_auto_brightness) - display_info.update_auto_brightness(false); - switch_off_lcd(); - delete_condition(S_NORMAL); - delete_condition(S_LCDDIM); - display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY); - if (disp_plgn->pm_change_internal) - disp_plgn->pm_change_internal(INTERNAL_LOCK_POWERKEY, LCD_OFF); - } + if (display_info.update_auto_brightness) + display_info.update_auto_brightness(false); + switch_off_lcd(); + delete_condition(S_NORMAL); + delete_condition(S_LCDDIM); + display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY); + if (disp_plgn->pm_change_internal) + disp_plgn->pm_change_internal(INTERNAL_LOCK_POWERKEY, LCD_OFF); } else { ignore = false; skip_combination = false; @@ -540,15 +537,13 @@ static int process_screenlock_key(struct input_event *pinput) check_processes(S_NORMAL); check_processes(S_LCDDIM); - if (!check_holdkey_block(S_NORMAL) && !check_holdkey_block(S_LCDDIM)) { - delete_condition(S_NORMAL); - delete_condition(S_LCDDIM); - display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY); + delete_condition(S_NORMAL); + delete_condition(S_LCDDIM); + display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY); - /* LCD off forcly */ - if (disp_plgn->pm_change_internal) - disp_plgn->pm_change_internal(-1, LCD_OFF); - } + /* LCD off forcly */ + if (disp_plgn->pm_change_internal) + disp_plgn->pm_change_internal(-1, LCD_OFF); return true; } diff --git a/plugins/tv/display/core.c b/plugins/tv/display/core.c index 8397009..a585c86 100644 --- a/plugins/tv/display/core.c +++ b/plugins/tv/display/core.c @@ -259,7 +259,6 @@ int custom_lcdoff(enum device_flags flag) check_processes(S_NORMAL); check_processes(S_LCDDIM); - /* check holdkey block flag in lock node */ if (check_lock_condition(S_NORMAL) || check_lock_condition(S_LCDDIM)) { /* * When another proccess is normal lock, device is received call then, @@ -343,7 +342,6 @@ int display_off_by_reason(const char *reason) check_processes(S_NORMAL); check_processes(S_LCDDIM); - /* check holdkey block flag in lock node */ if (check_lock_condition(S_NORMAL) || check_lock_condition(S_LCDDIM)) { _I("skip platform lcd off by gesture"); return -ECANCELED; @@ -441,7 +439,7 @@ static void proc_condition_lock(PMMsg *data) char pname[PATH_MAX]; pid_t pid = data->pid; enum state_t state; - int holdkey_block, ret; + int ret; bool value = true; unsigned int flags; const char *lock_type = NULL; @@ -457,8 +455,7 @@ static void proc_condition_lock(PMMsg *data) (pm_get_power_lock() == POWER_UNLOCK)) proc_change_state(data->cond, INTERNAL_LOCK_PM); - holdkey_block = GET_COND_FLAG(data->cond) & PM_FLAG_BLOCK_HOLDKEY; - tmp = display_lock_add_pmlock_node(state, pid, holdkey_block, data->timeout); + tmp = display_lock_add_pmlock_node(state, pid, data->timeout); if (!tmp) { _E("Failed to acquire lock, state: %d, pid: %d.", state, pid); return; @@ -490,8 +487,8 @@ static void proc_condition_lock(PMMsg *data) } } - _SD("be requested LOCK info pname(%s), holdkeyblock(%d) flags(%d)", - pname, holdkey_block, flags); + _SD("be requested LOCK info pname(%s), flags(%d)", + pname, flags); set_lock_time(pid, pname, state); device_notify(DEVICE_NOTIFIER_DISPLAY_LOCK, (void *)&value); @@ -820,7 +817,7 @@ static const char *errMSG[INIT_END] = { [INIT_DBUS] = "d-bus init error", }; -int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) +int set_lcd_timeout(int on, int dim, const char *name) { unsigned int custom_normal_timeout = 0; unsigned int custom_dim_timeout = 0; @@ -842,14 +839,6 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) if (get_pm_cur_state() == S_NORMAL) display_state_transition_do_state_transition(get_pm_cur_state(), EVENT_INPUT); - if (holdkey_block) { - display_lock_set_custom_holdkey_block(true); - _I("Hold key disabled."); - } else { - display_lock_set_custom_holdkey_block(false); - _I("Hold key enabled."); - } - if (custom_change_name) { free(custom_change_name); custom_change_name = 0; @@ -857,9 +846,7 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) display_state_transition_get_custom_timeout(S_NORMAL, &custom_normal_timeout); display_state_transition_get_custom_timeout(S_LCDDIM, &custom_dim_timeout); - if (custom_normal_timeout == 0 && - custom_dim_timeout == 0 && - !holdkey_block) + if (custom_normal_timeout == 0 && custom_dim_timeout == 0) return 0; custom_change_name = strndup(name, strlen(name)); @@ -867,7 +854,6 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) _E("Failed to malloc."); display_state_transition_set_custom_timeout(S_NORMAL, 0); display_state_transition_set_custom_timeout(S_LCDDIM, 0); - display_lock_set_custom_holdkey_block(false); return -ENOMEM; } @@ -894,7 +880,6 @@ void reset_lcd_timeout(GDBusConnection *conn, custom_change_name = 0; display_state_transition_set_custom_timeout(S_NORMAL, 0); display_state_transition_set_custom_timeout(S_LCDDIM, 0); - display_lock_set_custom_holdkey_block(false); display_state_transition_update_display_state_timeout_by_priority(); if (get_pm_cur_state() == S_NORMAL) diff --git a/plugins/tv/display/key-filter.c b/plugins/tv/display/key-filter.c index a6c969d..ca54808 100644 --- a/plugins/tv/display/key-filter.c +++ b/plugins/tv/display/key-filter.c @@ -389,17 +389,14 @@ static int lcdoff_powerkey(void) check_processes(S_NORMAL); check_processes(S_LCDDIM); - if (!check_holdkey_block(S_NORMAL) && - !check_holdkey_block(S_LCDDIM)) { - if (display_info.update_auto_brightness) - display_info.update_auto_brightness(false); - switch_off_lcd(); - delete_condition(S_NORMAL); - delete_condition(S_LCDDIM); - display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY); - if (disp_plgn->pm_change_internal) - disp_plgn->pm_change_internal(INTERNAL_LOCK_POWERKEY, LCD_OFF); - } + if (display_info.update_auto_brightness) + display_info.update_auto_brightness(false); + switch_off_lcd(); + delete_condition(S_NORMAL); + delete_condition(S_LCDDIM); + display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY); + if (disp_plgn->pm_change_internal) + disp_plgn->pm_change_internal(INTERNAL_LOCK_POWERKEY, LCD_OFF); } else { ignore = false; skip_combination = false; @@ -507,15 +504,13 @@ static int process_screenlock_key(struct input_event *pinput) check_processes(S_NORMAL); check_processes(S_LCDDIM); - if (!check_holdkey_block(S_NORMAL) && !check_holdkey_block(S_LCDDIM)) { - delete_condition(S_NORMAL); - delete_condition(S_LCDDIM); - display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY); + delete_condition(S_NORMAL); + delete_condition(S_LCDDIM); + display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY); - /* LCD off forcly */ - if (disp_plgn->pm_change_internal) - disp_plgn->pm_change_internal(-1, LCD_OFF); - } + /* LCD off forcly */ + if (disp_plgn->pm_change_internal) + disp_plgn->pm_change_internal(-1, LCD_OFF); return true; } diff --git a/plugins/wearable/display/core.c b/plugins/wearable/display/core.c index ee2c0a5..fecdae8 100644 --- a/plugins/wearable/display/core.c +++ b/plugins/wearable/display/core.c @@ -515,7 +515,6 @@ int custom_lcdoff(enum device_flags flag) check_processes(S_NORMAL); check_processes(S_LCDDIM); - /* check holdkey block flag in lock node */ if (check_lock_condition(S_NORMAL) || check_lock_condition(S_LCDDIM)) { /* * When another proccess is normal lock, device is received call then, @@ -603,7 +602,6 @@ int display_off_by_reason(const char *reason) check_processes(S_NORMAL); check_processes(S_LCDDIM); - /* check holdkey block flag in lock node */ if (check_lock_condition(S_NORMAL) || check_lock_condition(S_LCDDIM)) { _I("skip platform lcd off by gesture"); return -ECANCELED; @@ -710,7 +708,7 @@ static void proc_condition_lock(PMMsg *data) char pname[PATH_MAX]; pid_t pid = data->pid; enum state_t state; - int holdkey_block, ret; + int ret; bool value = true; unsigned int flags; const char *lock_type = NULL; @@ -726,8 +724,7 @@ static void proc_condition_lock(PMMsg *data) (pm_get_power_lock() == POWER_UNLOCK)) proc_change_state(data->cond, INTERNAL_LOCK_PM); - holdkey_block = GET_COND_FLAG(data->cond) & PM_FLAG_BLOCK_HOLDKEY; - tmp = display_lock_add_pmlock_node(state, pid, holdkey_block, data->timeout); + tmp = display_lock_add_pmlock_node(state, pid, data->timeout); if (!tmp) { _E("Failed to acquire lock, state: %d, pid: %d.", state, pid); return; @@ -759,7 +756,8 @@ static void proc_condition_lock(PMMsg *data) } } - _SD("be requested LOCK info pname(%s), holdkeyblock(%d) flags(%d)", pname, holdkey_block, flags); + _SD("be requested LOCK info pname(%s), flags(%d)", + pname, flags); set_lock_time(pid, pname, state); device_notify(DEVICE_NOTIFIER_DISPLAY_LOCK, (void *)&value); @@ -1288,7 +1286,7 @@ static const char *errMSG[INIT_END] = { [INIT_DBUS] = "d-bus init error", }; -int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) +int set_lcd_timeout(int on, int dim, const char *name) { unsigned int custom_normal_timeout = 0; unsigned int custom_dim_timeout = 0; @@ -1310,14 +1308,6 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) if (get_pm_cur_state() == S_NORMAL) states[get_pm_cur_state()].trans(EVENT_INPUT); - if (holdkey_block) { - display_lock_set_custom_holdkey_block(true); - _I("Hold key disabled."); - } else { - display_lock_set_custom_holdkey_block(false); - _I("Hold key enabled."); - } - if (custom_change_name) { free(custom_change_name); custom_change_name = 0; @@ -1325,9 +1315,7 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) display_state_transition_get_custom_timeout(S_NORMAL, &custom_normal_timeout); display_state_transition_get_custom_timeout(S_LCDDIM, &custom_dim_timeout); - if (custom_normal_timeout == 0 && - custom_dim_timeout == 0 && - !holdkey_block) + if (custom_normal_timeout == 0 && custom_dim_timeout == 0) return 0; custom_change_name = strndup(name, strlen(name)); @@ -1335,7 +1323,6 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name) _E("Failed to malloc."); display_state_transition_set_custom_timeout(S_NORMAL, 0); display_state_transition_set_custom_timeout(S_LCDDIM, 0); - display_lock_set_custom_holdkey_block(false); return -ENOMEM; } @@ -1362,7 +1349,6 @@ void reset_lcd_timeout(GDBusConnection *conn, custom_change_name = 0; display_state_transition_set_custom_timeout(S_NORMAL, 0); display_state_transition_set_custom_timeout(S_LCDDIM, 0); - display_lock_set_custom_holdkey_block(false); display_state_transition_update_display_state_timeout_by_priority(); if (get_pm_cur_state() == S_NORMAL) diff --git a/plugins/wearable/display/key-filter.c b/plugins/wearable/display/key-filter.c index 19ae629..a40dd48 100644 --- a/plugins/wearable/display/key-filter.c +++ b/plugins/wearable/display/key-filter.c @@ -386,17 +386,14 @@ static int lcdoff_powerkey(void) check_processes(S_NORMAL); check_processes(S_LCDDIM); - if (!check_holdkey_block(S_NORMAL) && - !check_holdkey_block(S_LCDDIM)) { - if (display_info.update_auto_brightness) - display_info.update_auto_brightness(false); - switch_off_lcd(); - delete_condition(S_NORMAL); - delete_condition(S_LCDDIM); - display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY); - if (disp_plgn->pm_change_internal) - disp_plgn->pm_change_internal(INTERNAL_LOCK_POWERKEY, LCD_OFF); - } + if (display_info.update_auto_brightness) + display_info.update_auto_brightness(false); + switch_off_lcd(); + delete_condition(S_NORMAL); + delete_condition(S_LCDDIM); + display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY); + if (disp_plgn->pm_change_internal) + disp_plgn->pm_change_internal(INTERNAL_LOCK_POWERKEY, LCD_OFF); } else { ignore = false; skip_combination = false; @@ -504,15 +501,13 @@ static int process_screenlock_key(struct input_event *pinput) check_processes(S_NORMAL); check_processes(S_LCDDIM); - if (!check_holdkey_block(S_NORMAL) && !check_holdkey_block(S_LCDDIM)) { - delete_condition(S_NORMAL); - delete_condition(S_LCDDIM); - display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY); + delete_condition(S_NORMAL); + delete_condition(S_LCDDIM); + display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY); - /* LCD off forcly */ - if (disp_plgn->pm_change_internal) - disp_plgn->pm_change_internal(-1, LCD_OFF); - } + /* LCD off forcly */ + if (disp_plgn->pm_change_internal) + disp_plgn->pm_change_internal(-1, LCD_OFF); return true; } diff --git a/src/display/core.h b/src/display/core.h index 9c07e26..96b4b8e 100644 --- a/src/display/core.h +++ b/src/display/core.h @@ -125,7 +125,7 @@ int delete_condition(enum state_t state); int custom_lcdoff(enum device_flags flag); int display_on_by_reason(const char *reason, int timeout); int display_off_by_reason(const char *reason); -int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name); +int set_lcd_timeout(int on, int dim, const char *name); int custom_lcdon(int timeout); void lcd_on_direct(enum device_flags flags); void broadcast_lcd_off_late(enum device_flags flags); diff --git a/src/display/display-lock.c b/src/display/display-lock.c index 0e20288..ab719d1 100644 --- a/src/display/display-lock.c +++ b/src/display/display-lock.c @@ -44,7 +44,6 @@ static GList *cond_head[S_END]; static int trans_condition; -static bool custom_holdkey_block = false; bool check_lock_state(int state) { @@ -313,7 +312,7 @@ static int add_delete_state_cond_callback(unsigned int timeout, PmLockNode *targ return 0; } -static void handle_existing_pmlock_node(bool holdkey_block, unsigned int timeout, PmLockNode *found_node) +static void handle_existing_pmlock_node(unsigned int timeout, PmLockNode *found_node) { time_t now; @@ -323,10 +322,9 @@ static void handle_existing_pmlock_node(bool holdkey_block, unsigned int timeout time(&now); found_node->time = now; - found_node->holdkey_block = holdkey_block; } -PmLockNode *display_lock_add_pmlock_node(enum state_t s_index, pid_t pid, bool holdkey_block, unsigned int timeout) +PmLockNode *display_lock_add_pmlock_node(enum state_t s_index, pid_t pid, unsigned int timeout) { PmLockNode *n; PmLockNode *found_node; @@ -336,7 +334,7 @@ PmLockNode *display_lock_add_pmlock_node(enum state_t s_index, pid_t pid, bool h found_node = find_node(s_index, pid); if (found_node) { - handle_existing_pmlock_node(holdkey_block, timeout, found_node); + handle_existing_pmlock_node(timeout, found_node); return found_node; } @@ -351,7 +349,6 @@ PmLockNode *display_lock_add_pmlock_node(enum state_t s_index, pid_t pid, bool h n->pid = pid; add_delete_state_cond_callback(timeout, n); n->time = now; - n->holdkey_block = holdkey_block; /* LCDOFF lock should be maintained regardless of fg/bg state */ if (n->state == S_NORMAL || n->state == S_LCDDIM) { n->app_background = is_app_background(n->pid); @@ -408,7 +405,6 @@ int check_lock_condition(enum state_t state) const char *state_name = NULL; display_plugin_state_get_name(state, &state_name); - _D("check holdkey block : state of %s", state_name); SYS_G_LIST_FOREACH(cond_head[state], elem, t) { if (t->pid != owner && t->app_background == false) { @@ -421,32 +417,6 @@ int check_lock_condition(enum state_t state) return ret; } -int check_holdkey_block(enum state_t state) -{ - GList *elem; - PmLockNode *t = NULL; - int ret = 0; - const char *state_name = NULL; - - display_plugin_state_get_name(state, &state_name); - _I("Check holdkey block: state of %s", state_name); - - if (custom_holdkey_block == true) { - _I("Custom hold key blocked"); - return 1; - } - - SYS_G_LIST_FOREACH(cond_head[state], elem, t) { - if (t->holdkey_block == true) { - ret = 1; - _I("Hold key blocked by pid(%d).", t->pid); - break; - } - } - - return ret; -} - int delete_condition(enum state_t state) { GList *elem, *next; @@ -630,18 +600,3 @@ int display_app_terminated(void *data) return 0; } - -int display_lock_set_custom_holdkey_block(bool blocked) -{ - custom_holdkey_block = blocked; - return 0; -} - -int display_lock_get_custom_holdkey_block(bool *blocked) -{ - if (!blocked) - return -EINVAL; - - *blocked = custom_holdkey_block; - return 0; -} \ No newline at end of file diff --git a/src/display/display-lock.h b/src/display/display-lock.h index abf2b9f..9cc2531 100644 --- a/src/display/display-lock.h +++ b/src/display/display-lock.h @@ -35,7 +35,6 @@ typedef struct _pm_lock_node { guint warning_id; GVariant *warning_param; time_t time; - bool holdkey_block; bool app_background; bool broadcast_warning; } PmLockNode; @@ -44,10 +43,9 @@ bool check_lock_state(int state); bool pmlock_get_lock_state(enum state_t state); enum state_t power_lock_type_to_pmlock(power_lock_e power_lock_type); PmLockNode *find_node(enum state_t s_index, pid_t pid); -PmLockNode *display_lock_add_pmlock_node(enum state_t s_index, pid_t pid, bool holdkey_block, unsigned int timeout); +PmLockNode *display_lock_add_pmlock_node(enum state_t s_index, pid_t pid, unsigned int timeout); int del_node(enum state_t s_index, PmLockNode *n); int check_lock_condition(enum state_t state); -int check_holdkey_block(enum state_t state); int delete_condition(enum state_t state); void print_node(int next); void makeup_trans_condition(void); @@ -58,7 +56,4 @@ int display_app_background(void *data); int display_app_foreground(void *data); int display_app_terminated(void *data); -int display_lock_set_custom_holdkey_block(bool blocked); -int display_lock_get_custom_holdkey_block(bool *blocked); - #endif /* __DISPLAY_LOCK_H__ */ diff --git a/src/display/plugin-common/display-dbus.c b/src/display/plugin-common/display-dbus.c index 24eb2ff..9cf4cd5 100644 --- a/src/display/plugin-common/display-dbus.c +++ b/src/display/plugin-common/display-dbus.c @@ -169,9 +169,6 @@ static GVariant *dbus_lockstate(GDBusConnection *conn, flag = STAY_CUR_STATE; } - if (!strcmp(option2_str, HOLDKEYBLOCK_STR)) - flag |= HOLD_KEY_BLOCK; - if (flag & GOTO_STATE_NOW) { caps = display_get_caps(DISPLAY_ACTOR_API); @@ -720,11 +717,11 @@ static GVariant *dbus_setlcdtimeout(GDBusConnection *conn, const gchar *sender, const gchar *path, const gchar *iface, const gchar *name, GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data) { - int on, dim, holdkey_block, ret; + int on, dim, dummy, ret; // dummy: holdkeyblock, unused pid_t pid; int id = 0; - g_variant_get(param, "(iii)", &on, &dim, &holdkey_block); + g_variant_get(param, "(iii)", &on, &dim, &dummy); pid = gdbus_connection_get_sender_pid(conn, sender); if (pid == -1 || kill(pid, 0) == -1) { @@ -733,7 +730,7 @@ static GVariant *dbus_setlcdtimeout(GDBusConnection *conn, goto error; } - ret = set_lcd_timeout(on, dim, holdkey_block, sender); + ret = set_lcd_timeout(on, dim, sender); if (ret) { _W("fail to set lcd timeout %d by %d", ret, pid); } else { @@ -742,8 +739,8 @@ static GVariant *dbus_setlcdtimeout(GDBusConnection *conn, _E("failed to watch name %s, id %d", sender, id); //todo: set return value } - _I("set lcd timeout on %d, dim %d, holdblock %d by %d", - on, dim, holdkey_block, pid); + _I("set lcd timeout on %d, dim %d, by %d", + on, dim, pid); } error: diff --git a/src/display/plugin-common/poll.c b/src/display/plugin-common/poll.c index d9f1d1d..ffc2806 100644 --- a/src/display/plugin-common/poll.c +++ b/src/display/plugin-common/poll.c @@ -84,9 +84,6 @@ static int __pm_lock_internal(pid_t pid, int s_bits, int flag, int timeout) /* if the flag is true, go to the locking state directly */ cond = SET_COND_FLAG(cond, PM_REQUEST_CHANGE); - if (flag & HOLD_KEY_BLOCK) - cond = SET_COND_FLAG(cond, PM_FLAG_BLOCK_HOLDKEY); - recv_data.pid = pid; recv_data.cond = cond; recv_data.timeout = timeout; diff --git a/src/display/poll.h b/src/display/poll.h index bd79b92..086f875 100644 --- a/src/display/poll.h +++ b/src/display/poll.h @@ -78,7 +78,6 @@ enum { #define STAY_CUR_STATE 0x1 #define GOTO_STATE_NOW 0x2 -#define HOLD_KEY_BLOCK 0x4 #define PM_SLEEP_MARGIN 0x0 /**< keep guard time for unlock */ #define PM_RESET_TIMER 0x1 /**< reset timer for unlock */ @@ -99,7 +98,6 @@ enum cond_request_e { }; enum cond_flags_e { - PM_FLAG_BLOCK_HOLDKEY = 1 << 0, PM_FLAG_RESET_TIMER = 1 << 1, PM_FLAG_KEEP_TIMER = 1 << 2, }; @@ -130,7 +128,6 @@ enum cond_flags_e { #define STAYCURSTATE_STR "staycurstate" #define GOTOSTATENOW_STR "gotostatenow" -#define HOLDKEYBLOCK_STR "holdkeyblock" #define STANDBYMODE_STR "standbymode" #define SLEEP_MARGIN_STR "sleepmargin" diff --git a/src/libdeviced/display.c b/src/libdeviced/display.c index b41d816..484e338 100644 --- a/src/libdeviced/display.c +++ b/src/libdeviced/display.c @@ -29,8 +29,6 @@ #define DISPLAY_MAX_BRIGHTNESS 100 #define DISPLAY_MIN_BRIGHTNESS 1 -#define HOLDKEY_BLOCK_BIT 0x1 - #define METHOD_SET_REFRESH_RATE "SetRefreshRate" #define METHOD_LOCK_STATE "lockstate" #define METHOD_UNLOCK_STATE "unlockstate" @@ -52,7 +50,6 @@ #define STR_STAYCURSTATE "staycurstate" #define STR_GOTOSTATENOW "gotostatenow" -#define STR_HOLDKEYBLOCK "holdkeyblock" #define STR_NULL "NULL" #define STR_SLEEP_MARGIN "sleepmargin" @@ -188,11 +185,7 @@ API int display_lock_state(unsigned int s_bits, unsigned int flag, p = STR_STAYCURSTATE; pa[1] = p; - if (flag & HOLD_KEY_BLOCK) - p = STR_HOLDKEYBLOCK; - else - p = STR_NULL; - pa[2] = p; + pa[2] = STR_NULL; ret = gdbus_call_async_with_reply(DEVICED_BUS_NAME, DEVICED_PATH_DISPLAY, -- 2.7.4