From d2d47b8dc2b8972e6bd1f83410b4983450ce6099 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 20 Dec 2017 07:15:50 +0900 Subject: [PATCH 01/16] Revert "Remove wayland env set that no longer required" This reverts commit fe93ddfe7aa636bb84adf004f1a8fbf4c046ecbf. Change-Id: I69129f1608dbd81ed2c001da7f168992a651275f --- inc/key.h | 2 ++ src/launchpad_common.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/inc/key.h b/inc/key.h index 9900b6e..7401ace 100644 --- a/inc/key.h +++ b/inc/key.h @@ -37,6 +37,8 @@ extern "C" { #define AUL_K_LOADER_ID "__AUL_LOADER_ID__" #define AUL_K_LOADER_PATH "__AUL_LOADER_PATH__" #define AUL_K_LOADER_EXTRA "__AUL_LOADER_EXTRA__" +#define AUL_K_WAYLAND_DISPLAY "__AUL_WAYLAND_DISPLAY__" +#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__" diff --git a/src/launchpad_common.c b/src/launchpad_common.c index ab93f12..f2272b5 100644 --- a/src/launchpad_common.c +++ b/src/launchpad_common.c @@ -687,6 +687,14 @@ void _set_env(appinfo_t *menu_info, bundle *kb) if (menu_info->app_type != NULL) setenv("RUNTIME_TYPE", menu_info->app_type, 1); + str = bundle_get_val(kb, AUL_K_WAYLAND_DISPLAY); + if (str != NULL) + setenv("WAYLAND_DISPLAY", str, 1); + + str = bundle_get_val(kb, AUL_K_WAYLAND_WORKING_DIR); + if (str != NULL) + setenv("XDG_RUNTIME_DIR", str, 1); + str = bundle_get_val(kb, AUL_K_API_VERSION); if (str != NULL) setenv("TIZEN_API_VERSION", str, 1); -- 2.7.4 From 0f2c0974600ad2f04e10f89c0fd06df9238111e2 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 20 Dec 2017 11:16:44 +0900 Subject: [PATCH 02/16] Release version 0.3.12 Changes: - Revert "Remove wayland env set that no longer required" Change-Id: Ie1b03ca27556a0e0424bf7e63a28e59fd34876b7 Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 52d7364..5358085 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.3.11 +Version: 0.3.12 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 304dfdfb1bfc83592f3ec7de2c4c21e86e23c936 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 9 Jan 2018 17:39:59 +0900 Subject: [PATCH 03/16] Remove setting capabilities The capabilities are set by the set_capability script. Change-Id: I69b7f69daeb1af12351cba028de220f15c6bea48 Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 5358085..33e25f3 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -110,11 +110,7 @@ ln -sf ../launchpad-process-pool.service %{buildroot}%{_unitdir_user}/basic.targ %{_unitdir_user}/launchpad-process-pool.socket %{_unitdir_user}/sockets.target.wants/launchpad-process-pool.socket %{_unitdir_user}/basic.target.wants/launchpad-process-pool.service -%if 0%{?tizen_feature_priority_change} || 0%{?tizen_feature_loader_priority} -%caps(cap_mac_admin,cap_dac_override,cap_setgid,cap_sys_admin,cap_sys_nice=ei) %{_bindir}/launchpad-process-pool -%else -%caps(cap_mac_admin,cap_dac_override,cap_setgid,cap_sys_admin=ei) %{_bindir}/launchpad-process-pool -%endif +%{_bindir}/launchpad-process-pool %attr(0644,root,root) %{_libdir}/liblaunchpad.so.* %files devel @@ -126,8 +122,4 @@ ln -sf ../launchpad-process-pool.service %{buildroot}%{_unitdir_user}/basic.targ %manifest %{name}.manifest %license LICENSE %{_prefix}/share/aul/default.loader -%if 0%{?tizen_feature_priority_change} || 0%{?tizen_feature_loader_priority} -%caps(cap_setgid,cap_sys_admin,cap_sys_nice=ei) %{_bindir}/launchpad-loader -%else -%caps(cap_setgid,cap_sys_admin=ei) %{_bindir}/launchpad-loader -%endif +%{_bindir}/launchpad-loader -- 2.7.4 From 75105f9683e2f4665edc7c73fd2f3775caec05d4 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 10 Jan 2018 08:58:13 +0900 Subject: [PATCH 04/16] Release version 0.3.13 Changes: - Remove setting capabilities Change-Id: Iddd53f0cf1a39282fa776f1629c653235a71f92b Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 33e25f3..10a5700 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.3.12 +Version: 0.3.13 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 38e9524a303fed2373c4b48258ebefe4fd9c83a1 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 10 Jan 2018 14:33:55 +0900 Subject: [PATCH 05/16] Cleanup security context after application termination. security_manager_prepare_app() and security_manager_cleanup_app() are a pair of functions to setup/clean security context of application. Each application is launched in a separate mount namespace and linked to this namespace. Such design allows to change privacy privilege status at app runtime. After application termination this link should be removed. Change-Id: I96bb6b88d3822d736e2985c750ec5697165abef2 Signed-off-by: Hwankyu Jhun --- src/launchpad.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/launchpad.c b/src/launchpad.c index 7e79a65..31e6841 100755 --- a/src/launchpad.c +++ b/src/launchpad.c @@ -113,6 +113,7 @@ static int user_slot_offset; static GList *candidate_slot_list; static app_labels_monitor *label_monitor; static GList *launcher_info_list; +static GHashTable *__pid_table; static candidate_process_context_t *__add_slot(int type, int loader_id, int caller_pid, const char *loader_path, const char *extra, @@ -1050,6 +1051,7 @@ static gboolean __handle_sigchild(gpointer data) int fd = lc->gpollfd->fd; struct signalfd_siginfo siginfo; ssize_t s; + char *appid; do { s = read(fd, &siginfo, sizeof(struct signalfd_siginfo)); @@ -1060,6 +1062,15 @@ static gboolean __handle_sigchild(gpointer data) break; _signal_process_sigchld(&siginfo); + + appid = g_hash_table_lookup(__pid_table, + GINT_TO_POINTER(siginfo.ssi_pid)); + if (appid) { + security_manager_cleanup_app(appid, siginfo.ssi_uid); + g_hash_table_remove(__pid_table, + GINT_TO_POINTER(siginfo.ssi_pid)); + } + cpc = __find_slot_from_pid(siginfo.ssi_pid); if (cpc != NULL) { __reset_slot(cpc); @@ -1501,8 +1512,11 @@ end: if (clifd != -1) close(clifd); - if (pid > 0) + if (pid > 0) { _signal_send_app_launch_signal(pid, menu_info->appid); + g_hash_table_insert(__pid_table, GINT_TO_POINTER(pid), + strdup(menu_info->appid)); + } if (menu_info != NULL) _appinfo_free(menu_info); @@ -1863,11 +1877,21 @@ static int __before_loop(int argc, char **argv) if (ret < 0) _W("Failed to send cmd(%d) to amd", LAUNCHPAD_LAUNCH_SIGNAL); + __pid_table = g_hash_table_new_full(g_direct_hash, g_direct_equal, + NULL, free); + if (!__pid_table) { + _E("Failed to create pid table"); + return -1; + } + return 0; } static void __after_loop(void) { + if (__pid_table) + g_hash_table_destroy(__pid_table); + if (_send_cmd_to_amd(LAUNCHPAD_DEAD_SIGNAL) < 0) _W("Failed to send cmd(%d) to amd", LAUNCHPAD_DEAD_SIGNAL); -- 2.7.4 From 376a3cf6692d5a2f2c87e831951c583fbf2ab277 Mon Sep 17 00:00:00 2001 From: Semun Lee Date: Thu, 18 Jan 2018 14:07:16 +0900 Subject: [PATCH 06/16] Add printing log for dlopen failure Change-Id: I1d49786c392fea93933a50495015bfac97f04230 Signed-off-by: Semun Lee --- src/launchpad_loader.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/launchpad_loader.c b/src/launchpad_loader.c index 6ad6284..8e75181 100644 --- a/src/launchpad_loader.c +++ b/src/launchpad_loader.c @@ -202,6 +202,10 @@ static void __preload_lib(bundle *b) for (i = 0; i < len; i++) { handle = dlopen(so_array[i], RTLD_NOW | RTLD_NODELETE); _D("preload %s# - handle : %p", so_array[i], handle); + if (!handle) { + _E("failed to load: %s, err: %s", + so_array[i], dlerror()); + } } } -- 2.7.4 From 12d808b2432aa1a0fbe11be22572665ad78c0597 Mon Sep 17 00:00:00 2001 From: Semun Lee Date: Thu, 18 Jan 2018 16:01:31 +0900 Subject: [PATCH 07/16] Release version 0.3.14 Changes: - Cleanup security context after application termination. - Add printing log for dlopen failure Change-Id: Ie2a072de6ffde678902eab33d43adcfd4b47156e Signed-off-by: Semun Lee --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 10a5700..3ed4bbe 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.3.13 +Version: 0.3.14 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 3c79952d53697807181ad65ec0863adabde98831 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 23 Jan 2018 09:01:26 +0900 Subject: [PATCH 08/16] Fix a bug about infinite loop Change-Id: Id95750d4921462fce6dbd6120b122bc1d9752d0f Signed-off-by: Hwankyu Jhun --- src/launchpad.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/launchpad.c b/src/launchpad.c index 31e6841..6497113 100755 --- a/src/launchpad.c +++ b/src/launchpad.c @@ -1202,8 +1202,10 @@ static int __add_idle_checker(int detection_method, GList *cur) continue; } - if (detection_method == EVENT_BOOTING && !cpc->on_boot) + if (detection_method == EVENT_BOOTING && !cpc->on_boot) { + iter = g_list_next(iter); continue; + } if (cpc->pid == CANDIDATE_NONE && (detection_method == EVENT_BOOTING || -- 2.7.4 From f4d5046e916514d0c38a9ecaa2b3ed930da70f42 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 23 Jan 2018 10:43:20 +0900 Subject: [PATCH 09/16] Release version 0.3.15 Changes: - Fix a bug about infinite loop Change-Id: I4c5cb86b668286a632c7738e5443f0ca68170aee Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 3ed4bbe..88697ba 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.3.14 +Version: 0.3.15 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 441a127cb06c3f04e2c65de0d55d1f1a2631f7f7 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 24 Jan 2018 17:45:26 +0900 Subject: [PATCH 10/16] Adjust the timing of the loader creation If the application is not installed, the launchpad doesn't prepare the loader processes. Change-Id: I7db937b1bed93c7689f0b944cc16fabc071ba458 Signed-off-by: Hwankyu Jhun --- inc/key.h | 1 + inc/launchpad_common.h | 1 + inc/loader_info.h | 8 +++- src/launchpad.c | 119 ++++++++++++++++++++++++++++++++++++++++++++++--- src/loader_info.c | 28 ++++++++++++ 5 files changed, 149 insertions(+), 8 deletions(-) diff --git a/inc/key.h b/inc/key.h index 7401ace..b75bc38 100644 --- a/inc/key.h +++ b/inc/key.h @@ -47,6 +47,7 @@ extern "C" { #define AUL_K_HIGHPRIORITY "__AUL_HIGHPRIORITY__" #define AUL_K_IS_GLOBAL "__AUL_IS_GLOBAL__" #define AUL_K_TEP_PATH "__AUL_TEP_PATH__" +#define AUL_K_IS_INSTALLED "__AUL_IS_INSTALLED__" #ifdef __cplusplus } diff --git a/inc/launchpad_common.h b/inc/launchpad_common.h index dcfcac6..102fa5a 100644 --- a/inc/launchpad_common.h +++ b/inc/launchpad_common.h @@ -47,6 +47,7 @@ #define PAD_CMD_MAKE_DEFAULT_SLOTS 13 #define PAD_CMD_DEMAND 14 #define PAD_CMD_PING 15 +#define PAD_CMD_UPDATE_APP_TYPE 16 #define LAUNCHPAD_LAUNCH_SIGNAL 83 #define LAUNCHPAD_DEAD_SIGNAL 61 diff --git a/inc/loader_info.h b/inc/loader_info.h index 493cdf6..5a7e298 100644 --- a/inc/loader_info.h +++ b/inc/loader_info.h @@ -41,12 +41,16 @@ typedef struct _loader_info { int cpu_threshold_min; bool on_boot; bool global; + bool app_exists; } loader_info_t; +typedef void (*loader_info_foreach_cb)(loader_info_t *info, void *data); + 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); - - +int _loader_info_foreach(GList *info, loader_info_foreach_cb callback, + void *data); +bool _loader_info_exist_app_type(loader_info_t *info, const char *app_type); diff --git a/src/launchpad.c b/src/launchpad.c index 6497113..2d0e01e 100755 --- a/src/launchpad.c +++ b/src/launchpad.c @@ -87,6 +87,7 @@ typedef struct { int threshold_min; int cur_event; bool on_boot; + bool app_exists; } candidate_process_context_t; typedef struct { @@ -107,6 +108,11 @@ struct app_arg { char **argv; }; +struct app_info { + const char *type; + bool exists; +}; + static int __sys_hwacc; static GList *loader_info_list; static int user_slot_offset; @@ -118,7 +124,8 @@ static GHashTable *__pid_table; 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, - int threshold_max, int threshold_min, bool on_boot); + int threshold_max, int threshold_min, bool on_boot, + bool app_exists); static int __remove_slot(int type, int loader_id); static int __add_default_slots(void); static gboolean __handle_idle_checker(gpointer data); @@ -1207,6 +1214,11 @@ static int __add_idle_checker(int detection_method, GList *cur) continue; } + if (!cpc->app_exists) { + iter = g_list_next(iter); + continue; + } + if (cpc->pid == CANDIDATE_NONE && (detection_method == EVENT_BOOTING || (cpc->detection_method & detection_method))) { @@ -1259,8 +1271,10 @@ static int __dispatch_cmd_add_loader(bundle *kb) cpc = __add_slot(LAUNCHPAD_TYPE_DYNAMIC, lid, atoi(caller_pid), add_slot_str, extra, METHOD_TIMEOUT | METHOD_VISIBILITY, 2000, - DEFAULT_CPU_THRESHOLD_MAX, DEFAULT_CPU_THRESHOLD_MIN, - false); + DEFAULT_CPU_THRESHOLD_MAX, + DEFAULT_CPU_THRESHOLD_MIN, + false, + true); __set_timer(cpc); return lid; } @@ -1354,6 +1368,86 @@ static candidate_process_context_t *__find_available_slot(const char *hwacc, return NULL; } +static void __update_slot(int type, bool app_exists) +{ + candidate_process_context_t *cpc; + unsigned long long total = 0; + unsigned long long idle = 0; + + cpc = __find_slot(type, PAD_LOADER_ID_STATIC); + if (!cpc) + return; + + cpc->app_exists = app_exists; + if (!cpc->app_exists) { + if (cpc->pid > 0) { + if (cpc->source > 0) + g_source_remove(cpc->source); + if (cpc->timer > 0) + g_source_remove(cpc->timer); + if (cpc->idle_checker > 0) + g_source_remove(cpc->idle_checker); + if (cpc->send_fd > 0) + close(cpc->send_fd); + _D("Dispose candidate process %d", cpc->pid); + __kill_process(cpc->pid); + __reset_slot(cpc); + } + } else { + if (cpc->pid == CANDIDATE_NONE && + cpc->idle_checker == 0) { + _get_cpu_idle(&total, &idle); + cpc->cpu_idle_time = idle; + cpc->cpu_total_time = total; + _D("Add idle checker"); + cpc->idle_checker = g_timeout_add(CPU_CHECKER_TIMEOUT, + __handle_idle_checker, + g_list_find(candidate_slot_list, cpc)); + } + } +} + +static void __foreach_loader_info(loader_info_t *info, void *data) +{ + struct app_info *ai = (struct app_info *)data; + bool exist; + + exist = _loader_info_exist_app_type(info, ai->type); + if (!exist) + return; + + info->app_exists = ai->exists; + __update_slot(info->type, info->app_exists); +} + +static int __dispatch_cmd_update_app_type(bundle *b) +{ + int r; + struct app_info info; + const char *is_installed; + + info.type = bundle_get_val(b, AUL_K_APP_TYPE); + if (!info.type) + return -1; + + is_installed = bundle_get_val(b, AUL_K_IS_INSTALLED); + if (is_installed && !strcmp(is_installed, "true")) + info.exists = true; + else + info.exists = false; + + _I("[LAUNCHPAD] type(%s), exists(%d)", info.type, info.exists); + + r = _loader_info_foreach(loader_info_list, __foreach_loader_info, + &info); + if (r != 0) { + _E("Failed to retrieve loader info"); + return -1; + } + + return 0; +} + static gboolean __handle_launch_event(gpointer data) { loader_context_t *lc = (loader_context_t *) data; @@ -1426,6 +1520,11 @@ static gboolean __handle_launch_event(gpointer data) __real_send(clifd, 0); clifd = -1; goto end; + case PAD_CMD_UPDATE_APP_TYPE: + __dispatch_cmd_update_app_type(kb); + close(clifd); + clifd = -1; + goto end; } INIT_PERF(kb); @@ -1536,7 +1635,8 @@ end: static candidate_process_context_t *__add_slot(int type, int loader_id, int caller_pid, const char *loader_path, const char *loader_extra, int detection_method, - int timeout_val, int threshold_max, int threshold_min, bool on_boot) + int timeout_val, int threshold_max, int threshold_min, + bool on_boot, bool app_exists) { candidate_process_context_t *cpc; int fd = -1; @@ -1570,6 +1670,7 @@ static candidate_process_context_t *__add_slot(int type, int loader_id, cpc->threshold_max = threshold_max; cpc->threshold_min = threshold_min; cpc->on_boot = on_boot; + cpc->app_exists = app_exists; fd = __listen_candidate_process(cpc->type, cpc->loader_id); if (fd == -1) { @@ -1764,7 +1865,10 @@ static void __add_slot_from_info(gpointer data, gpointer user_data) cpc = __add_slot(LAUNCHPAD_TYPE_USER + user_slot_offset, PAD_LOADER_ID_DIRECT, 0, info->exe, NULL, 0, 0, - info->cpu_threshold_max, info->cpu_threshold_min, false); + info->cpu_threshold_max, + info->cpu_threshold_min, + false, + info->app_exists); if (cpc == NULL) return; @@ -1784,7 +1888,10 @@ static void __add_slot_from_info(gpointer data, gpointer user_data) PAD_LOADER_ID_STATIC, 0, info->exe, (char *)extra, info->detection_method, info->timeout_val, - info->cpu_threshold_max, info->cpu_threshold_min, info->on_boot); + info->cpu_threshold_max, + info->cpu_threshold_min, + info->on_boot, + info->app_exists); if (cpc == NULL) return; diff --git a/src/loader_info.c b/src/loader_info.c index 5d2e327..e48ffef 100644 --- a/src/loader_info.c +++ b/src/loader_info.c @@ -67,6 +67,7 @@ static loader_info_t *__create_loader_info() info->cpu_threshold_max = DEFAULT_CPU_THRESHOLD_MAX; info->cpu_threshold_min = DEFAULT_CPU_THRESHOLD_MIN; info->on_boot = true; + info->app_exists = false; return info; } @@ -442,5 +443,32 @@ int *_loader_get_alternative_types(GList *info, int type, int *len) return NULL; } +int _loader_info_foreach(GList *info, loader_info_foreach_cb callback, + void *data) +{ + GList *cur; + loader_info_t *i; + + if (!info || !callback) + return -1; + + cur = info; + while (cur) { + i = (loader_info_t *)cur->data; + callback(i, data); + cur = g_list_next(cur); + } + + return 0; +} + +bool _loader_info_exist_app_type(loader_info_t *info, const char *app_type) +{ + GList *list; + list = g_list_find_custom(info->app_types, app_type, __comp_str); + if (list) + return true; + return false; +} -- 2.7.4 From 7cf2f78188f5538b4e81b7838ab201147c2f12ba Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 25 Jan 2018 20:02:11 +0900 Subject: [PATCH 11/16] Release version 0.3.16 Changes: - Adjust the timing of the loader creation Change-Id: Iddbed5e3d3b5c97dcc8730ef719149f7f562b6d5 Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 88697ba..b25fbff 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.3.15 +Version: 0.3.16 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 8f596cef71762fb7d3b4bde4a020f57f23bebc82 Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Fri, 26 Jan 2018 12:54:59 +0900 Subject: [PATCH 12/16] Make a flag for on-boot - The new flag 'touched' was added for supporting ON_BOOT feature - 'cur_event' should be also initialized Change-Id: Iedbf6d2087de97228efd22eb642f6531e5f82426 Signed-off-by: Junghoon Park --- src/launchpad.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/launchpad.c b/src/launchpad.c index 2d0e01e..5fe0aba 100755 --- a/src/launchpad.c +++ b/src/launchpad.c @@ -63,7 +63,6 @@ #define PAD_ERR_INVALID_PATH -4 #define CPU_CHECKER_TIMEOUT 1000 #define PI 3.14159265 -#define EVENT_BOOTING -1 typedef struct { int type; @@ -88,6 +87,7 @@ typedef struct { int cur_event; bool on_boot; bool app_exists; + bool touched; } candidate_process_context_t; typedef struct { @@ -1183,6 +1183,7 @@ static gboolean __handle_idle_checker(gpointer data) __update_threshold(cpc, -0.02f * (per - cpc->threshold)); __prepare_candidate_process(cpc->type, cpc->loader_id); cpc->idle_checker = 0; + cpc->touched = true; __add_idle_checker(cpc->cur_event, g_list_next(list)); return G_SOURCE_REMOVE; } @@ -1209,7 +1210,7 @@ static int __add_idle_checker(int detection_method, GList *cur) continue; } - if (detection_method == EVENT_BOOTING && !cpc->on_boot) { + if (!cpc->touched && !cpc->on_boot) { iter = g_list_next(iter); continue; } @@ -1220,7 +1221,7 @@ static int __add_idle_checker(int detection_method, GList *cur) } if (cpc->pid == CANDIDATE_NONE && - (detection_method == EVENT_BOOTING || + (!cpc->touched || (cpc->detection_method & detection_method))) { if (cpc->timer > 0) { g_source_remove(cpc->timer); @@ -1671,6 +1672,8 @@ static candidate_process_context_t *__add_slot(int type, int loader_id, cpc->threshold_min = threshold_min; cpc->on_boot = on_boot; cpc->app_exists = app_exists; + cpc->touched = false; + cpc->cur_event = 0; fd = __listen_candidate_process(cpc->type, cpc->loader_id); if (fd == -1) { @@ -1911,7 +1914,7 @@ static int __add_default_slots(void) user_slot_offset = 0; g_list_foreach(loader_info_list, __add_slot_from_info, NULL); - __add_idle_checker(EVENT_BOOTING, candidate_slot_list); + __add_idle_checker(0, candidate_slot_list); return 0; } -- 2.7.4 From 0a8855111214b01fe872d9019800851dbac864f9 Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Fri, 26 Jan 2018 13:36:02 +0900 Subject: [PATCH 13/16] Release version 0.3.17 Changes: - Make a flag for on-boot Change-Id: I0f20d09dea34b34cc39879aad5d0e5010a0bd4e2 Signed-off-by: Junghoon Park --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index b25fbff..d2f6088 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.3.16 +Version: 0.3.17 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 43d2e2e5d1991bd29c2bee449c761343ee9ca935 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 31 Jan 2018 16:07:23 +0900 Subject: [PATCH 14/16] Fix a bug about onboot option Change-Id: Iae608408db233a362f235d626efbcf33a653350b Signed-off-by: Hwankyu Jhun --- src/launchpad.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/launchpad.c b/src/launchpad.c index 5fe0aba..49f2f81 100755 --- a/src/launchpad.c +++ b/src/launchpad.c @@ -1395,6 +1395,9 @@ static void __update_slot(int type, bool app_exists) __reset_slot(cpc); } } else { + if (!cpc->touched && !cpc->on_boot) + return; + if (cpc->pid == CANDIDATE_NONE && cpc->idle_checker == 0) { _get_cpu_idle(&total, &idle); -- 2.7.4 From 8394ed5e97777eeb54c033408ac87f5b08321611 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 31 Jan 2018 17:00:32 +0900 Subject: [PATCH 15/16] Release version 0.3.18 Changes: - Fix a bug about onboot option Change-Id: I81ed64051d85bd029a7adc98c52bd5028fab8298 Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index d2f6088..d73407d 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.3.17 +Version: 0.3.18 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From eb5262ef251576c2b95b211455ad7c09fb2d9d38 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 8 Feb 2018 11:16:34 +0900 Subject: [PATCH 16/16] Fix a bug about updating slot info Change-Id: I62b2777173f07cf2e9455864fe9119797a4ca358 Signed-off-by: Hwankyu Jhun --- src/launchpad.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/launchpad.c b/src/launchpad.c index 49f2f81..175e503 100755 --- a/src/launchpad.c +++ b/src/launchpad.c @@ -1398,6 +1398,11 @@ static void __update_slot(int type, bool app_exists) if (!cpc->touched && !cpc->on_boot) return; + if (cpc->timer > 0) { + g_source_remove(cpc->timer); + cpc->timer = 0; + } + if (cpc->pid == CANDIDATE_NONE && cpc->idle_checker == 0) { _get_cpu_idle(&total, &idle); -- 2.7.4