From 5ea7e1f6b1d76522c9beb34065512e17b25e068a Mon Sep 17 00:00:00 2001 From: lokilee73 Date: Tue, 30 Jul 2019 16:17:48 +0900 Subject: [PATCH] Remove power off popup from power off type Change-Id: I16ed1f64ba7a26340975796071f1736bd6470ba9 Signed-off-by: lokilee73 --- plugins/iot/display/core.c | 1 - plugins/iot/display/key-filter.c | 19 +++++++++++-------- plugins/mobile/display/core.c | 1 - plugins/mobile/display/key-filter.c | 19 +++++++++++-------- plugins/tv/display/core.c | 1 - plugins/tv/display/key-filter.c | 19 +++++++++++-------- plugins/wearable/display/core.c | 1 - plugins/wearable/display/key-filter.c | 19 +++++++++++-------- src/power/power-handler.c | 13 ------------- src/power/power-handler.h | 1 - 10 files changed, 44 insertions(+), 50 deletions(-) diff --git a/plugins/iot/display/core.c b/plugins/iot/display/core.c index 42ef795..b9d7d14 100644 --- a/plugins/iot/display/core.c +++ b/plugins/iot/display/core.c @@ -1849,7 +1849,6 @@ static int update_setting(int key_idx, int val) case SETTING_POWEROFF: switch (val) { case POWEROFF_TYPE_NONE: - case POWEROFF_TYPE_POPUP: pm_status_flag &= ~PWROFF_FLAG; break; case POWEROFF_TYPE_DIRECT: diff --git a/plugins/iot/display/key-filter.c b/plugins/iot/display/key-filter.c index 6ef373c..0baf72a 100644 --- a/plugins/iot/display/key-filter.c +++ b/plugins/iot/display/key-filter.c @@ -38,6 +38,7 @@ #include "core/device-notifier.h" #include "power/power-handler.h" #include "led/touch-key.h" +#include "apps/apps.h" #include #ifndef KEY_SCREENLOCK @@ -49,7 +50,6 @@ #define PREDEF_LEAVESLEEP "leavesleep" #define POWEROFF_ACT "poweroff" -#define PWROFF_POPUP_ACT "pwroff-popup" #define USEC_PER_SEC 1000000 #define CAPTURE_COMBINATION_INTERVAL 0.5 /* 0.5 second */ @@ -118,18 +118,22 @@ static inline void restore_custom_brightness(void) backlight_ops.custom_update(); } -static int power_execute(void *data) +static void pwroff_popup(void) { - static const struct device_ops *ops = NULL; + int ret; - FIND_DEVICE_INT(ops, POWER_OPS_NAME); + ret = vconf_set_int(VCONFKEY_SYSMAN_POWER_OFF_STATUS, VCONFKEY_SYSMAN_POWER_OFF_POPUP); + if (ret < 0) + _E("Failed to set vconf value for power off status: %d", vconf_get_ext_errno()); - return ops->execute(data); + pm_status_flag &= ~PWROFF_FLAG; + ret = launch_system_app(APP_POWERKEY, 2, APP_KEY_TYPE, APP_POWERKEY); + if (ret < 0) + _E("Failed to launch power off popup."); } static void longkey_pressed() { - char *opt; unsigned int caps; _I("Power key long pressed!"); @@ -149,8 +153,7 @@ static void longkey_pressed() return; } - opt = POWEROFF_ACT; - power_execute(opt); + pwroff_popup(); } static gboolean longkey_pressed_cb(void *data) diff --git a/plugins/mobile/display/core.c b/plugins/mobile/display/core.c index d38d9ac..f252e4e 100644 --- a/plugins/mobile/display/core.c +++ b/plugins/mobile/display/core.c @@ -1850,7 +1850,6 @@ static int update_setting(int key_idx, int val) case SETTING_POWEROFF: switch (val) { case POWEROFF_TYPE_NONE: - case POWEROFF_TYPE_POPUP: pm_status_flag &= ~PWROFF_FLAG; break; case POWEROFF_TYPE_DIRECT: diff --git a/plugins/mobile/display/key-filter.c b/plugins/mobile/display/key-filter.c index 6789e71..7f060d0 100644 --- a/plugins/mobile/display/key-filter.c +++ b/plugins/mobile/display/key-filter.c @@ -38,6 +38,7 @@ #include "core/device-notifier.h" #include "power/power-handler.h" #include "led/touch-key.h" +#include "apps/apps.h" #include #ifndef KEY_SCREENLOCK @@ -49,7 +50,6 @@ #define PREDEF_LEAVESLEEP "leavesleep" #define POWEROFF_ACT "poweroff" -#define PWROFF_POPUP_ACT "pwroff-popup" #define USEC_PER_SEC 1000000 #define CAPTURE_COMBINATION_INTERVAL 0.5 /* 0.5 second */ @@ -118,18 +118,22 @@ static inline void restore_custom_brightness(void) backlight_ops.custom_update(); } -static int power_execute(void *data) +static void pwroff_popup(void) { - static const struct device_ops *ops = NULL; + int ret; - FIND_DEVICE_INT(ops, POWER_OPS_NAME); + ret = vconf_set_int(VCONFKEY_SYSMAN_POWER_OFF_STATUS, VCONFKEY_SYSMAN_POWER_OFF_POPUP); + if (ret < 0) + _E("Failed to set vconf value for power off status: %d", vconf_get_ext_errno()); - return ops->execute(data); + pm_status_flag &= ~PWROFF_FLAG; + ret = launch_system_app(APP_POWERKEY, 2, APP_KEY_TYPE, APP_POWERKEY); + if (ret < 0) + _E("Failed to launch power off popup."); } static void longkey_pressed() { - char *opt; unsigned int caps; _I("Power key long pressed!"); @@ -149,8 +153,7 @@ static void longkey_pressed() return; } - opt = PWROFF_POPUP_ACT; - power_execute(opt); + pwroff_popup(); } static gboolean longkey_pressed_cb(void *data) diff --git a/plugins/tv/display/core.c b/plugins/tv/display/core.c index 7529349..5f07dde 100644 --- a/plugins/tv/display/core.c +++ b/plugins/tv/display/core.c @@ -1851,7 +1851,6 @@ static int update_setting(int key_idx, int val) case SETTING_POWEROFF: switch (val) { case POWEROFF_TYPE_NONE: - case POWEROFF_TYPE_POPUP: pm_status_flag &= ~PWROFF_FLAG; break; case POWEROFF_TYPE_DIRECT: diff --git a/plugins/tv/display/key-filter.c b/plugins/tv/display/key-filter.c index 6ef373c..0baf72a 100644 --- a/plugins/tv/display/key-filter.c +++ b/plugins/tv/display/key-filter.c @@ -38,6 +38,7 @@ #include "core/device-notifier.h" #include "power/power-handler.h" #include "led/touch-key.h" +#include "apps/apps.h" #include #ifndef KEY_SCREENLOCK @@ -49,7 +50,6 @@ #define PREDEF_LEAVESLEEP "leavesleep" #define POWEROFF_ACT "poweroff" -#define PWROFF_POPUP_ACT "pwroff-popup" #define USEC_PER_SEC 1000000 #define CAPTURE_COMBINATION_INTERVAL 0.5 /* 0.5 second */ @@ -118,18 +118,22 @@ static inline void restore_custom_brightness(void) backlight_ops.custom_update(); } -static int power_execute(void *data) +static void pwroff_popup(void) { - static const struct device_ops *ops = NULL; + int ret; - FIND_DEVICE_INT(ops, POWER_OPS_NAME); + ret = vconf_set_int(VCONFKEY_SYSMAN_POWER_OFF_STATUS, VCONFKEY_SYSMAN_POWER_OFF_POPUP); + if (ret < 0) + _E("Failed to set vconf value for power off status: %d", vconf_get_ext_errno()); - return ops->execute(data); + pm_status_flag &= ~PWROFF_FLAG; + ret = launch_system_app(APP_POWERKEY, 2, APP_KEY_TYPE, APP_POWERKEY); + if (ret < 0) + _E("Failed to launch power off popup."); } static void longkey_pressed() { - char *opt; unsigned int caps; _I("Power key long pressed!"); @@ -149,8 +153,7 @@ static void longkey_pressed() return; } - opt = POWEROFF_ACT; - power_execute(opt); + pwroff_popup(); } static gboolean longkey_pressed_cb(void *data) diff --git a/plugins/wearable/display/core.c b/plugins/wearable/display/core.c index bf6ff62..d5e35f9 100644 --- a/plugins/wearable/display/core.c +++ b/plugins/wearable/display/core.c @@ -1850,7 +1850,6 @@ static int update_setting(int key_idx, int val) case SETTING_POWEROFF: switch (val) { case POWEROFF_TYPE_NONE: - case POWEROFF_TYPE_POPUP: pm_status_flag &= ~PWROFF_FLAG; break; case POWEROFF_TYPE_DIRECT: diff --git a/plugins/wearable/display/key-filter.c b/plugins/wearable/display/key-filter.c index a6cb3fc..d66fa9d 100644 --- a/plugins/wearable/display/key-filter.c +++ b/plugins/wearable/display/key-filter.c @@ -38,6 +38,7 @@ #include "core/device-notifier.h" #include "power/power-handler.h" #include "led/touch-key.h" +#include "apps/apps.h" #include #ifndef KEY_SCREENLOCK @@ -49,7 +50,6 @@ #define PREDEF_LEAVESLEEP "leavesleep" #define POWEROFF_ACT "poweroff" -#define PWROFF_POPUP_ACT "pwroff-popup" #define USEC_PER_SEC 1000000 #define CAPTURE_COMBINATION_INTERVAL 0.5 /* 0.5 second */ @@ -129,18 +129,22 @@ static inline void restore_custom_brightness(void) backlight_ops.custom_update(); } -static int power_execute(void *data) +static void pwroff_popup(void) { - static const struct device_ops *ops = NULL; + int ret; - FIND_DEVICE_INT(ops, POWER_OPS_NAME); + ret = vconf_set_int(VCONFKEY_SYSMAN_POWER_OFF_STATUS, VCONFKEY_SYSMAN_POWER_OFF_POPUP); + if (ret < 0) + _E("Failed to set vconf value for power off status: %d", vconf_get_ext_errno()); - return ops->execute(data); + pm_status_flag &= ~PWROFF_FLAG; + ret = launch_system_app(APP_POWERKEY, 2, APP_KEY_TYPE, APP_POWERKEY); + if (ret < 0) + _E("Failed to launch power off popup."); } static void longkey_pressed() { - char *opt; unsigned int caps; _I("Power key long pressed!"); @@ -160,8 +164,7 @@ static void longkey_pressed() return; } - opt = PWROFF_POPUP_ACT; - power_execute(opt); + pwroff_popup(); } static gboolean longkey_restore_cb(void *data) diff --git a/src/power/power-handler.c b/src/power/power-handler.c index 222eeeb..41aac63 100644 --- a/src/power/power-handler.c +++ b/src/power/power-handler.c @@ -77,7 +77,6 @@ static const char *poweroff_type_flagpaths[] = { // index denotes type static const char *poweroff_type_names[] = { // index denotes type [POWEROFF_TYPE_POWEROFF] = POWER_POWEROFF, - [POWEROFF_TYPE_POPUP] = POWER_OFF_POPUP, [POWEROFF_TYPE_REBOOT] = POWER_REBOOT, [POWEROFF_TYPE_EXIT] = POWER_EXIT, }; @@ -414,11 +413,6 @@ static void system_shutdown_send_system_event(void) bundle_free(b); } -static int pwroff_popup(void) -{ - return launch_system_app(APP_POWERKEY, 2, APP_KEY_TYPE, APP_POWERKEY); -} - static int poweroff_option_valid(enum poweroff_type type_e, const char *option) { dd_list *l; @@ -493,12 +487,6 @@ static int power_execute_pid(const char *typename, const char *option) if (ret < 0) _E("Failed to set vconf value for power off status: %d", vconf_get_ext_errno()); - if (poweroff_opt.type == POWEROFF_TYPE_POPUP) { - _D("Request popup."); - pwroff_popup(); - return 0; - } - during_poweroff = true; /* Poweroff event broadcasting */ @@ -756,7 +744,6 @@ static void power_init(void *data) add_poweroff_option(POWEROFF_TYPE_POWEROFF, NULL); add_poweroff_option(POWEROFF_TYPE_RESTART, NULL); - add_poweroff_option(POWEROFF_TYPE_POPUP, NULL); add_poweroff_option(POWEROFF_TYPE_EXIT, NULL); ret = config_parse(POWER_CONF_FILE, load_config, NULL); diff --git a/src/power/power-handler.h b/src/power/power-handler.h index 5ef317d..608a9a2 100644 --- a/src/power/power-handler.h +++ b/src/power/power-handler.h @@ -33,7 +33,6 @@ enum poweroff_type { POWEROFF_TYPE_INVALID = 0, POWEROFF_TYPE_NONE = POWEROFF_TYPE_INVALID, // compat only - POWEROFF_TYPE_POPUP, POWEROFF_TYPE_POWEROFF, /* replaces POWEROFF_TYPE_DIRECT */ POWEROFF_TYPE_DIRECT = POWEROFF_TYPE_POWEROFF, // compat only POWEROFF_TYPE_REBOOT, -- 2.7.4