From: Youngjae Cho Date: Wed, 26 Feb 2020 04:45:44 +0000 (+0900) Subject: Fix wearable_mode() related code according to profile X-Git-Tag: submit/tizen/20200228.005656~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F88%2F225988%2F6;p=platform%2Fcore%2Fsystem%2Fdeviced.git Fix wearable_mode() related code according to profile Leave one of 'if' or 'else' statement related to wearable_mode() according to profile. Change-Id: I378ce12d334444dcfc4643dafb256eca4abc16cb Signed-off-by: Youngjae Cho --- diff --git a/plugins/iot/display/key-filter.c b/plugins/iot/display/key-filter.c index 71ee649..5e77658 100644 --- a/plugins/iot/display/key-filter.c +++ b/plugins/iot/display/key-filter.c @@ -409,37 +409,6 @@ static int lcdoff_powerkey(void) return ignore; } -static bool key_check_display_on(void) -{ - if (current_state_in_on()) - return false; - - if (backlight_ops.get_lcd_power() == DPMS_ON) { - _W("display power was on"); - return false; - } - - return true; -} - -static gboolean display_on_cb(void *data) -{ - if (displayon_by_powerkey_timeout_id == 0) - return G_SOURCE_REMOVE; - - displayon_by_powerkey_timeout_id = 0; - if (backlight_ops.get_lcd_power() != DPMS_ON || - current_state_in_on() == false) { - broadcast_lcdon_by_powerkey(); - lcd_on_direct(LCD_ON_BY_POWER_KEY); - - if (pm_callback) - (*pm_callback) (INPUT_POLL_EVENT, NULL); - } - - return G_SOURCE_REMOVE; -} - static int process_back_key(struct input_event *pinput) { int ignore = true; @@ -489,24 +458,7 @@ static int process_power_key(struct input_event *pinput) break; case KEY_PRESSED: if (display_has_caps(caps, DISPLAY_CAPA_LCDON)) { - if (wearable_mode()) - skip_lcd_off = switch_on_lcd(LCD_ON_BY_POWER_KEY); - else { - /* - * LCD does not turn on immediately at mobile. - * It will be turned on after 0.1 second because of torch concept. - */ - skip_lcd_off = key_check_display_on(); - ignore = true; - - if (!displayon_by_powerkey_timeout_id && - backlight_ops.get_lcd_power() != DPMS_ON && - key_combination != COMBINATION_TORCH) { - displayon_by_powerkey_timeout_id = g_timeout_add( - 100, - display_on_cb, NULL); - } - } + skip_lcd_off = switch_on_lcd(LCD_ON_BY_POWER_KEY); } else { _D("No lcdon capability!"); skip_lcd_off = false; @@ -581,12 +533,10 @@ static void process_hardkey_backlight(struct input_event *pinput) _E("pinput->value : %d", pinput->value); if (pinput->value == KEY_PRESSED) { - if (!wearable_mode()) { /* Sound & Vibrate only in unlock state */ if (__get_lock_screen_state() == VCONFKEY_IDLE_UNLOCK || get_lock_screen_bg_state()) sound_vibrate_hardkey(); - } if (touchled && touchled->execute) { opt = TOUCHLED_PRESS; diff --git a/plugins/mobile/display/key-filter.c b/plugins/mobile/display/key-filter.c index 0da1315..ca7930f 100644 --- a/plugins/mobile/display/key-filter.c +++ b/plugins/mobile/display/key-filter.c @@ -478,23 +478,19 @@ static int process_power_key(struct input_event *pinput) break; case KEY_PRESSED: if (display_has_caps(caps, DISPLAY_CAPA_LCDON)) { - if (wearable_mode()) - skip_lcd_off = switch_on_lcd(LCD_ON_BY_POWER_KEY); - else { - /* - * LCD does not turn on immediately at mobile. - * It will be turned on after 0.1 second because of torch concept. - */ - skip_lcd_off = key_check_display_on(); - ignore = true; - - if (!displayon_by_powerkey_timeout_id && - backlight_ops.get_lcd_power() != DPMS_ON && - key_combination != COMBINATION_TORCH) { - displayon_by_powerkey_timeout_id = g_timeout_add( - 100, - display_on_cb, NULL); - } + /* + * LCD does not turn on immediately at mobile. + * It will be turned on after 0.1 second because of torch concept. + */ + skip_lcd_off = key_check_display_on(); + ignore = true; + + if (!displayon_by_powerkey_timeout_id && + backlight_ops.get_lcd_power() != DPMS_ON && + key_combination != COMBINATION_TORCH) { + displayon_by_powerkey_timeout_id = g_timeout_add( + 100, + display_on_cb, NULL); } } else { _D("No lcdon capability!"); @@ -570,12 +566,10 @@ static void process_hardkey_backlight(struct input_event *pinput) _E("pinput->value : %d", pinput->value); if (pinput->value == KEY_PRESSED) { - if (!wearable_mode()) { /* Sound & Vibrate only in unlock state */ if (__get_lock_screen_state() == VCONFKEY_IDLE_UNLOCK || get_lock_screen_bg_state()) sound_vibrate_hardkey(); - } if (touchled && touchled->execute) { opt = TOUCHLED_PRESS; diff --git a/plugins/tv/display/key-filter.c b/plugins/tv/display/key-filter.c index d67d3a6..90c0f05 100644 --- a/plugins/tv/display/key-filter.c +++ b/plugins/tv/display/key-filter.c @@ -409,37 +409,6 @@ static int lcdoff_powerkey(void) return ignore; } -static bool key_check_display_on(void) -{ - if (current_state_in_on()) - return false; - - if (backlight_ops.get_lcd_power() == DPMS_ON) { - _W("display power was on"); - return false; - } - - return true; -} - -static gboolean display_on_cb(void *data) -{ - if (displayon_by_powerkey_timeout_id == 0) - return G_SOURCE_REMOVE; - - displayon_by_powerkey_timeout_id = 0; - if (backlight_ops.get_lcd_power() != DPMS_ON || - current_state_in_on() == false) { - broadcast_lcdon_by_powerkey(); - lcd_on_direct(LCD_ON_BY_POWER_KEY); - - if (pm_callback) - (*pm_callback) (INPUT_POLL_EVENT, NULL); - } - - return G_SOURCE_REMOVE; -} - static int process_back_key(struct input_event *pinput) { int ignore = true; @@ -489,24 +458,7 @@ static int process_power_key(struct input_event *pinput) break; case KEY_PRESSED: if (display_has_caps(caps, DISPLAY_CAPA_LCDON)) { - if (wearable_mode()) - skip_lcd_off = switch_on_lcd(LCD_ON_BY_POWER_KEY); - else { - /* - * LCD does not turn on immediately at mobile. - * It will be turned on after 0.1 second because of torch concept. - */ - skip_lcd_off = key_check_display_on(); - ignore = true; - - if (!displayon_by_powerkey_timeout_id && - backlight_ops.get_lcd_power() != DPMS_ON && - key_combination != COMBINATION_TORCH) { - displayon_by_powerkey_timeout_id = g_timeout_add( - 100, - display_on_cb, NULL); - } - } + skip_lcd_off = switch_on_lcd(LCD_ON_BY_POWER_KEY); } else { _D("No lcdon capability!"); skip_lcd_off = false; @@ -581,12 +533,10 @@ static void process_hardkey_backlight(struct input_event *pinput) _E("pinput->value : %d", pinput->value); if (pinput->value == KEY_PRESSED) { - if (!wearable_mode()) { /* Sound & Vibrate only in unlock state */ if (__get_lock_screen_state() == VCONFKEY_IDLE_UNLOCK || get_lock_screen_bg_state()) sound_vibrate_hardkey(); - } if (touchled && touchled->execute) { opt = TOUCHLED_PRESS; diff --git a/plugins/wearable/display/key-filter.c b/plugins/wearable/display/key-filter.c index 920674d..891dadb 100644 --- a/plugins/wearable/display/key-filter.c +++ b/plugins/wearable/display/key-filter.c @@ -398,37 +398,6 @@ static int lcdoff_powerkey(void) return ignore; } -static bool key_check_display_on(void) -{ - if (current_state_in_on()) - return false; - - if (backlight_ops.get_lcd_power() == DPMS_ON) { - _W("display power was on"); - return false; - } - - return true; -} - -static gboolean display_on_cb(void *data) -{ - if (displayon_by_powerkey_timeout_id == 0) - return G_SOURCE_REMOVE; - - displayon_by_powerkey_timeout_id = 0; - if (backlight_ops.get_lcd_power() != DPMS_ON || - current_state_in_on() == false) { - broadcast_lcdon_by_powerkey(); - lcd_on_direct(LCD_ON_BY_POWER_KEY); - - if (pm_callback) - (*pm_callback) (INPUT_POLL_EVENT, NULL); - } - - return G_SOURCE_REMOVE; -} - static int process_back_key(struct input_event *pinput) { int ignore = true; @@ -478,24 +447,7 @@ static int process_power_key(struct input_event *pinput) break; case KEY_PRESSED: if (display_has_caps(caps, DISPLAY_CAPA_LCDON)) { - if (wearable_mode()) - skip_lcd_off = switch_on_lcd(LCD_ON_BY_POWER_KEY); - else { - /* - * LCD does not turn on immediately at mobile. - * It will be turned on after 0.1 second because of torch concept. - */ - skip_lcd_off = key_check_display_on(); - ignore = true; - - if (!displayon_by_powerkey_timeout_id && - backlight_ops.get_lcd_power() != DPMS_ON && - key_combination != COMBINATION_TORCH) { - displayon_by_powerkey_timeout_id = g_timeout_add( - 100, - display_on_cb, NULL); - } - } + skip_lcd_off = switch_on_lcd(LCD_ON_BY_POWER_KEY); } else { _D("No lcdon capability!"); skip_lcd_off = false; @@ -552,31 +504,12 @@ static int process_screenlock_key(struct input_event *pinput) return true; } -static void sound_vibrate_hardkey(void) -{ - /* device notify(vibrator) */ - /* sound(dbus) */ - /* Need to notify to deviced-vibrator. deviced-vibrator receives ChangedHardKey signal */ - dbus_handle_emit_dbus_signal(NULL, - DEVICED_PATH_KEY, - DEVICED_INTERFACE_KEY, - SIGNAL_CHANGE_HARDKEY, - NULL); -} - static void process_hardkey_backlight(struct input_event *pinput) { int opt; _E("pinput->value : %d", pinput->value); if (pinput->value == KEY_PRESSED) { - if (!wearable_mode()) { - /* Sound & Vibrate only in unlock state */ - if (__get_lock_screen_state() == VCONFKEY_IDLE_UNLOCK - || get_lock_screen_bg_state()) - sound_vibrate_hardkey(); - } - if (touchled && touchled->execute) { opt = TOUCHLED_PRESS; touchled->execute(&opt); diff --git a/src/shared/common.h b/src/shared/common.h index f505204..5a3ef23 100644 --- a/src/shared/common.h +++ b/src/shared/common.h @@ -26,12 +26,6 @@ extern "C" { #endif -#ifdef MICRO_DD -#define wearable_mode() 1 -#else -#define wearable_mode() 0 -#endif - #ifndef API #define API __attribute__ ((visibility("default"))) #endif