Modify launchpad-process-pool to support wrt-loader 91/51791/7 accepted/tizen/mobile/20160114.063045 accepted/tizen/tv/20160114.063125 accepted/tizen/wearable/20160114.063216 submit/tizen/20160114.010839
authorJunghoon Park <jh9216.park@samsung.com>
Thu, 14 Jan 2016 00:44:13 +0000 (09:44 +0900)
committerJunghoon Park <jh9216.park@samsung.com>
Thu, 14 Jan 2016 00:44:13 +0000 (09:44 +0900)
Change-Id: If90b2fbbef5eed2ee1ea80605e7f4b4ab3b5affd
Signed-off-by: Junghoon Park <jh9216.park@samsung.com>
inc/launchpad.h
src/launchpad.c

index 2b11d7e..775c2bb 100644 (file)
@@ -50,6 +50,7 @@ enum LAUNCHPAD_TYPE {
        LAUNCHPAD_TYPE_COMMON,
        LAUNCHPAD_TYPE_SW,
        LAUNCHPAD_TYPE_HW,
+       LAUNCHPAD_TYPE_WRT,
        LAUNCHPAD_TYPE_DYNAMIC,
        LAUNCHPAD_TYPE_MAX
 };
index d47c13e..60de1e3 100755 (executable)
@@ -46,6 +46,7 @@
 #define CANDIDATE_NONE 0
 #define PROCESS_POOL_LAUNCHPAD_SOCK ".launchpad-process-pool-sock"
 #define LOADER_PATH_DEFAULT "/usr/bin/launchpad-loader"
+#define LOADER_PATH_WRT                "/usr/bin/wrt-loader"
 
 typedef struct {
        int type;
@@ -270,11 +271,16 @@ static int __set_access(const char* appId, const char* pkg_type,
        return security_manager_prepare_app(appId) == SECURITY_MANAGER_SUCCESS ? 0 : -1;
 }
 
-static int __get_launchpad_type(const char* internal_pool, const char* hwacc)
+static int __get_launchpad_type(const char* internal_pool, const char* hwacc, const char *pkg_type)
 {
        int r;
        int sys_hwacc = -1;
 
+       if (pkg_type && strncmp(pkg_type, "wgt", 3) == 0) {
+               _D("[launchpad] launchpad type: wrt");
+               return LAUNCHPAD_TYPE_WRT;
+       }
+
        if (internal_pool && strncmp(internal_pool, "true", 4) == 0 && hwacc) {
                if (strncmp(hwacc, "NOT_USE", 7) == 0) {
                        _D("[launchpad] launchpad type: S/W(%d)", LAUNCHPAD_TYPE_SW);
@@ -932,9 +938,10 @@ static gboolean __handle_launch_event(gpointer data)
        SECURE_LOGD("comp_type : %s\n", menu_info->comp_type);
        SECURE_LOGD("internal pool : %s\n", menu_info->internal_pool);
        SECURE_LOGD("hwacc : %s\n", menu_info->hwacc);
+       SECURE_LOGD("pkg_type : %s\n", menu_info->pkg_type);
 
        if ((loader_id = __get_loader_id(kb)) <= PAD_LOADER_ID_STATIC) {
-               type = __get_launchpad_type(menu_info->internal_pool, menu_info->hwacc);
+               type = __get_launchpad_type(menu_info->internal_pool, menu_info->hwacc, menu_info->pkg_type);
                if (type < 0) {
                        _E("failed to get launchpad type");
                        goto end;
@@ -1118,6 +1125,13 @@ static int __add_default_slots()
        if (__prepare_candidate_process(LAUNCHPAD_TYPE_HW, PAD_LOADER_ID_STATIC) != 0)
                return -1;
 
+       if (access(LOADER_PATH_WRT, F_OK | X_OK) == 0) {
+               if (__add_slot(LAUNCHPAD_TYPE_WRT, PAD_LOADER_ID_STATIC, 0, LOADER_PATH_WRT) == NULL)
+                       return -1;
+               if (__prepare_candidate_process(LAUNCHPAD_TYPE_WRT, PAD_LOADER_ID_STATIC) != 0)
+                       return -1;
+       }
+
        return 0;
 }