Use vconf_notify_key_changed API for getting sys hwacc 23/58223/2 accepted/tizen/mobile/20160129.002311 accepted/tizen/tv/20160129.002331 accepted/tizen/wearable/20160129.002347 submit/tizen/20160128.120001
authorHwankyu Jhun <h.jhun@samsung.com>
Thu, 28 Jan 2016 10:56:25 +0000 (19:56 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Thu, 28 Jan 2016 11:08:04 +0000 (20:08 +0900)
Change-Id: I3794b4befc45ec8b469b529868b860b9581e37e3
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/launchpad.c

index c14403b90d5d882a0ddf1e2c2198099e0cbaf3fd..6738667c7bb434157551accbd31f57a4799d1135 100755 (executable)
@@ -70,6 +70,7 @@ typedef struct {
 } loader_context_t;
 
 static GList *candidate_slot_list;
+static int sys_hwacc = -1;
 static candidate_process_context_t* __add_slot(int type, int loader_id, int caller_pid, const char *loader_path, const char *extra);
 static int __remove_slot(int type, int loader_id);
 static int __add_default_slots();
@@ -275,9 +276,6 @@ static int __set_access(const char* appId)
 
 static int __get_launchpad_type(const char* internal_pool, const char* hwacc, const char *app_type)
 {
-       int r;
-       int sys_hwacc = -1;
-
        if (app_type && strcmp(app_type, "webapp") == 0) {
                _D("[launchpad] launchpad type: wrt");
                return LAUNCHPAD_TYPE_WRT;
@@ -296,12 +294,6 @@ static int __get_launchpad_type(const char* internal_pool, const char* hwacc, co
                        return LAUNCHPAD_TYPE_HW;
                }
                if (strcmp(hwacc, "SYS") == 0) {
-                       r = vconf_get_int(VCONFKEY_SETAPPL_APP_HW_ACCELERATION, &sys_hwacc);
-                       if (r != VCONF_OK)
-                               _E("failed to get vconf int: %s", VCONFKEY_SETAPPL_APP_HW_ACCELERATION);
-
-                       SECURE_LOGD("sys hwacc: %d", sys_hwacc);
-
                        if (sys_hwacc == SETTING_HW_ACCELERATION_ON) {
                                _D("[launchpad] launchpad type: H/W(%d)", LAUNCHPAD_TYPE_HW);
                                return LAUNCHPAD_TYPE_HW;
@@ -964,7 +956,7 @@ static gboolean __handle_launch_event(gpointer data)
                }
 
                if (menu_info->comp_type && strcmp(menu_info->comp_type, "svcapp") == 0)
-                       loader_id == PAD_LOADER_ID_DIRECT;
+                       loader_id = PAD_LOADER_ID_DIRECT;
                else
                        loader_id = PAD_LOADER_ID_STATIC;
        } else {
@@ -1166,6 +1158,17 @@ static int __add_default_slots()
        return 0;
 }
 
+static void __vconf_cb(keynode_t *key, void *data)
+{
+       const char *name;
+
+       name = vconf_keynode_get_name(key);
+       if (name && strcmp(name, VCONFKEY_SETAPPL_APP_HW_ACCELERATION) == 0) {
+               sys_hwacc = vconf_keynode_get_int(key);
+               SECURE_LOGD("sys hwacc: %d", sys_hwacc);
+       }
+}
+
 static int __before_loop(int argc, char **argv)
 {
        if (__init_sigchild_fd() != 0) {
@@ -1178,6 +1181,14 @@ static int __before_loop(int argc, char **argv)
                return -1;
        }
 
+       if (vconf_get_int(VCONFKEY_SETAPPL_APP_HW_ACCELERATION, &sys_hwacc) != VCONF_OK)
+               _E("Failed to get vconf int: %s", VCONFKEY_SETAPPL_APP_HW_ACCELERATION);
+
+       SECURE_LOGD("sys hwacc: %d", sys_hwacc);
+
+       if (vconf_notify_key_changed(VCONFKEY_SETAPPL_APP_HW_ACCELERATION, __vconf_cb, NULL) != 0)
+               _E("Failed to register callback for %s", VCONFKEY_SETAPPL_APP_HW_ACCELERATION);
+
        return 0;
 }