Enable to list app and pkg with pkginfo --listpkg/--listapp 00/30400/2
authorSabera Djelti (sdi2) <sabera.djelti@open.eurogiciel.org>
Fri, 14 Nov 2014 14:51:34 +0000 (15:51 +0100)
committerSabera Djelti (sdi2) <sabera.djelti@open.eurogiciel.org>
Mon, 24 Nov 2014 13:00:46 +0000 (14:00 +0100)
--> put uid to callback via the handle

Bug-Tizen: TC-1590

Change-Id: I6f459966c789d53035fe5704c39d07bd789f8bbf
Signed-off-by: Sabera Djelti (sdi2) <sabera.djelti@open.eurogiciel.org>
tool/pkg_cmd.c
tool/pkg_info.c

index 2a43db8..52e5ee3 100755 (executable)
@@ -480,13 +480,14 @@ static int __pkg_list_cb (const pkgmgrinfo_pkginfo_h handle, void *user_data, ui
        int ret = -1;
        int size = 0;
        char *pkgid;
+       pkgmgrinfo_uidinfo_t *uid_info = (pkgmgrinfo_uidinfo_t *) handle;
 
        ret = pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid);
        if(ret < 0) {
                printf("pkgmgr_pkginfo_get_pkgid() failed\n");
        }
-  if (uid != GLOBAL_USER)
-         ret = pkgmgr_client_usr_request_service(PM_REQUEST_GET_SIZE, PM_GET_TOTAL_SIZE, (pkgmgr_client *)user_data, NULL, pkgid, uid, NULL, NULL, NULL);
+  if (uid_info->uid != GLOBAL_USER)
+         ret = pkgmgr_client_usr_request_service(PM_REQUEST_GET_SIZE, PM_GET_TOTAL_SIZE, (pkgmgr_client *)user_data, NULL, pkgid, uid_info->uid, NULL, NULL, NULL);
   else
          ret = pkgmgr_client_request_service(PM_REQUEST_GET_SIZE, PM_GET_TOTAL_SIZE, (pkgmgr_client *)user_data, NULL, pkgid, NULL, NULL, NULL);
        if (ret < 0){
index ff95322..e4f92d9 100755 (executable)
@@ -56,7 +56,7 @@ static int __get_certinfo_from_db(char *pkgid);
 static int __del_certinfo_from_db(char *pkgid);
 static int __get_integer_input_data(void);
 char *__get_string_input_data(void);
-static int __pkg_list_cb (const pkgmgr_pkginfo_h handle, void *user_data, uid_t uid);
+static int __pkg_list_cb (const pkgmgr_pkginfo_h handle, void *user_data);
 static int __app_category_list_cb(const char *category_name, void *user_data);
 static int __app_control_list_cb(pkgmgrinfo_appcontrol_h handle, void *user_data);
 static int __app_metadata_list_cb(const char *metadata_name, const char *metadata_value, void *user_data);
@@ -1750,7 +1750,7 @@ int app_func(const pkgmgr_appinfo_h handle, void *user_data)
 }
 
 
-static int __pkg_list_cb (const pkgmgr_pkginfo_h handle, void *user_data, uid_t uid)
+static int __pkg_list_cb (const pkgmgr_pkginfo_h handle, void *user_data)
 {
        char *test_data = "test data";
        int ret = -1;
@@ -1760,6 +1760,7 @@ static int __pkg_list_cb (const pkgmgr_pkginfo_h handle, void *user_data, uid_t
        bool preload = 0;
        int installed_time = -1;
 
+       pkgmgrinfo_uidinfo_t *uid_info = (pkgmgrinfo_uidinfo_t *) handle;
        ret = pkgmgr_pkginfo_get_pkgid(handle, &pkgid);
        if(ret < 0) {
                printf("pkgmgr_pkginfo_get_pkgid() failed\n");
@@ -1786,14 +1787,14 @@ static int __pkg_list_cb (const pkgmgr_pkginfo_h handle, void *user_data, uid_t
        printf("pkg_type [%s]\tpkgid [%s]\tversion [%s]\tpreload [%d]\tinstalled_time [%d]\n", pkg_type,
               pkgid, pkg_version, preload, installed_time);
 
-       if (uid != GLOBAL_USER) {
+       if (uid_info->uid != GLOBAL_USER) {
                printf("**List of Ui-Apps**\n");
-               ret = pkgmgr_appinfo_get_usr_list(handle, PM_UI_APP, app_func, (void *)test_data, uid);
+               ret = pkgmgr_appinfo_get_usr_list(handle, PM_UI_APP, app_func, (void *)test_data, uid_info->uid);
                if (ret < 0) {
                        printf("pkgmgr_get_info_app() failed\n");
                }
                printf("**List of Svc-Apps**\n");
-               ret = pkgmgr_appinfo_get_usr_list(handle, PM_SVC_APP, app_func, (void *)test_data, uid);
+               ret = pkgmgr_appinfo_get_usr_list(handle, PM_SVC_APP, app_func, (void *)test_data, uid_info->uid);
                if (ret < 0) {
                        printf("pkgmgr_get_info_app() failed\n");
                }