Fix wearable_mode() related code according to profile 88/225988/6
authorYoungjae Cho <y0.cho@samsung.com>
Wed, 26 Feb 2020 04:45:44 +0000 (13:45 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Wed, 26 Feb 2020 06:54:22 +0000 (06:54 +0000)
Leave one of 'if' or 'else' statement related to wearable_mode()
according to profile.

Change-Id: I378ce12d334444dcfc4643dafb256eca4abc16cb
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
plugins/iot/display/key-filter.c
plugins/mobile/display/key-filter.c
plugins/tv/display/key-filter.c
plugins/wearable/display/key-filter.c
src/shared/common.h

index 71ee649..5e77658 100644 (file)
@@ -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;
index 0da1315..ca7930f 100644 (file)
@@ -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;
index d67d3a6..90c0f05 100644 (file)
@@ -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;
index 920674d..891dadb 100644 (file)
@@ -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);
index f505204..5a3ef23 100644 (file)
 extern "C" {
 #endif
 
-#ifdef MICRO_DD
-#define wearable_mode()        1
-#else
-#define wearable_mode()        0
-#endif
-
 #ifndef API
 #define API __attribute__ ((visibility("default")))
 #endif