From 4824302b43cacecebf84bc7c597052cf834366c9 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 15 Jun 2018 17:43:16 +0900 Subject: Add a new dectection method METHOD_INSTALL is added to handle slot update events. The loader creation must be sequential. Change-Id: I3d279999ab342b84b2056ac0ce242d24cdb4b8e6 Signed-off-by: Hwankyu Jhun --- inc/loader_info.h | 1 + src/launchpad.c | 21 +++++++++++++++++++-- src/loader_info.c | 4 +++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/inc/loader_info.h b/inc/loader_info.h index 3e650af..2245107 100644 --- a/inc/loader_info.h +++ b/inc/loader_info.h @@ -31,6 +31,7 @@ enum loader_method_e { METHOD_AVAILABLE_MEMORY = 0x0020, METHOD_TTL = 0x0040, METHOD_OUT_OF_MEMORY = 0x0100, + METHOD_INSTALL = 0x0200, }; typedef struct _loader_info { diff --git a/src/launchpad.c b/src/launchpad.c index ebc4d29..cabc266 100755 --- a/src/launchpad.c +++ b/src/launchpad.c @@ -131,6 +131,7 @@ static app_labels_monitor *label_monitor; static GList *launcher_info_list; static GHashTable *__pid_table; static int __memory_status; +static guint __timer; static candidate_process_context_t *__add_slot(int type, int loader_id, int caller_pid, const char *loader_path, const char *extra, @@ -1424,6 +1425,14 @@ static candidate_process_context_t *__find_available_slot(const char *hwacc, return NULL; } +static gboolean __handle_slot_update(gpointer data) +{ + _D("[__LAUNCHPAD__] Handle slot update"); + __add_idle_checker(METHOD_INSTALL, candidate_slot_list); + __timer = 0; + return G_SOURCE_REMOVE; +} + static void __update_slot(int type, bool app_exists) { candidate_process_context_t *cpc; @@ -1449,8 +1458,13 @@ static void __update_slot(int type, bool app_exists) } if (cpc->pid == CANDIDATE_NONE && - cpc->idle_checker == 0) - __set_idle_checker_timer(cpc); + cpc->idle_checker == 0) { + if (__timer) + g_source_remove(__timer); + + __timer = g_timeout_add(500, + __handle_slot_update, NULL); + } } } @@ -2139,6 +2153,9 @@ static int __before_loop(int argc, char **argv) static void __after_loop(void) { + if (__timer) + g_source_remove(__timer); + __unregister_vconf_events(); if (__pid_table) g_hash_table_destroy(__pid_table); diff --git a/src/loader_info.c b/src/loader_info.c index 2150119..8fd9a8f 100644 --- a/src/loader_info.c +++ b/src/loader_info.c @@ -68,7 +68,8 @@ static loader_info_t *__create_loader_info() info->app_types = NULL; info->hw_acc = NULL; info->alternative_loaders = NULL; - info->detection_method = METHOD_TIMEOUT | METHOD_VISIBILITY; + info->detection_method = METHOD_TIMEOUT | METHOD_VISIBILITY | + METHOD_INSTALL; info->timeout_val = 5000; info->extra = bundle_create(); info->cpu_threshold_max = DEFAULT_CPU_THRESHOLD_MAX; @@ -100,6 +101,7 @@ static void __parse_detection_method(loader_info_t *info, char *line) token = strtok_r(NULL, " |\t\r\n", &savedptr); } + info->detection_method |= METHOD_INSTALL; _D("detection_method:%d", info->detection_method); } -- cgit v1.2.3