int threshold_max;
int threshold_min;
int cur_event;
+ bool on_boot;
} candidate_process_context_t;
typedef struct {
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);
+ int threshold_max, int threshold_min, bool on_boot);
static int __remove_slot(int type, int loader_id);
static int __add_default_slots(void);
static gboolean __handle_idle_checker(gpointer data);
continue;
}
+ if (detection_method == EVENT_BOOTING && !cpc->on_boot)
+ continue;
+
if (cpc->pid == CANDIDATE_NONE &&
(detection_method == EVENT_BOOTING ||
(cpc->detection_method & detection_method))) {
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);
+ DEFAULT_CPU_THRESHOLD_MAX, DEFAULT_CPU_THRESHOLD_MIN,
+ false);
__set_timer(cpc);
return lid;
}
}
static candidate_process_context_t *__find_available_slot(const char *hwacc,
- const char *app_type, const char *loader_name)
+ const char *app_type, const char *loader_name,
+ candidate_process_context_t **org_cpc)
{
int type;
candidate_process_context_t *cpc;
if (!cpc)
return NULL;
+ *org_cpc = cpc;
+
if (cpc->prepared)
return cpc;
app_pkt_t *pkt = NULL;
appinfo_t *menu_info = NULL;
candidate_process_context_t *cpc = NULL;
+ candidate_process_context_t *org_cpc = NULL;
const char *app_path = NULL;
int pid = -1;
int clifd = -1;
if (loader_id <= PAD_LOADER_ID_STATIC) {
cpc = __find_available_slot(menu_info->hwacc,
menu_info->app_type,
- menu_info->loader_name);
+ menu_info->loader_name, &org_cpc);
} else {
type = LAUNCHPAD_TYPE_DYNAMIC;
cpc = __find_slot(type, loader_id);
_W("Launch directly %d %p", loader_id, cpc);
pid = __launch_directly(menu_info->appid, app_path, clifd, kb,
menu_info, NULL);
+ if (org_cpc) {
+ if (org_cpc->timer > 0) {
+ g_source_remove(org_cpc->timer);
+ org_cpc->timer = 0;
+ }
+
+ if (org_cpc->idle_checker > 0) {
+ g_source_remove(org_cpc->idle_checker);
+ org_cpc->idle_checker = 0;
+ }
+
+ __set_timer(org_cpc);
+ }
} else {
_W("Launch %d type process", cpc->type);
pid = __send_launchpad_loader(cpc, pkt, app_path, clifd);
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)
+ int timeout_val, int threshold_max, int threshold_min, bool on_boot)
{
candidate_process_context_t *cpc;
int fd = -1;
cpc->threshold = threshold_max;
cpc->threshold_max = threshold_max;
cpc->threshold_min = threshold_min;
+ cpc->on_boot = on_boot;
fd = __listen_candidate_process(cpc->type, cpc->loader_id);
if (fd == -1) {
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);
+ info->cpu_threshold_max, info->cpu_threshold_min, false);
if (cpc == NULL)
return;
PAD_LOADER_ID_STATIC,
0, info->exe, (char *)extra,
info->detection_method, info->timeout_val,
- info->cpu_threshold_max, info->cpu_threshold_min);
+ info->cpu_threshold_max, info->cpu_threshold_min, info->on_boot);
if (cpc == NULL)
return;