[Wearable] Implement double key press operation 98/83098/1 submit/tizen_wearable/20160819.015426
authorGeunsun, Lee <gs86.lee@samsung.com>
Tue, 9 Aug 2016 07:17:29 +0000 (16:17 +0900)
committerGeunsun, Lee <gs86.lee@samsung.com>
Tue, 9 Aug 2016 07:18:09 +0000 (16:18 +0900)
Change-Id: I9e070eb3470d44e5fa618c691d423fc202b20d6c

include/status.h
src/status.c
src/wearable/hw_key.c

index 52a5ac1..a02a369 100644 (file)
@@ -66,8 +66,7 @@ struct status_passive_s {
        int setappl_psmode;
        int starter_reserved_apps_status;
        int setappl_sound_lock_bool;
-       int setappl_motion_activation;
-       int setappl_use_pick_up;
+       int setappl_double_press_home_key;
 
        char *setappl_3rd_lock_pkg_name_str;
 };
index f0d145d..848dce8 100644 (file)
@@ -60,8 +60,7 @@ static struct status_passive_s s_status_passive = {
        .setappl_psmode = -1,
        .starter_reserved_apps_status = -1,
        .setappl_sound_lock_bool = -1,
-       .setappl_motion_activation = -1,
-       .setappl_use_pick_up = -1,
+       .setappl_double_press_home_key = -1,
 
        .setappl_3rd_lock_pkg_name_str = NULL,
 };
@@ -230,6 +229,8 @@ static void _status_passive_change_cb(keynode_t* node, void *data)
                s_status_passive.wms_wakeup_by_gesture_setting = vconf_keynode_get_int(node);
        } else if (!strcmp(key_name, VCONFKEY_SETAPPL_AMBIENT_MODE_BOOL)) {
                s_status_passive.setappl_ambient_mode_bool = vconf_keynode_get_int(node);
+       } else if (!strcmp(key_name, VCONFKEY_SETAPPL_DOUBLE_PRESS_HOME_KEY)) {
+               s_status_passive.setappl_double_press_home_key = vconf_keynode_get_int(node);
        } else
 #endif
        if (!strcmp(key_name, VCONFKEY_PM_KEY_IGNORE)) {
@@ -358,6 +359,13 @@ int status_register(void)
                s_status_passive.setappl_ambient_mode_bool = -1;
        }
 
+       if (vconf_notify_key_changed(VCONFKEY_SETAPPL_DOUBLE_PRESS_HOME_KEY, _status_passive_change_cb, NULL) < 0) {
+               _E("Failed to register add the callback for %s", VCONFKEY_SETAPPL_DOUBLE_PRESS_HOME_KEY);
+       } else if (vconf_get_int(VCONFKEY_SETAPPL_DOUBLE_PRESS_HOME_KEY, &s_status_passive.setappl_double_press_home_key) < 0) {
+               _E("Failed to get vconfkey[%s]", VCONFKEY_SETAPPL_DOUBLE_PRESS_HOME_KEY);
+               s_status_passive.setappl_double_press_home_key = -1;
+       }
+
 #endif
 
        if (vconf_notify_key_changed(VCONFKEY_PM_KEY_IGNORE, _status_passive_change_cb, NULL) < 0) {
@@ -416,20 +424,6 @@ int status_register(void)
                s_status_passive.setappl_sound_lock_bool = -1;
        }
 
-       if (vconf_notify_key_changed(VCONFKEY_SETAPPL_MOTION_ACTIVATION, _status_passive_change_cb, NULL) < 0) {
-               _E("Failed to regitster add the callback for %s", VCONFKEY_SETAPPL_MOTION_ACTIVATION);
-       } else if (vconf_get_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, &s_status_passive.setappl_motion_activation) < 0) {
-               _E("Failed to get vconfkey[%s]", VCONFKEY_SETAPPL_MOTION_ACTIVATION);
-               s_status_passive.setappl_motion_activation = -1;
-       }
-
-       if (vconf_notify_key_changed(VCONFKEY_SETAPPL_USE_PICK_UP, _status_passive_change_cb, NULL) < 0) {
-               _E("Failed to regitster add the callback for %s", VCONFKEY_SETAPPL_USE_PICK_UP);
-       } else if (vconf_get_bool(VCONFKEY_SETAPPL_USE_PICK_UP, &s_status_passive.setappl_use_pick_up) < 0) {
-               _E("Failed to get vconfkey[%s]", VCONFKEY_SETAPPL_USE_PICK_UP);
-               s_status_passive.setappl_use_pick_up = -1;
-       }
-
        if (vconf_notify_key_changed(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, _status_passive_change_cb, NULL) < 0) {
                _E("Failed to register add the callback for %s", VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR);
        }
