diff options
author | Junghoon Park <jh9216.park@samsung.com> | 2016-01-21 19:59:56 +0900 |
---|---|---|
committer | Junghoon Park <jh9216.park@samsung.com> | 2016-01-22 10:44:20 +0900 |
commit | 9c1f1a5880717f205e4ab49963bce98fe19dd60b (patch) | |
tree | 3e0676a35739c4261035e996d3b9b2563f7f8971 | |
parent | 2f53b945e4380066d8c7fdd647efcc30186494d1 (diff) | |
download | launchpad-9c1f1a5880717f205e4ab49963bce98fe19dd60b.tar.gz launchpad-9c1f1a5880717f205e4ab49963bce98fe19dd60b.tar.bz2 launchpad-9c1f1a5880717f205e4ab49963bce98fe19dd60b.zip |
Add loader type for js-nativesubmit/tizen/20160122.050256accepted/tizen/wearable/20160122.080541accepted/tizen/tv/20160122.080526accepted/tizen/mobile/20160122.080502
Change-Id: Ia4bcdb32a872212269c7f44b4ec77fe26e8ef404
Signed-off-by: Junghoon Park <jh9216.park@samsung.com>
-rw-r--r-- | inc/key.h | 1 | ||||
-rw-r--r-- | inc/launchpad.h | 1 | ||||
-rw-r--r-- | inc/launchpad_common.h | 1 | ||||
-rwxr-xr-x | src/launchpad.c | 41 | ||||
-rw-r--r-- | src/launchpad_common.c | 6 |
5 files changed, 37 insertions, 13 deletions
@@ -24,6 +24,7 @@ extern "C" { #define AUL_K_STARTTIME "__AUL_STARTTIME__" #define AUL_K_EXEC "__AUL_EXEC__" #define AUL_K_PACKAGETYPE "__AUL_PACKAGETYPE__" +#define AUL_K_APP_TYPE "__AUL_APP_TYPE__" #define AUL_K_HWACC "__AUL_HWACC__" #define AUL_K_APPID "__AUL_APPID__" #define AUL_K_PID "__AUL_PID__" diff --git a/inc/launchpad.h b/inc/launchpad.h index 78c3e12..f4205ce 100644 --- a/inc/launchpad.h +++ b/inc/launchpad.h @@ -53,6 +53,7 @@ enum LAUNCHPAD_TYPE { LAUNCHPAD_TYPE_SW, LAUNCHPAD_TYPE_HW, LAUNCHPAD_TYPE_WRT, + LAUNCHPAD_TYPE_JS_NATIVE, LAUNCHPAD_TYPE_DYNAMIC, LAUNCHPAD_TYPE_MAX }; diff --git a/inc/launchpad_common.h b/inc/launchpad_common.h index 81ec73e..9dbb8b3 100644 --- a/inc/launchpad_common.h +++ b/inc/launchpad_common.h @@ -77,6 +77,7 @@ typedef struct { char *app_path; char *original_app_path; char *pkg_type; + char *app_type; char *hwacc; char *taskmanage; char *pkgid; diff --git a/src/launchpad.c b/src/launchpad.c index a481a2f..18e4c83 100755 --- a/src/launchpad.c +++ b/src/launchpad.c @@ -47,6 +47,7 @@ #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" +#define LOADER_PATH_JS_NATIVE "/usr/bin/jsnative-loader" typedef struct { int type; @@ -267,32 +268,34 @@ error: return -1; } -static int __set_access(const char* appId, const char* pkg_type, - const char* app_path) +static int __set_access(const char* appId) { return security_manager_prepare_app(appId) == SECURITY_MANAGER_SUCCESS ? 0 : -1; } -static int __get_launchpad_type(const char* internal_pool, const char* hwacc, const char *pkg_type) +static int __get_launchpad_type(const char* internal_pool, const char* hwacc, const char *app_type) { int r; int sys_hwacc = -1; - if (pkg_type && strncmp(pkg_type, "wgt", 3) == 0) { + if (app_type && strcmp(app_type, "webapp") == 0) { _D("[launchpad] launchpad type: wrt"); return LAUNCHPAD_TYPE_WRT; + } else if (app_type && strcmp(app_type, "jsapp") == 0) { + _D("[launchpad] launchpad type: js_native"); + return LAUNCHPAD_TYPE_JS_NATIVE; } - if (internal_pool && strncmp(internal_pool, "true", 4) == 0 && hwacc) { - if (strncmp(hwacc, "NOT_USE", 7) == 0) { + if (internal_pool && strcmp(internal_pool, "true") == 0 && hwacc) { + if (strcmp(hwacc, "NOT_USE") == 0) { _D("[launchpad] launchpad type: S/W(%d)", LAUNCHPAD_TYPE_SW); return LAUNCHPAD_TYPE_SW; } - if (strncmp(hwacc, "USE", 3) == 0) { + if (strcmp(hwacc, "USE") == 0) { _D("[launchpad] launchpad type: H/W(%d)", LAUNCHPAD_TYPE_HW); return LAUNCHPAD_TYPE_HW; } - if (strncmp(hwacc, "SYS", 3) == 0) { + 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); @@ -510,9 +513,8 @@ static int __prepare_exec(const char *appId, const char *app_path, /* SET PRIVILEGES*/ if (bundle_get_val(kb, AUL_K_PRIVACY_APPID) == NULL) { - _D("appId: %s / pkg_type : %s / app_path : %s ", appId, menu_info->pkg_type, - app_path); - if ((ret = __set_access(appId, menu_info->pkg_type, app_path)) != 0) { + _D("appId: %s / app_path : %s ", appId, app_path); + if ((ret = __set_access(appId)) != 0) { _D("fail to set privileges - check your package's credential : %d\n", ret); return -1; } @@ -950,15 +952,21 @@ 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("app_type : %s\n", menu_info->app_type); 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, menu_info->pkg_type); + type = __get_launchpad_type(menu_info->internal_pool, menu_info->hwacc, + menu_info->app_type); if (type < 0) { _E("failed to get launchpad type"); goto end; } - loader_id = PAD_LOADER_ID_STATIC; + + if (menu_info->comp_type && strcmp(menu_info->comp_type, "svcapp") == 0) + loader_id == PAD_LOADER_ID_DIRECT; + else + loader_id = PAD_LOADER_ID_STATIC; } else { type = LAUNCHPAD_TYPE_DYNAMIC; } @@ -1148,6 +1156,13 @@ static int __add_default_slots() return -1; } + if (access(LOADER_PATH_JS_NATIVE, F_OK | X_OK) == 0) { + if (__add_slot(LAUNCHPAD_TYPE_JS_NATIVE, PAD_LOADER_ID_STATIC, 0, LOADER_PATH_JS_NATIVE, NULL) == NULL) + return -1; + if (__prepare_candidate_process(LAUNCHPAD_TYPE_JS_NATIVE, PAD_LOADER_ID_STATIC) != 0) + return -1; + } + return 0; } diff --git a/src/launchpad_common.c b/src/launchpad_common.c index c2a09c7..84146fa 100644 --- a/src/launchpad_common.c +++ b/src/launchpad_common.c @@ -388,6 +388,9 @@ appinfo_t* _appinfo_create(bundle *kb) ptr = bundle_get_val(kb, AUL_K_PACKAGETYPE); if (ptr) menu_info->pkg_type = strdup(ptr); + ptr = bundle_get_val(kb, AUL_K_APP_TYPE); + if (ptr) + menu_info->app_type = strdup(ptr); ptr = bundle_get_val(kb, AUL_K_HWACC); if (ptr) menu_info->hwacc = strdup(ptr); @@ -458,6 +461,8 @@ void _appinfo_free(appinfo_t *menu_info) free(menu_info->original_app_path); if (menu_info->pkg_type != NULL) free(menu_info->pkg_type); + if (menu_info->app_type != NULL) + free(menu_info->app_type); if (menu_info->hwacc != NULL) free(menu_info->hwacc); if (menu_info->taskmanage != NULL) @@ -482,6 +487,7 @@ void _modify_bundle(bundle * kb, int caller_pid, appinfo_t *menu_info, int cmd) bundle_del(kb, AUL_K_APPID); bundle_del(kb, AUL_K_EXEC); + bundle_del(kb, AUL_K_APP_TYPE); bundle_del(kb, AUL_K_PACKAGETYPE); bundle_del(kb, AUL_K_HWACC); bundle_del(kb, AUL_K_TASKMANAGE); |