diff options
author | Junghoon Park <jh9216.park@samsung.com> | 2016-06-16 13:01:40 +0900 |
---|---|---|
committer | Junghoon Park <jh9216.park@samsung.com> | 2016-06-16 13:01:40 +0900 |
commit | aa24d55c9137ea3b2d971d34793c1bd8311bf04f (patch) | |
tree | 2dd7652fc453180940a056d8a35f976ab3f7eb67 | |
parent | 3d99a02f34291d3193b7d550ad17bc8a0fafcd94 (diff) | |
download | launchpad-aa24d55c9137ea3b2d971d34793c1bd8311bf04f.tar.gz launchpad-aa24d55c9137ea3b2d971d34793c1bd8311bf04f.tar.bz2 launchpad-aa24d55c9137ea3b2d971d34793c1bd8311bf04f.zip |
Select the loader to launch explicitly
- Caller may add extra data about loader name to launch an app.
- If it exist, the loader will be used with first priority.
Change-Id: I195341ab46a6f2610997ff18fada3c3ddc8d2a88
Signed-off-by: Junghoon Park <jh9216.park@samsung.com>
-rw-r--r-- | inc/key.h | 1 | ||||
-rw-r--r-- | inc/launchpad_common.h | 1 | ||||
-rw-r--r-- | inc/loader_info.h | 1 | ||||
-rwxr-xr-x | src/launchpad.c | 12 | ||||
-rw-r--r-- | src/launchpad_common.c | 6 | ||||
-rw-r--r-- | src/loader_info.c | 18 |
6 files changed, 32 insertions, 7 deletions
@@ -42,6 +42,7 @@ extern "C" { #define AUL_K_WAYLAND_WORKING_DIR "__AUL_WAYLAND_WORKING_DIR__" #define AUL_K_ROOT_PATH "__AUL_ROOT_PATH__" #define AUL_K_API_VERSION "__AUL_API_VERSION__" +#define AUL_K_LOADER_NAME "__AUL_LOADER_NAME__" #ifdef __cplusplus } diff --git a/inc/launchpad_common.h b/inc/launchpad_common.h index 8ae9705..aad42c8 100644 --- a/inc/launchpad_common.h +++ b/inc/launchpad_common.h @@ -95,6 +95,7 @@ typedef struct { char *comp_type; char *internal_pool; char *root_path; + char *loader_name; } appinfo_t; char *_proc_get_cmdline_bypid(int pid); diff --git a/inc/loader_info.h b/inc/loader_info.h index 6c411ed..4bc89ec 100644 --- a/inc/loader_info.h +++ b/inc/loader_info.h @@ -39,6 +39,7 @@ typedef struct _loader_info { GList *_loader_info_load(const char *path); void _loader_info_dispose(GList *info); int _loader_info_find_type(GList *info, const char *app_type, bool hwacc); +int _loader_info_find_type_by_loader_name(GList *info, const char *loader_name); int *_loader_get_alternative_types(GList *info, int type, int *len); diff --git a/src/launchpad.c b/src/launchpad.c index 1933365..9474862 100755 --- a/src/launchpad.c +++ b/src/launchpad.c @@ -912,7 +912,7 @@ static bool __is_hw_acc(const char *hwacc) } static candidate_process_context_t *__find_available_slot(const char *hwacc, - const char *app_type) + const char *app_type, const char *loader_name) { int type; candidate_process_context_t *cpc; @@ -920,7 +920,10 @@ static candidate_process_context_t *__find_available_slot(const char *hwacc, int len = 0; int i; - type = _loader_info_find_type(loader_info_list, app_type, __is_hw_acc(hwacc)); + if (loader_name) + type = _loader_info_find_type_by_loader_name(loader_info_list, loader_name); + else + type = _loader_info_find_type(loader_info_list, app_type, __is_hw_acc(hwacc)); cpc = __find_slot(type, PAD_LOADER_ID_STATIC); if (!cpc) return NULL; @@ -1043,12 +1046,11 @@ static gboolean __handle_launch_event(gpointer data) SECURE_LOGD("app_type : %s\n", menu_info->app_type); SECURE_LOGD("pkg_type : %s\n", menu_info->pkg_type); - if (menu_info->comp_type && - strcmp(menu_info->comp_type, "svcapp") == 0) { + strcmp(menu_info->comp_type, "svcapp") == 0) { loader_id = PAD_LOADER_ID_DIRECT; } else if ((loader_id = __get_loader_id(kb)) <= PAD_LOADER_ID_STATIC) { - cpc = __find_available_slot(menu_info->hwacc, menu_info->app_type); + cpc = __find_available_slot(menu_info->hwacc, menu_info->app_type, menu_info->loader_name); } else { type = LAUNCHPAD_TYPE_DYNAMIC; cpc = __find_slot(type, loader_id); diff --git a/src/launchpad_common.c b/src/launchpad_common.c index 960c53f..ef42c0a 100644 --- a/src/launchpad_common.c +++ b/src/launchpad_common.c @@ -415,6 +415,10 @@ appinfo_t *_appinfo_create(bundle *kb) if (ptr) menu_info->root_path = strdup(ptr); + ptr = bundle_get_val(kb, AUL_K_LOADER_NAME); + if (ptr) + menu_info->loader_name = strdup(ptr); + if (!_appinfo_get_app_path(menu_info)) { _appinfo_free(menu_info); return NULL; @@ -483,6 +487,8 @@ void _appinfo_free(appinfo_t *menu_info) free(menu_info->internal_pool); if (menu_info->root_path != NULL) free(menu_info->root_path); + if (menu_info->loader_name != NULL) + free(menu_info->loader_name); free(menu_info); } diff --git a/src/loader_info.c b/src/loader_info.c index 2c02a68..b683539 100644 --- a/src/loader_info.c +++ b/src/loader_info.c @@ -92,7 +92,7 @@ static void __parse_app_types(loader_info_t *info, char *line) while (token) { refined_tok[0] = '\0'; sscanf(token, "%s", refined_tok); - if (refined_tok[0] != '\0') + if (refined_tok[0] != '\0' && strcasecmp("null", refined_tok) != 0) info->app_types = g_list_append(info->app_types, strdup(refined_tok)); token = strtok_r(NULL, "|", &savedptr); } @@ -275,6 +275,8 @@ void _loader_info_dispose(GList *info) static int __comp_str(gconstpointer a, gconstpointer b) { + if (!a || !b) + return -1; return strcmp(a, b); } @@ -320,7 +322,6 @@ int _loader_info_find_type(GList *info, const char *app_type, bool hwacc) { GList *cur = NULL; - if (hwacc) cur = g_list_find_custom(info, app_type, __comp_app_type_with_hw_acc); else @@ -334,6 +335,19 @@ int _loader_info_find_type(GList *info, const char *app_type, bool hwacc) return cur_info->type; } +int _loader_info_find_type_by_loader_name(GList *info, const char *loader_name) +{ + GList *cur = NULL; + + cur = g_list_find_custom(info, loader_name, __comp_name); + if (cur == NULL) + return -1; + + loader_info_t *cur_info = (loader_info_t *)cur->data; + + return cur_info->type; +} + static int *__make_type_array(GList *info, GList *loaders, int *len) { int l; |