Add a new tag for loader 11/230011/2
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 7 Apr 2020 06:26:43 +0000 (15:26 +0900)
committerHwanKyu Jhun <h.jhun@samsung.com>
Wed, 8 Apr 2020 02:09:51 +0000 (02:09 +0000)
If "APP_CHECK" is "OFF", the launchpad doesn't check whether the
application is installed or not.

Change-Id: I74aa5c02429c945194113a8a29649d71bf068256
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/launchpad/inc/loader_info.h
src/launchpad/src/launchpad.c
src/launchpad/src/loader_info.c

index 5111519..e3ae865 100644 (file)
@@ -53,6 +53,7 @@ typedef struct _loader_info {
        int deactivation_method;
        unsigned int ttl;
        bool is_hydra;
+       bool app_check;
 } loader_info_t;
 
 typedef void (*loader_info_foreach_cb)(loader_info_t *info, void *data);
index 79ac8f6..a5931f2 100644 (file)
@@ -116,6 +116,7 @@ typedef struct {
        guint live_timer;
        int state;
        bool is_hydra;
+       bool app_check;
        io_channel_h client_channel;
        io_channel_h channel;
        io_channel_h hydra_channel;
@@ -178,7 +179,7 @@ static candidate_process_context_t *__add_slot(int type, int loader_id,
                int detection_method, int activation_method,
                int deactivation_method, unsigned int ttl, int timeout_val,
                int threshold_max, int threshold_min, bool on_boot,
-               bool app_exists, bool is_hydra);
+               bool app_exists, bool is_hydra, bool app_check);
 static int __remove_slot(int type, int loader_id);
 static int __add_default_slots(void);
 static gboolean __handle_idle_checker(gpointer data);
@@ -211,7 +212,7 @@ static gboolean __handle_queuing_slots(gpointer data)
                return G_SOURCE_REMOVE;;
        }
 
-       if (!cpc->app_exists) {
+       if (cpc->app_check && !cpc->app_exists) {
                _W("The application is not installed. Type(%d)", cpc->type);
                return G_SOURCE_CONTINUE;
        }
@@ -1601,7 +1602,7 @@ static gboolean __handle_idle_checker(gpointer data)
        }
 
        cpc = (candidate_process_context_t *)data;
-       if (!cpc->app_exists) {
+       if (cpc->app_check && !cpc->app_exists) {
                _W("The application is not installed. Type(%d)", cpc->type);
                __sequencer.idle_checker = 0;
                __sequencer.running_cpc = NULL;
@@ -1660,7 +1661,7 @@ static int __add_idle_checker(int detection_method, GList *cur)
                        continue;
                }
 
-               if (!cpc->app_exists) {
+               if (cpc->app_check && !cpc->app_exists) {
                        iter = g_list_next(iter);
                        continue;
                }
@@ -1729,7 +1730,9 @@ static int __dispatch_cmd_add_loader(bundle *kb)
                                DEFAULT_CPU_THRESHOLD_MAX,
                                DEFAULT_CPU_THRESHOLD_MIN,
                                false,
-                               true, 0);
+                               true,
+                               false,
+                               true);
                __set_timer(cpc);
                free(loader_name);
                return lid;
@@ -1776,7 +1779,9 @@ static int __dispatch_cmd_add_app_defined_loader(bundle *kb)
                                DEFAULT_CPU_THRESHOLD_MAX,
                                DEFAULT_CPU_THRESHOLD_MIN,
                                false,
