void *user_data;
};
+struct load_retry_info {
+ uid_t uid;
+ unsigned int retrying_cnt;
+ guint timer;
+};
+
static pkgmgr_client *pc;
static GHashTable *user_tbl;
static GHashTable *pkg_pending;
static GList *app_event_list;
static int gles = 1;
+static struct load_retry_info __load_retry_info;
static void __free_appinfo_splash_image(gpointer data)
{
pkgmgr_client_free(pc);
}
+static gboolean __retry_appinfo_load_cb(gpointer data)
+{
+ struct load_retry_info *info = (struct load_retry_info *)data;
+
+ info->retrying_cnt++;
+ _E("Retrying count: %u", info->retrying_cnt);
+
+ if (_appinfo_load(info->uid) == 0) {
+ info->retrying_cnt = 0;
+ info->timer = 0;
+ return G_SOURCE_REMOVE;
+ }
+
+ if (info->retrying_cnt == 20) {
+ _E("Failed to load appinfo. uid(%u)", info->uid);
+ exit(-1);
+ return G_SOURCE_REMOVE;
+ }
+
+ return G_SOURCE_CONTINUE;
+}
+
+static void __retry_to_load_appinfo(uid_t uid) {
+ __load_retry_info.uid = uid;
+ if (__load_retry_info.timer != 0)
+ return;
+
+ __load_retry_info.timer = g_timeout_add(5000, __retry_appinfo_load_cb,
+ &__load_retry_info);
+}
+
+static void __dispose_retry_info() {
+ if (__load_retry_info.timer) {
+ g_source_remove(__load_retry_info.timer);
+ __load_retry_info.timer = 0;
+ }
+
+ __load_retry_info.retrying_cnt = 0;
+}
+
static int __dispatch_amd_reload_appinfo(request_h req)
{
uid_t uid = _request_get_target_uid(req);
} else {
info = __create_user_appinfo(uid);
if (!info) {
+ __retry_to_load_appinfo(uid);
_request_send_result(req, -1);
return -1;
}
_E("Failed to get installed list. uid(%u), error(%d)",
uid, ret);
__remove_user_appinfo(uid);
+ __retry_to_load_appinfo(uid);
} else {
_noti_send(AMD_NOTI_MSG_APPINFO_RELOAD, (int)uid, 0, NULL,
NULL);
+ __dispose_retry_info();
}
_request_send_result(req, ret);
info = __add_user_appinfo(uid);
if (info == NULL) {
_W("Failed to load appinfo - %d", uid);
+ __retry_to_load_appinfo(uid);
return -1;
}
+ __dispose_retry_info();
_noti_send(AMD_NOTI_MSG_APPINFO_LOAD, (int)uid, 0, NULL, NULL);
_D("loaded appinfo table for uid(%d)", uid);
return 0;