bool debug_mode;
guint timer;
int real_pid;
+ guint startup_timer;
+ int delay_count;
guint disconn_timer;
};
g_source_remove(app_status->timer);
if (app_status->disconn_timer)
g_source_remove(app_status->disconn_timer);
+ if (app_status->startup_timer)
+ g_source_remove(app_status->startup_timer);
free(app_status);
}
int _app_status_add_app_info(const struct appinfo *ai, int pid,
bool is_subapp, uid_t uid, int caller_pid,
bool bg_launch, const char *instance_id,
- bool debug_mode)
+ bool debug_mode, bool pending)
{
GSList *iter;
GSList *iter_next;
_noti_send(AMD_NOTI_MSG_APP_STATUS_ADD, 0, 0, app_status, NULL);
app_status_list = g_slist_append(app_status_list, app_status);
__add_pkg_status(app_status);
+ if (pending)
+ _app_status_set_startup_timer(app_status);
return 0;
}
return true;
}
+static gboolean __startup_timeout_cb(gpointer data)
+{
+ const char *appid;
+ pid_t pid;
+ int delay_count;
+
+ app_status_h app_status = (app_status_h)data;
+ if (app_status == NULL)
+ return G_SOURCE_REMOVE;
+
+ appid = _app_status_get_appid(app_status);
+ pid = _app_status_get_pid(app_status);
+ delay_count = _app_status_get_delay_count(app_status);
+
+ _E("App(%s[%d]) hasn't run main loop yet. delay_count(%d)",
+ appid, pid, delay_count);
+
+ _app_status_increase_delay_count(app_status);
+ return G_SOURCE_CONTINUE;
+}
+
int _app_status_usr_init(uid_t uid)
{
inotify_watch_info_h handle;
component_type = _appinfo_get_value(ai, AIT_COMPTYPE);
_app_status_add_app_info(ai, pid, false, uid, getpid(),
- false, NULL, false);
+ false, NULL, false, false);
_noti_send(AMD_NOTI_MSG_APP_STATUS_APP_REGISTER_PID, pid, 0, ai, NULL);
if (component_type && strcmp(component_type, APP_TYPE_SERVICE) != 0) {
ret = _signal_get_proc_status_async(pid,
return app_status->is_subapp;
}
+
+int _app_status_set_startup_timer(app_status_h app_status)
+{
+ if (!app_status)
+ return -1;
+
+
+ if (app_status->startup_timer > 0) {
+ _W("Already set");
+ return 0;
+ }
+
+ app_status->startup_timer = g_timeout_add(10 * 1000,
+ __startup_timeout_cb, app_status);
+ if (app_status->startup_timer == 0) {
+ _E("Failed to set timer");
+ return -1;
+ }
+
+ return 0;
+}
+
+void _app_status_unset_startup_timer(app_status_h app_status)
+{
+ if (!app_status || app_status->startup_timer == 0)
+ return;
+
+ g_source_remove(app_status->startup_timer);
+ app_status->startup_timer = 0;
+}
+
+int _app_status_get_delay_count(app_status_h app_status)
+{
+ if (!app_status)
+ return -1;
+
+ return app_status->delay_count;
+}
+
+int _app_status_increase_delay_count(app_status_h app_status)
+{
+ if (!app_status)
+ return -1;
+
+ app_status->delay_count++;
+ return 0;
+}
int _app_status_add_app_info(const struct appinfo *ai, int pid,
bool is_subapp, uid_t uid, int caller_pid,
bool bg_launch, const char *instance_id,
- bool debug_mode);
+ bool debug_mode, bool pending);
int _app_status_remove_all_app_info_with_uid(uid_t uid);
bool _app_status_is_subapp(app_status_h app_status);
+int _app_status_set_startup_timer(app_status_h app_status);
+
+void _app_status_unset_startup_timer(app_status_h app_status);
+
+int _app_status_get_delay_count(app_status_h app_status);
+
+int _app_status_increase_delay_count(app_status_h app_status);
+
#ifdef __cplusplus
}
#endif
return -1;
_app_status_update_is_starting(app_status, true);
+ _app_status_unset_startup_timer(app_status);
if (_app_status_get_app_type(app_status) == AT_UI_APP &&
_app_status_get_status(app_status) != STATUS_VISIBLE)
__launch_add_fgmgr(pid);
_app_status_add_app_info(handle->ai, handle->pid, handle->is_subapp,
target_uid, caller_pid, handle->bg_launch,
- handle->instance_id, handle->debug_mode);
+ handle->instance_id, handle->debug_mode,
+ handle->new_process);
_comp_status_add_comp_info(handle->ci, handle->pid, handle->instance_id,
handle->is_subapp);