-                               true, 0);
+                               true,
+                               false,
+                               true);
                if (cpc == NULL) {
                        _E("cpc is NULL");
                        bundle_free_encoded_rawdata(&extra);
@@ -1887,7 +1892,7 @@ static void __update_slot(int type, bool app_exists)
                return;
 
        cpc->app_exists = app_exists;
-       if (!cpc->app_exists) {
+       if (cpc->app_check && !cpc->app_exists) {
                if (cpc->pid > 0)
                        __dispose_candidate_process(cpc);
                __sequencer_remove_slot(cpc);
@@ -1971,7 +1976,7 @@ static void __activate_slot(candidate_process_context_t *cpc)
        if (!cpc->touched && !cpc->on_boot)
                return;
 
-       if (!cpc->app_exists || cpc->pid > CANDIDATE_NONE)
+       if ((cpc->app_check && !cpc->app_exists) || cpc->pid > CANDIDATE_NONE)
                return;
 
        if (cpc->detection_method & METHOD_TIMEOUT)
@@ -2161,7 +2166,7 @@ static bool __handle_launch_event(int fd, io_condition_e cond, void *data)
                _W("Launch directly %d %p", loader_id, cpc);
                pid = __launch_directly(menu_info->appid, app_path, clifd, kb,
                                menu_info, NULL);
-               if (org_cpc && org_cpc->app_exists &&
+               if (org_cpc && (!org_cpc->app_check || org_cpc->app_exists) &&
                                org_cpc->pid == CANDIDATE_NONE &&
                                !__sequencer_slot_exist(org_cpc)) {
                        if (org_cpc->timer > 0) {
@@ -2232,7 +2237,7 @@ static candidate_process_context_t *__create_slot(int type, int loader_id,
                int activation_method, int deactivation_method,
                unsigned int ttl, int timeout_val,
                int threshold_max, int threshold_min,
-               bool on_boot, bool app_exists, bool is_hydra)
+               bool on_boot, bool app_exists, bool is_hydra, bool app_check)
 {
        candidate_process_context_t *cpc;
 
@@ -2290,6 +2295,7 @@ static candidate_process_context_t *__create_slot(int type, int loader_id,
        cpc->ttl = ttl;
        cpc->live_timer = 0;
        cpc->is_hydra = is_hydra;
+       cpc->app_check = app_check;
        cpc->score = WIN_SCORE;
        cpc->pss = 0;
 
@@ -2308,7 +2314,7 @@ static candidate_process_context_t *__add_slot(int type, int loader_id,
                int activation_method, int deactivation_method,
                unsigned int ttl, int timeout_val,
                int threshold_max, int threshold_min,
-               bool on_boot, bool app_exists, bool is_hydra)
+               bool on_boot, bool app_exists, bool is_hydra, bool app_check)
 {
        candidate_process_context_t *cpc;
        int fd;
@@ -2325,7 +2331,7 @@ static candidate_process_context_t *__add_slot(int type, int loader_id,
                        activation_method, deactivation_method,
                        ttl, timeout_val,
                        threshold_max, threshold_min,
-                       on_boot, app_exists, is_hydra);
+                       on_boot, app_exists, is_hydra, app_check);
        if (cpc == NULL)
                return NULL;
 
@@ -2614,7 +2620,9 @@ static void __add_slot_from_info(gpointer data, gpointer user_data)
                                info->cpu_threshold_max,
                                info->cpu_threshold_min,
                                false,
-                               info->app_exists, info->is_hydra);
+                               info->app_exists,
+                               info->is_hydra,
+                               info->app_check);
                if (cpc == NULL)
                        return;
 
@@ -2641,7 +2649,9 @@ static void __add_slot_from_info(gpointer data, gpointer user_data)
                                info->cpu_threshold_max,
                                info->cpu_threshold_min,
                                info->on_boot,
-                               info->app_exists, info->is_hydra);
+                               info->app_exists,
+                               info->is_hydra,
+                               info->app_check);
                if (cpc == NULL)
                        return;
 
index 2c5c5da..3493366 100644 (file)
@@ -42,6 +42,7 @@
 #define TAG_CPU_THRESHOLD_MIN          "CPU_THRESHOLD_MIN"
 #define TAG_ON_BOOT                    "ON_BOOT"
 #define TAG_HYDRA                      "HYDRA"
+#define TAG_APP_CHECK                   "APP_CHECK"
 
 #define VAL_ON                         "ON"
 #define VAL_OFF                                "OFF"
@@ -84,6 +85,7 @@ static loader_info_t *__create_loader_info()
        info->deactivation_method = 0;
        info->ttl = 600; /* 10 minutes */
        info->is_hydra = false;
+       info->app_check = true;
 
        return info;
 }
@@ -305,6 +307,9 @@ static GList *__parse_file(GList *list, const char *path)
                        } else {
                                cur_info->is_hydra = 0;
                        }
+               } else if (strcasecmp(TAG_APP_CHECK, tok1) == 0) {
+                       if (tok2 && strcasecmp(VAL_OFF, tok2) == 0)
+                               cur_info->app_check = false;
                }
        }