Fix a launch bug at installation 72/12972/1
authorJaeho Lee <jaeho81.lee@samsung.com>
Sat, 12 Oct 2013 05:41:24 +0000 (14:41 +0900)
committerSunwook Bae <sunwook45.bae@samsung.com>
Wed, 27 Nov 2013 05:02:14 +0000 (14:02 +0900)
Change-Id: I51e944de3bc6647f425ace0a6ea48c50b43dc5ff
Signed-off-by: Sunwook Bae <sunwook45.bae@samsung.com>
am_daemon/amd_appinfo.c
packaging/aul.spec

index 94f73f5..5349bd2 100755 (executable)
@@ -277,7 +277,7 @@ static void __vconf_cb(keynode_t *key, void *data)
                g_hash_table_remove(cf->tbl, appid);
        } else if (strncmp(type_string, "update", 6) == 0){
                /*REMOVE EXISTING ENTRY & CREATE AGAIN*/
-               if (g_hash_table_remove(cf->tbl, appid) == true){
+               if (g_hash_table_remove(cf->tbl, appid)){
                        if (pkgmgrinfo_appinfo_get_appinfo(appid, &handle) == PMINFO_R_OK){
                                __app_info_insert_handler(handle, data);
                                pkgmgrinfo_appinfo_destroy_appinfo(handle);
@@ -286,6 +286,52 @@ static void __vconf_cb(keynode_t *key, void *data)
        }
 }
 
+int app_func(pkgmgrinfo_appinfo_h handle, void *user_data)
+{
+       char *appid = NULL;
+       struct appinfomgr *cf = (struct appinfomgr *)user_data;
+       int r;
+
+       pkgmgrinfo_appinfo_get_appid(handle, &appid);
+       r = g_hash_table_remove(cf->tbl, appid);
+       SECURE_LOGD("upgrading... (%s)", appid);
+
+       return 0;
+}
+
+static int __cb(int req_id, const char *pkg_type,
+                      const char *pkgid, const char *key, const char *val,
+                      const void *pmsg, void *user_data)
+{
+       int ret = 0;
+       pkgmgrinfo_pkginfo_h handle;
+
+       SECURE_LOGD("appid(%s), key(%s), value(%s)", pkgid, key, val);
+
+       if((strncmp(key,"start", 5) == 0) && (strncmp(val, "update", 6) == 0) ) {
+               ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+               if (ret != PMINFO_R_OK)
+                       return -1;
+               ret = pkgmgrinfo_appinfo_get_list(handle, PMINFO_UI_APP, app_func, user_data);
+               if (ret != PMINFO_R_OK) {
+                       pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+                       return -1;
+               }
+               pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+       } else if (strncmp(key,"end", 3) == 0) {
+                       ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+               if (ret != PMINFO_R_OK)
+                       return -1;
+               ret = pkgmgrinfo_appinfo_get_list(handle, PMINFO_UI_APP, __app_info_insert_handler, user_data);
+               if (ret != PMINFO_R_OK) {
+                       pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+                       return -1;
+               }
+               pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+       }
+       return ret;
+}
+
 int appinfo_init(struct appinfomgr **cf)
 {
        struct appinfomgr *_cf;
@@ -326,6 +372,12 @@ int appinfo_init(struct appinfomgr **cf)
        if (r < 0)
                _E("Unable to register vconf notification callback for VCONFKEY_MENUSCREEN_DESKTOP\n");
 
+       int event_type = PMINFO_CLIENT_STATUS_UPGRADE;
+       pkgmgrinfo_client *pc = NULL;
+       pc = pkgmgrinfo_client_new(PMINFO_REQUEST);
+       pkgmgrinfo_client_set_status_type(pc, event_type);
+       pkgmgrinfo_client_listen_status(pc, __cb , _cf);
+
        *cf = _cf;
 
        return 0;
index 120ed87..01e294c 100755 (executable)
@@ -2,7 +2,7 @@
 
 Name:       aul
 Summary:    App utility library
-Version:    0.0.282
+Version:    0.0.286
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0