@@ -505,6 +499,9 @@ void status_unregister(void)
                _E("Failed to unregister the callback for %s", VCONFKEY_SETAPPL_AMBIENT_MODE_BOOL);
        }
 
+       if (vconf_ignore_key_changed(VCONFKEY_SETAPPL_DOUBLE_PRESS_HOME_KEY, _status_passive_change_cb) < 0) {
+               _E("Failed to unregister the callback for %s", VCONFKEY_SETAPPL_DOUBLE_PRESS_HOME_KEY);
+       }
 #endif
 
        if (vconf_ignore_key_changed(VCONFKEY_PM_KEY_IGNORE, _status_passive_change_cb) < 0) {
@@ -539,10 +536,6 @@ void status_unregister(void)
                _E("Failed to unregister the callback for %s", VCONFKEY_SETAPPL_SOUND_LOCK_BOOL);
        }
 
-       if (vconf_ignore_key_changed(VCONFKEY_SETAPPL_MOTION_ACTIVATION, _status_passive_change_cb) < 0) {
-               _E("Failed to unregister the callback for %s", VCONFKEY_SETAPPL_MOTION_ACTIVATION);
-       }
-
        if (vconf_ignore_key_changed(VCONFKEY_SETAPPL_USE_PICK_UP, _status_passive_change_cb) < 0) {
                _E("Failed to unregister the callback for %s", VCONFKEY_SETAPPL_USE_PICK_UP);
        }
index c5448c6..d76ee58 100644 (file)
@@ -399,7 +399,11 @@ void hw_key_destroy_window(void)
 #define POWERKEY_LCDOFF_TIMER_SEC 0.4
 #define POWERKEY_TIMER_SEC 0.25
 
+#define APP_CONTROL_OPERATION_MAIN_KEY "__APP_SVC_OP_TYPE__"
+#define APP_CONTROL_OPERATION_MAIN_VALUE "http://tizen.org/appcontrol/operation/main"
+
 #define USE_DBUS_POWEROFF 1
+#define W_TASKMGR_PKGNAME "org.tizen.task-mgr"
 
 const char *key_name[KEY_NAME_MAX] = {
        "XF86AudioRaiseVolume",
@@ -508,6 +512,29 @@ static Eina_Bool _long_press_timer_cb(void* data)
 
 
 
+static void _do_double_home_key_operation(void)
+{
+       int op = 0;
+
+       op = status_passive_get()->setappl_double_press_home_key;
+       _D("Dobule home key operation : %d", op);
+
+       switch(op) {
+       case VCONFKEY_DOUBLE_PRESS_HOME_KEY_NONE:
+               break;
+       case VCONFKEY_DOUBLE_PRESS_HOME_KEY_LAST_APP:
+               break;
+       case VCONFKEY_DOUBLE_PRESS_HOME_KEY_RECENT_APPS:
+               process_mgr_must_launch(W_TASKMGR_PKGNAME, NULL, NULL, NULL, NULL);
+               break;
+       default:
+               _E("invalid operation(%d)", op);
+               break;
+       }
+}
+
+
+
 static Eina_Bool _powerkey_timer_cb(void *data)
 {
        _W("%s, powerkey count[%d]", __func__, key_info.powerkey_count);
@@ -530,6 +557,7 @@ static Eina_Bool _powerkey_timer_cb(void *data)
                /* double press */
                _W("powerkey double press");
                key_info.powerkey_count = 0;
+               _do_double_home_key_operation();
                return ECORE_CALLBACK_CANCEL;
        }
        key_info.powerkey_count = 0;