Using different pkgmgr-info API while getting pkgtype 47/100647/3
authorJunghyun Yeon <jungh.yeon@samsung.com>
Tue, 29 Nov 2016 01:37:00 +0000 (10:37 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Tue, 29 Nov 2016 06:27:17 +0000 (15:27 +0900)
- Change API which is used while retrieving pkginfo
to retrieve disabled and external-installed pkg properly
(externally installed pkg but external storage has removed)

Change-Id: I374ccc1c7e73734729aafcdf68a7c38a3d06ffb4
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/pkgmgr-server.c
src/util.c

index e4c312f..268a1ad 100644 (file)
@@ -572,24 +572,15 @@ static int __change_job_info(struct backend_job *job, uid_t uid,
        int ret = 0;
        char *pkgid = NULL;
        pkgmgrinfo_appinfo_h handle = NULL;
-
-       switch (job->req_type) {
-       case REQUEST_TYPE_DISABLE_APP:
-       case REQUEST_TYPE_DISABLE_GLOBAL_APP_FOR_UID:
-       case REQUEST_TYPE_ENABLE_APP_SPLASH_SCREEN:
-       case REQUEST_TYPE_DISABLE_APP_SPLASH_SCREEN:
-               ret = pkgmgrinfo_appinfo_get_usr_appinfo(job->pkgid, uid,
-                               &handle);
-               break;
-       case REQUEST_TYPE_ENABLE_APP:
-       case REQUEST_TYPE_ENABLE_GLOBAL_APP_FOR_UID:
-               ret = pkgmgrinfo_appinfo_get_usr_disabled_appinfo(job->pkgid,
-                               uid, &handle);
-               break;
-       default:
+       if (job->req_type != REQUEST_TYPE_DISABLE_APP &&
+                       job->req_type != REQUEST_TYPE_DISABLE_GLOBAL_APP_FOR_UID &&
+                       job->req_type != REQUEST_TYPE_ENABLE_APP_SPLASH_SCREEN &&
+                       job->req_type != REQUEST_TYPE_DISABLE_APP_SPLASH_SCREEN &&
+                       job->req_type != REQUEST_TYPE_ENABLE_APP &&
+                       job->req_type != REQUEST_TYPE_ENABLE_GLOBAL_APP_FOR_UID)
                return PMINFO_R_ERROR;
-       }
 
+       ret = pkgmgrinfo_appinfo_get_usr_all_appinfo(job->pkgid, uid, &handle);
        if (ret != PMINFO_R_OK)
                return PMINFO_R_ERROR;
 
index 6b683fd..6a1b7b9 100644 (file)
@@ -51,13 +51,9 @@ char *_get_pkgtype_from_pkgid(const char *pkgid, uid_t uid)
        pkgmgrinfo_pkginfo_h info;
        int ret;
 
-       ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, uid, &info);
-       if (ret != PMINFO_R_OK) {
-               ret = pkgmgrinfo_pkginfo_get_usr_disabled_pkginfo(pkgid, uid,
-                               &info);
-               if (ret != PMINFO_R_OK)
-                       return NULL;
-       }
+       ret = pkgmgrinfo_pkginfo_get_usr_all_pkginfo(pkgid, uid, &info);
+       if (ret != PMINFO_R_OK)
+               return NULL;
 
        ret = pkgmgrinfo_pkginfo_get_type(info, &pkgtype);
        if (ret != PMINFO_R_OK) {