summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt1
-rw-r--r--include/status.h2
-rw-r--r--include/util.h6
-rw-r--r--packaging/starter.spec1
-rw-r--r--src/status.c40
-rw-r--r--src/wearable/hw_key.c105
6 files changed, 149 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 04a00d5..427877b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -135,6 +135,7 @@ pkg_check_modules(pkgs REQUIRED
dbus-glib-1
liblazymount
libsystemd-daemon
+ rua
)
ENDIF()
diff --git a/include/status.h b/include/status.h
index 2f77e51..0fb6eaa 100644
--- a/include/status.h
+++ b/include/status.h
@@ -55,6 +55,8 @@ struct status_active_s {
struct status_passive_s {
int wms_wakeup_by_gesture_setting;
+ char *wms_clocks_set_idle;
+ int homescreen_watch_face_visibility;
int setappl_ambient_mode_bool;
int pm_key_ignore;
diff --git a/include/util.h b/include/util.h
index 00a3c34..611c726 100644
--- a/include/util.h
+++ b/include/util.h
@@ -27,11 +27,15 @@
#define CLUSTER_HOME_PKG_NAME "org.tizen.cluster-home"
#define EASY_HOME_PKG_NAME "org.tizen.easy-home"
#define EASY_APPS_PKG_NAME "org.tizen.easy-apps"
+#define ISE_DEFAULT_PKG_NAME "ise-default"
#ifdef TIZEN_PROFILE_COMMON
#define HOMESCREEN_PKG_NAME MENU_SCREEN_PKG_NAME
-#else
+#elif TIZEN_PROFILE_MOBILE
#define HOMESCREEN_PKG_NAME "org.tizen.homescreen-efl"
+#elif TIZEN_PROFILE_WEARABLE
+#define IDLE_CLOCK_PKG_NAME "org.tizen.classic-watch"
+#define HOMESCREEN_PKG_NAME "org.tizen.w-home"
#endif
#define TASKMGR_PKG_NAME "org.tizen.task-mgr"
diff --git a/packaging/starter.spec b/packaging/starter.spec
index fb51bdb..a8228d4 100644
--- a/packaging/starter.spec
+++ b/packaging/starter.spec
@@ -30,6 +30,7 @@ BuildRequires: pkgconfig(efl-extension)
BuildRequires: pkgconfig(liblazymount)
BuildRequires: pkgconfig(libsystemd-daemon)
+BuildRequires: pkgconfig(rua)
BuildRequires: pkgconfig(feedback)
BuildRequires: pkgconfig(db-util)
BuildRequires: pkgconfig(dlog)
diff --git a/src/status.c b/src/status.c
index ad2d61f..e0a6436 100644
--- a/src/status.c
+++ b/src/status.c
@@ -50,7 +50,9 @@ static struct status_active_s s_status_active = {
static struct status_passive_s s_status_passive = {
.wms_wakeup_by_gesture_setting = -1,
+ .wms_clocks_set_idle = NULL,
.setappl_ambient_mode_bool = -1,
+ .homescreen_watch_face_visibility = -1,
.pm_key_ignore = -1,
.call_state = -1,
@@ -228,10 +230,19 @@ static void _status_passive_change_cb(keynode_t* node, void *data)
#ifdef TIZEN_PROFILE_WEARABLE
if (!strcmp(key_name, VCONFKEY_WMS_WAKEUP_BY_GESTURE_SETTING)) {
s_status_passive.wms_wakeup_by_gesture_setting = vconf_keynode_get_int(node);
+ } else if (!strcmp(key_name, VCONFKEY_WMS_CLOCKS_SET_IDLE)) {
+ char *tmp = vconf_keynode_get_str(node);
+
+ if (tmp) {
+ free(s_status_passive.wms_clocks_set_idle);
+ s_status_passive.wms_clocks_set_idle = tmp;
+ }
} 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 if (!strcmp(key_name, VCONFKEY_HOMESCREEN_WATCH_FACE_VISIBILITY)) {
+ s_status_passive.homescreen_watch_face_visibility = vconf_keynode_get_bool(node);
} else
#endif
if (!strcmp(key_name, VCONFKEY_PM_KEY_IGNORE)) {
@@ -355,6 +366,17 @@ int status_register(void)
s_status_passive.wms_wakeup_by_gesture_setting = -1;
}
+ if (vconf_notify_key_changed(VCONFKEY_WMS_CLOCKS_SET_IDLE, _status_passive_change_cb, NULL) < 0) {
+ _E("Failed to register add the callback for %s", VCONFKEY_WMS_CLOCKS_SET_IDLE);
+ }
+ if (!(s_status_passive.wms_clocks_set_idle = vconf_get_str(VCONFKEY_WMS_CLOCKS_SET_IDLE))) {
+ _E("Failed to get vconfkey[%s]", VCONFKEY_WMS_CLOCKS_SET_IDLE);
+ s_status_passive.wms_clocks_set_idle = strdup(IDLE_CLOCK_PKG_NAME);
+ if (!s_status_passive.wms_clocks_set_idle) {
+ _E("Failed to duplicate string");
+ }
+ }
+
if (vconf_notify_key_changed(VCONFKEY_SETAPPL_AMBIENT_MODE_BOOL, _status_passive_change_cb, NULL) < 0) {
_E("Failed to register add the callback for %s", VCONFKEY_SETAPPL_AMBIENT_MODE_BOOL);
} else if (vconf_get_int(VCONFKEY_SETAPPL_AMBIENT_MODE_BOOL, &s_status_passive.setappl_ambient_mode_bool) < 0) {
@@ -362,13 +384,19 @@ int status_register(void)
s_status_passive.setappl_ambient_mode_bool = -1;
}
+ if (vconf_notify_key_changed(VCONFKEY_HOMESCREEN_WATCH_FACE_VISIBILITY, _status_passive_change_cb, NULL) < 0) {
+ _E("Failed to register add the callback for %s", VCONFKEY_HOMESCREEN_WATCH_FACE_VISIBILITY);
+ } else if (vconf_get_bool(VCONFKEY_HOMESCREEN_WATCH_FACE_VISIBILITY, &s_status_passive.homescreen_watch_face_visibility) < 0) {
+ _E("Failed to get vconfkey[%s]", VCONFKEY_HOMESCREEN_WATCH_FACE_VISIBILITY);
+ s_status_passive.homescreen_watch_face_visibility = -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) {
@@ -437,7 +465,6 @@ int status_register(void)
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);
}
-
if (!(s_status_passive.setappl_3rd_lock_pkg_name_str = vconf_get_str(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR))) {
_E("Failed to get vconfkey[%s]", VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR);
s_status_passive.setappl_3rd_lock_pkg_name_str = strdup(STATUS_DEFAULT_LOCK_PKG_NAME);
@@ -505,10 +532,19 @@ void status_unregister(void)
_E("Failed to unregister the callback for %s", VCONFKEY_WMS_WAKEUP_BY_GESTURE_SETTING);
}
+ if (vconf_ignore_key_changed(VCONFKEY_WMS_CLOCKS_SET_IDLE, _status_passive_change_cb) < 0) {
+ _E("Failed to unregister the callback for %s", VCONFKEY_WMS_CLOCKS_SET_IDLE);
+ }
+ free(s_status_passive.wms_clocks_set_idle);
+
if (vconf_ignore_key_changed(VCONFKEY_SETAPPL_AMBIENT_MODE_BOOL, _status_passive_change_cb) < 0) {
_E("Failed to unregister the callback for %s", VCONFKEY_SETAPPL_AMBIENT_MODE_BOOL);
}
+ if (vconf_ignore_key_changed(VCONFKEY_HOMESCREEN_WATCH_FACE_VISIBILITY, _status_passive_change_cb) < 0) {
+ _E("Failed to unregister the callback for %s", VCONFKEY_HOMESCREEN_WATCH_FACE_VISIBILITY);
+ }
+
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);
}
diff --git a/src/wearable/hw_key.c b/src/wearable/hw_key.c
index 9c11c20..2957a85 100644
--- a/src/wearable/hw_key.c
+++ b/src/wearable/hw_key.c
@@ -126,7 +126,7 @@ static Eina_Bool _powerkey_timer_cb(void *data)
return ECORE_CALLBACK_CANCEL;
}
- home_mgr_launch_home_by_power();
+ home_mgr_launch_home();
return ECORE_CALLBACK_CANCEL;
}
@@ -388,6 +388,8 @@ void hw_key_destroy_window(void)
#include <feedback.h>
#include <vconf.h>
#include <aul.h>
+#include <rua.h>
+#include <pkgmgr-info.h>
#include "hw_key.h"
#include "util.h"
@@ -404,7 +406,6 @@ void hw_key_destroy_window(void)
#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",
@@ -515,20 +516,118 @@ static Eina_Bool _long_press_timer_cb(void* data)
+static void _launch_last_app(void)
+{
+ struct rua_rec record;
+ char **table = NULL;
+ int nrows = 0;
+ int ncols = 0;
+ int row = 0;
+ pkgmgrinfo_appinfo_h handle;
+ bool is_taskmanage = false;
+ int ret = 0;
+ char *last_app = NULL;
+
+ if (rua_init()) {
+ _E("Failed to initialize rua");
+ return;
+ }
+
+ if (rua_history_load_db(&table, &nrows, &ncols) || !table) {
+ _E("Failed to load rua history db");
+
+ if (rua_fini()) {
+ _E("Failed to finalize rua");
+ }
+
+ return;
+ }
+
+ for (row = 0; row < nrows; row++) {
+ if (rua_history_get_rec(&record, table, nrows, ncols, row)) {
+ _E("Failed to get rua history record");
+ continue;
+ }
+
+ _D("[%d] rua history(%s)", row, record.pkg_name);
+
+ if (!strcmp(record.pkg_name, HOMESCREEN_PKG_NAME) ||
+ !strcmp(record.pkg_name, ISE_DEFAULT_PKG_NAME) ||
+ !strcmp(record.pkg_name, status_passive_get()->wms_clocks_set_idle)) {
+ continue;
+ }
+
+ if (PMINFO_R_OK != pkgmgrinfo_appinfo_get_appinfo(record.pkg_name, &handle)) {
+ _E("Failed to get app info(%s)", record.pkg_name);
+ continue;
+ }
+
+ if (PMINFO_R_OK != pkgmgrinfo_appinfo_is_taskmanage(handle, &is_taskmanage)) {
+ _E("Failed to get taskmanage info");
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ continue;
+ }
+
+ if (!is_taskmanage) {
+ _E("This app(%s) is not showing on taskmanager", record.pkg_name);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ continue;
+ }
+
+ if (PMINFO_R_OK != pkgmgrinfo_appinfo_get_pkgid(handle, &last_app)) {
+ _E("Failed to get pkgid");
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ continue;
+ }
+
+ if (last_app == NULL) {
+ _E("last pkg name is NULL");
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ continue;
+ }
+
+ _D("last app : %s", last_app);
+ process_mgr_must_launch(last_app, NULL, NULL, NULL, NULL);
+
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+
+ break;
+ }
+
+ if (rua_history_unload_db(&table)) {
+ _E("Failed to unload rua history db");
+ }
+
+ if (rua_fini()) {
+ _E("Failed to finalize rua");
+ }
+}
+
+
+
static void _do_double_home_key_operation(void)
{
int op = 0;
+ int is_watch_face_shown = 0;
op = status_passive_get()->setappl_double_press_home_key;
_D("Dobule home key operation : %d", op);
+ is_watch_face_shown = status_passive_get()->homescreen_watch_face_visibility;
+ _D("Watch face status : %d", is_watch_face_shown);
+
switch(op) {
case VCONFKEY_DOUBLE_PRESS_HOME_KEY_NONE:
break;
case VCONFKEY_DOUBLE_PRESS_HOME_KEY_LAST_APP:
+ if (is_watch_face_shown) {
+ _launch_last_app();
+ } else {
+ home_mgr_launch_home_by_power((key_info.is_home_focused == EINA_TRUE) ? "powerkey_focused" : "powerkey_unfocused");
+ }
break;
case VCONFKEY_DOUBLE_PRESS_HOME_KEY_RECENT_APPS:
- process_mgr_must_launch(W_TASKMGR_PKGNAME, NULL, NULL, NULL, NULL);
+ process_mgr_must_launch(TASKMGR_PKG_NAME, NULL, NULL, NULL, NULL);
break;
default:
_E("invalid operation(%d)", op);