PKG_CHECK_MODULES(${this_target_pool} REQUIRED
dlog
libsystemd-daemon
- vconf
security-manager
bundle
gio-2.0
security-manager
bundle
aul
+ vconf
)
FOREACH(flag ${${this_target_loader}_CFLAGS})
enum LAUNCHPAD_TYPE {
LAUNCHPAD_TYPE_UNSUPPORTED = -1,
- LAUNCHPAD_TYPE_COMMON,
- LAUNCHPAD_TYPE_SW,
LAUNCHPAD_TYPE_HW,
LAUNCHPAD_TYPE_USER,
LAUNCHPAD_TYPE_DYNAMIC = 100,
#include <bundle_internal.h>
#include <security-manager.h>
#include <time.h>
-#include <vconf.h>
#include <systemd/sd-daemon.h>
#include <glib.h>
#include <linux/limits.h>
static GList *loader_info_list;
static int user_slot_offset;
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,
int detection_method, int timeout_val);
if (type >= LAUNCHPAD_TYPE_USER)
return type;
- 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;
- } else if (strcmp(hwacc, "USE") == 0) {
- _D("[launchpad] launchpad type: H/W(%d)",
- LAUNCHPAD_TYPE_HW);
- return LAUNCHPAD_TYPE_HW;
- } else if (strcmp(hwacc, "SYS") == 0) {
- if (sys_hwacc == SETTING_HW_ACCELERATION_ON) {
- _D("[launchpad] launchpad type: H/W(%d)",
- LAUNCHPAD_TYPE_HW);
- return LAUNCHPAD_TYPE_HW;
- } else if (sys_hwacc == SETTING_HW_ACCELERATION_OFF) {
- _D("[launchpad] launchpad type: S/W(%d)",
- LAUNCHPAD_TYPE_SW);
- return LAUNCHPAD_TYPE_SW;
- }
- }
- }
-
- _D("[launchpad] launchpad type: COMMON(%d)", LAUNCHPAD_TYPE_COMMON);
- return LAUNCHPAD_TYPE_COMMON;
+ return LAUNCHPAD_TYPE_HW;
}
static int __get_loader_id(bundle *kb)
_W("Launch %d type process", type);
pid = __send_launchpad_loader(cpc, pkt, app_path,
clifd);
- } 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);
- } else {
- _W("Launch directly");
- pid = __launch_directly(menu_info->appid,
- app_path, clifd, kb, menu_info,
- NULL);
- }
} else {
_W("Launch directly");
pid = __launch_directly(menu_info->appid, app_path,
candidate_process_context_t *cpc;
int ret;
- cpc = __add_slot(LAUNCHPAD_TYPE_COMMON, PAD_LOADER_ID_STATIC, 0,
- LOADER_PATH_DEFAULT, NULL,
- METHOD_TIMEOUT | METHOD_VISIBILITY, 5000);
- if (cpc == NULL)
- return -1;
-
- ret = __prepare_candidate_process(LAUNCHPAD_TYPE_COMMON,
- PAD_LOADER_ID_STATIC);
- if (ret != 0)
- return -1;
-
- cpc = __add_slot(LAUNCHPAD_TYPE_SW, PAD_LOADER_ID_STATIC, 0,
- LOADER_PATH_DEFAULT, NULL,
- METHOD_TIMEOUT | METHOD_VISIBILITY, 5000);
- if (cpc == NULL)
- return -1;
-
- ret = __prepare_candidate_process(LAUNCHPAD_TYPE_SW,
- PAD_LOADER_ID_STATIC);
- if (ret != 0)
- return -1;
-
cpc = __add_slot(LAUNCHPAD_TYPE_HW, PAD_LOADER_ID_STATIC, 0,
LOADER_PATH_DEFAULT, NULL,
METHOD_TIMEOUT | METHOD_VISIBILITY, 5000);
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)
{
int ret;
return -1;
}
- ret = vconf_get_int(VCONFKEY_SETAPPL_APP_HW_ACCELERATION, &sys_hwacc);
- if (ret != VCONF_OK) {
- _E("Failed to get vconf int: %s",
- VCONFKEY_SETAPPL_APP_HW_ACCELERATION);
- }
-
- SECURE_LOGD("sys hwacc: %d", sys_hwacc);
-
- ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_APP_HW_ACCELERATION,
- __vconf_cb, NULL);
- if (ret != 0) {
- _E("Failed to register callback for %s",
- VCONFKEY_SETAPPL_APP_HW_ACCELERATION);
- }
-
return 0;
}
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);
bundle_del(kb, AUL_K_PKGID);
bundle_del(kb, AUL_K_COMP_TYPE);
- bundle_del(kb, AUL_K_INTERNAL_POOL);
/* Parse app_path to retrieve default bundle*/
if (cmd == PAD_CMD_LAUNCH) {
return -1;
}
+bundle *launchpad_loader_get_bundle()
+{
+ return __bundle;
+}
+
API int launchpad_loader_main(int argc, char **argv,
loader_lifecycle_callback_s *callbacks,
loader_adapter_s *adapter, void *user_data)
#include <Elementary.h>
#include <bundle_internal.h>
#include <aul.h>
+#include <vconf.h>
#include "launchpad_common.h"
#include "preload.h"
#include "process_pool_preload.h"
#include "launchpad.h"
+extern bundle *launchpad_loader_get_bundle();
+
static Ecore_Fd_Handler *__fd_handler;
static loader_receiver_cb __receiver;
static int __argc;
static char **__argv;
+static int __sys_hwacc;
+static Evas_Object *__win;
+static Evas_Object *__bg;
+static Evas_Object *__conform;
-static void __init_window(void)
+static void __vconf_cb(keynode_t *key, void *data)
{
- Evas_Object *win;
- Evas_Object *bg;
- Evas_Object *conform;
+ 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);
+ _D("sys hwacc: %d", __sys_hwacc);
+ }
+}
- win = elm_win_add(NULL, "package_name", ELM_WIN_BASIC);
- if (win == NULL) {
+static void __init_window(void)
+{
+ __win = elm_win_add(NULL, "package_name", ELM_WIN_BASIC);
+ if (__win == NULL) {
_E("[candidate] elm_win_add() failed");
return;
}
- elm_win_precreated_object_set(win);
+ elm_win_precreated_object_set(__win);
- bg = elm_bg_add(win);
- if (bg) {
- evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND,
+ __bg = elm_bg_add(__win);
+ if (__bg) {
+ evas_object_size_hint_weight_set(__bg, EVAS_HINT_EXPAND,
EVAS_HINT_EXPAND);
- elm_win_resize_object_add(win, bg);
- elm_bg_precreated_object_set(bg);
+ elm_win_resize_object_add(__win, __bg);
+ elm_bg_precreated_object_set(__bg);
} else {
_E("[candidate] elm_bg_add() failed");
}
- conform = elm_conformant_add(win);
- if (conform) {
- evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND,
+ __conform = elm_conformant_add(__win);
+ if (__conform) {
+ evas_object_size_hint_weight_set(__conform, EVAS_HINT_EXPAND,
EVAS_HINT_EXPAND);
- elm_win_resize_object_add(win, conform);
- elm_conformant_precreated_object_set(conform);
+ elm_win_resize_object_add(__win, __conform);
+ elm_conformant_precreated_object_set(__conform);
} else {
_E("elm_conformant_add() failed");
}
}
-static void __init_theme(void)
+static void __fini_window(void)
{
- char *theme = elm_theme_list_item_path_get(eina_list_data_get(
- elm_theme_list_get(NULL)), NULL);
- Eina_Bool is_exist = edje_file_group_exists(theme, "*");
- if (!is_exist)
- _D("theme path: %s", theme);
-
- if (theme)
- free(theme);
+ if (__conform) {
+ evas_object_del(__conform);
+ elm_conformant_precreated_object_set(NULL);
+ __conform = NULL;
+ }
+
+ if (__bg) {
+ evas_object_del(__bg);
+ elm_bg_precreated_object_set(NULL);
+ __bg = NULL;
+ }
+
+ if (__win) {
+ evas_object_del(__win);
+ elm_win_precreated_object_set(NULL);
+ __win = NULL;
+ }
}
static void __loader_create_cb(bundle *extra, int type, void *user_data)
{
int elm_init_cnt = 0;
+ int ret;
__preload_init(__argc, __argv);
__preload_init_for_process_pool();
elm_init_cnt = elm_init(__argc, __argv);
_D("[candidate] elm init, returned: %d", elm_init_cnt);
- switch (type) {
- case LAUNCHPAD_TYPE_SW:
- elm_config_accel_preference_set("none");
- __init_window();
- break;
- case LAUNCHPAD_TYPE_HW:
- elm_config_accel_preference_set("hw");
- __init_window();
- break;
- case LAUNCHPAD_TYPE_COMMON:
- __init_theme();
- break;
+ elm_config_accel_preference_set("hw");
+ __init_window();
+
+ ret = vconf_get_int(VCONFKEY_SETAPPL_APP_HW_ACCELERATION, &__sys_hwacc);
+ if (ret != VCONF_OK) {
+ _E("Failed to get vconf int: %s",
+ VCONFKEY_SETAPPL_APP_HW_ACCELERATION);
+ }
+
+ ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_APP_HW_ACCELERATION,
+ __vconf_cb, NULL);
+ if (ret != 0) {
+ _E("Failed to register callback for %s",
+ VCONFKEY_SETAPPL_APP_HW_ACCELERATION);
}
malloc_trim(0);
}
const char *appid, const char *pkgid, const char *pkg_type,
void *user_data)
{
+ const char *hwacc;
+ bundle *kb = launchpad_loader_get_bundle();
+
+ vconf_ignore_key_changed(VCONFKEY_SETAPPL_APP_HW_ACCELERATION, __vconf_cb);
+ if (kb == NULL)
+ return 0;
+
+ hwacc = bundle_get_val(kb, AUL_K_HWACC);
+
+ if (!hwacc)
+ return 0;
+
+ if (strcmp(hwacc, "USE") == 0) {
+ _D("Use preinitialized window");
+ return 0;
+ } else if (strcmp(hwacc, "SYS") == 0 &&
+ __sys_hwacc == SETTING_HW_ACCELERATION_ON) {
+ _D("Use preinitialized window");
+ return 0;
+ }
+
+ _D("Dispose window");
+ __fini_window();
+ elm_config_accel_preference_set("none");
+
return 0;
}