summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunghoon Park <jh9216.park@samsung.com>2015-12-10 08:48:34 +0900
committerJunghoon Park <jh9216.park@samsung.com>2015-12-10 15:00:19 +0900
commitf0dba7cdc2dd3e7ce9ca86937588552a9df7cb53 (patch)
treee2e620532aa200c96ab89d20787f6b59d98b0d5e
parentf5de8917629b374c8765c70b047dc4891f5ba220 (diff)
downloadlaunchpad-f0dba7cdc2dd3e7ce9ca86937588552a9df7cb53.tar.gz
launchpad-f0dba7cdc2dd3e7ce9ca86937588552a9df7cb53.tar.bz2
launchpad-f0dba7cdc2dd3e7ce9ca86937588552a9df7cb53.zip
Some apps may want to launch apps without loader. Change-Id: I2a3cbdf60bc6e7982ad127e8aee585cf1695a2e7 Signed-off-by: Junghoon Park <jh9216.park@samsung.com>
-rw-r--r--inc/launchpad_common.h4
-rwxr-xr-xsrc/launchpad.c56
2 files changed, 32 insertions, 28 deletions
diff --git a/inc/launchpad_common.h b/inc/launchpad_common.h
index 86cd679..48c4a95 100644
--- a/inc/launchpad_common.h
+++ b/inc/launchpad_common.h
@@ -41,6 +41,10 @@
#define PAD_CMD_ADD_LOADER 11
#define PAD_CMD_REMOVE_LOADER 12
+#define PAD_LOADER_ID_STATIC 0
+#define PAD_LOADER_ID_DIRECT 1
+#define PAD_LOADER_ID_DYNAMIC_BASE 10
+
#define _E(fmt, arg...) LOGE(fmt, ##arg)
#define _D(fmt, arg...) LOGD(fmt, ##arg)
#define _W(fmt, arg...) LOGW(fmt, ##arg)
diff --git a/src/launchpad.c b/src/launchpad.c
index 00b1dd3..bfcab22 100755
--- a/src/launchpad.c
+++ b/src/launchpad.c
@@ -72,7 +72,7 @@ static int __remove_slot(int type, int loader_id);
static int __make_loader_id()
{
- static int id = 0;
+ static int id = PAD_LOADER_ID_DYNAMIC_BASE;
return ++id;
}
@@ -899,6 +899,7 @@ static gboolean __handle_launch_event(gpointer data)
bundle *kb = NULL;
app_pkt_t *pkt = NULL;
appinfo_t *menu_info = NULL;
+ candidate_process_context_t *cpc;
const char *app_path = NULL;
int pid = -1;
@@ -906,7 +907,6 @@ static gboolean __handle_launch_event(gpointer data)
struct ucred cr;
int type = -1;
int loader_id;
- int i;
int ret;
pkt = _recv_pkt_raw(fd, &clifd, &cr);
@@ -970,13 +970,13 @@ static gboolean __handle_launch_event(gpointer data)
SECURE_LOGD("internal pool : %s\n", menu_info->internal_pool);
SECURE_LOGD("hwacc : %s\n", menu_info->hwacc);
- if ((loader_id = __get_loader_id(kb)) < 0) {
+ if ((loader_id = __get_loader_id(kb)) <= PAD_LOADER_ID_STATIC) {
type = __get_launchpad_type(menu_info->internal_pool, menu_info->hwacc);
if (type < 0) {
_E("failed to get launchpad type");
goto end;
}
- loader_id = 0;
+ loader_id = PAD_LOADER_ID_STATIC;
} else {
type = LAUNCHPAD_TYPE_DYNAMIC;
}
@@ -988,32 +988,32 @@ static gboolean __handle_launch_event(gpointer data)
}
PERF("get package information & modify bundle done");
- candidate_process_context_t *cpc = __find_slot(type, loader_id);
-
- for (i = 0; i < 2; i++) {
- if (cpc == NULL)
- break;
+ if (loader_id == PAD_LOADER_ID_DIRECT ||
+ (cpc = __find_slot(type, loader_id)) == NULL) {
+ _W("Launch directly");
+ pid = __launch_directly(menu_info->appid, app_path, clifd, kb, menu_info);
+ } else {
if (cpc->prepared) {
- _W("Launch on type-based process-pool");
+ _W("Launch %d type process", type);
pid = __send_launchpad_loader(cpc, pkt, app_path, clifd, menu_info->comp_type);
- clifd = -1;
- goto end;
- }
-
- if (cpc->type == LAUNCHPAD_TYPE_SW || cpc->type == LAUNCHPAD_TYPE_HW) {
- cpc = __find_slot(LAUNCHPAD_TYPE_COMMON, 0);
- continue;
+ } else if (cpc->type == LAUNCHPAD_TYPE_SW || cpc->type == LAUNCHPAD_TYPE_HW) {
+ cpc = __find_slot(LAUNCHPAD_TYPE_COMMON, loader_id);
+ if (cpc != NULL && cpc->prepared) {
+ _W("Launch common type process");
+ pid = __send_launchpad_loader(cpc, pkt, app_path, clifd, menu_info->comp_type);
+ } else {
+ _W("Launch directly");
+ pid = __launch_directly(menu_info->appid, app_path, clifd, kb, menu_info);
+ }
+ } else {
+ _W("Launch directly");
+ pid = __launch_directly(menu_info->appid, app_path, clifd, kb, menu_info);
}
-
- break;
}
- _W("Candidate is not prepared");
- pid = __launch_directly(menu_info->appid, app_path, clifd, kb, menu_info);
__send_result_to_caller(clifd, pid, app_path);
clifd = -1;
-
end:
if (clifd != -1)
close(clifd);
@@ -1137,19 +1137,19 @@ static int __init_sigchild_fd(void)
static int __add_default_slots()
{
- if (__add_slot(LAUNCHPAD_TYPE_COMMON, 0, 0, LOADER_PATH_DEFAULT) == NULL)
+ if (__add_slot(LAUNCHPAD_TYPE_COMMON, PAD_LOADER_ID_STATIC, 0, LOADER_PATH_DEFAULT) == NULL)
return -1;
- if (__prepare_candidate_process(LAUNCHPAD_TYPE_COMMON, 0) != 0)
+ if (__prepare_candidate_process(LAUNCHPAD_TYPE_COMMON, PAD_LOADER_ID_STATIC) != 0)
return -1;
- if (__add_slot(LAUNCHPAD_TYPE_SW, 0, 0, LOADER_PATH_DEFAULT) == NULL)
+ if (__add_slot(LAUNCHPAD_TYPE_SW, PAD_LOADER_ID_STATIC, 0, LOADER_PATH_DEFAULT) == NULL)
return -1;
- if (__prepare_candidate_process(LAUNCHPAD_TYPE_SW, 0) != 0)
+ if (__prepare_candidate_process(LAUNCHPAD_TYPE_SW, PAD_LOADER_ID_STATIC) != 0)
return -1;
- if (__add_slot(LAUNCHPAD_TYPE_HW, 0, 0, LOADER_PATH_DEFAULT) == NULL)
+ if (__add_slot(LAUNCHPAD_TYPE_HW, PAD_LOADER_ID_STATIC, 0, LOADER_PATH_DEFAULT) == NULL)
return -1;
- if (__prepare_candidate_process(LAUNCHPAD_TYPE_HW, 0) != 0)
+ if (__prepare_candidate_process(LAUNCHPAD_TYPE_HW, PAD_LOADER_ID_STATIC) != 0)
return -1;
return 0;