From 57f7cd50709941a53223eebe814914c89868b01c Mon Sep 17 00:00:00 2001 From: "Geunsun, Lee" Date: Wed, 28 Sep 2016 15:05:38 +0900 Subject: [PATCH] Send home key event using app control to wearable homescreen Change-Id: Iaa606931563a486292520181a8f256ae6a8e885a --- include/wearable/home_mgr.h | 2 +- src/wearable/home_mgr.c | 4 ++-- src/wearable/hw_key.c | 11 ++++++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/wearable/home_mgr.h b/include/wearable/home_mgr.h index d01a8ea..25a4c73 100644 --- a/include/wearable/home_mgr.h +++ b/include/wearable/home_mgr.h @@ -19,7 +19,7 @@ extern void home_mgr_launch_home(void); extern void home_mgr_launch_home_first(void); -extern void home_mgr_launch_home_by_power(void); +extern void home_mgr_launch_home_by_power(const char *val); extern void home_mgr_init(void); extern void home_mgr_fini(void); diff --git a/src/wearable/home_mgr.c b/src/wearable/home_mgr.c index 906f678..e5dc125 100644 --- a/src/wearable/home_mgr.c +++ b/src/wearable/home_mgr.c @@ -60,9 +60,9 @@ void home_mgr_launch_home_first(void) -void home_mgr_launch_home_by_power(void) +void home_mgr_launch_home_by_power(const char *val) { - process_mgr_must_launch(s_home_mgr.home_appid, "home_op", "powerkey", NULL, _after_launch_home); + process_mgr_must_launch(s_home_mgr.home_appid, "home_op", val, NULL, _after_launch_home); } diff --git a/src/wearable/hw_key.c b/src/wearable/hw_key.c index d76ee58..9c11c20 100644 --- a/src/wearable/hw_key.c +++ b/src/wearable/hw_key.c @@ -387,6 +387,7 @@ void hw_key_destroy_window(void) #include #include #include +#include #include "hw_key.h" #include "util.h" @@ -460,6 +461,7 @@ static struct { Eina_Bool is_long_press; int powerkey_count; Eina_Bool is_cancel; + Eina_Bool is_home_focused; } key_info = { .key_up = NULL, .key_down = NULL, @@ -475,6 +477,7 @@ static struct { .is_long_press = EINA_FALSE, .powerkey_count = 0, .is_cancel = EINA_FALSE, + .is_home_focused = EINA_FALSE, }; @@ -590,7 +593,7 @@ static Eina_Bool _powerkey_timer_cb(void *data) return ECORE_CALLBACK_CANCEL; } - home_mgr_launch_home_by_power(); + home_mgr_launch_home_by_power((key_info.is_home_focused == EINA_TRUE) ? "powerkey_focused" : "powerkey_unfocused"); return ECORE_CALLBACK_CANCEL; } @@ -666,6 +669,8 @@ static Eina_Bool _key_press_cb(void *data, int type, void *event) _D("_key_press_cb : %s Pressed", ev->keyname); if (!strcmp(ev->keyname, key_name[KEY_POWER])) { + int status = 0; + _W("POWER Key is pressed"); /** @@ -699,6 +704,10 @@ static Eina_Bool _key_press_cb(void *data, int type, void *event) if(!key_info.power_long_press_timer) { _E("Failed to add power_long_press_timer"); } + + status = aul_app_get_status("org.tizen.w-home"); + key_info.is_home_focused = (status == STATUS_FOCUS) ? EINA_TRUE : EINA_FALSE; + _D("home focus status : %d", key_info.is_home_focused); } else if (!strcmp(ev->keyname, key_name[KEY_CANCEL])) { _D("CANCEL key is pressed"); key_info.is_cancel = EINA_TRUE; -- 2.7.4