Replaced private API's to public API's in package_info.h 28/195828/1
authorTezaswy Singh <tezaswy.s@samsung.com>
Tue, 18 Dec 2018 19:21:03 +0000 (00:51 +0530)
committerTezaswy Singh <tezaswy.s@samsung.com>
Tue, 18 Dec 2018 19:21:03 +0000 (00:51 +0530)
Change-Id: I6a79c852081e8d99c03f62350e788bb1b967f176

src/pkgmgr.c
src/util.c

index 3986b4557ff4bce3da9e4c035ae7a68969f578e1..ef98b01a4e09176af5656500d10f2660630321b2 100755 (executable)
@@ -21,6 +21,7 @@
 #include <bundle.h>
 #include <dlog.h>
 #include<package_manager.h>
+#include <package_info.h>
 
 #include <widget_service.h>
 
@@ -31,7 +32,6 @@
 #include "pkgmgr.h"
 
 
-
 struct pkgmgr_handler {
        const char *key;
        int (*func)(const char *package, const char *val, void *data);
@@ -347,7 +347,7 @@ HAPI w_home_error_e pkgmgr_uninstall(const char *appid)
                ret = W_HOME_ERROR_FAIL;
        }
 
-       if (PMINFO_R_OK != package_info_destroy(handle)) {
+       if (PACKAGE_MANAGER_ERROR_NONE != package_info_destroy(handle)) {
                _E("cannot destroy the appinfo");
                ret = W_HOME_ERROR_FAIL;
        }
@@ -503,18 +503,15 @@ static w_home_error_e _error(const char *package, const char *val, void *scrolle
 
 
 
-static int _end_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
+static bool _end_cb(package_info_app_component_type_e comp_type, const char* app_id, void* user_data)
 {
-       char *appid = NULL;
        pkgmgr_request_s *rt = NULL;
-       int ret = 0;
 
-       retv_if(NULL == handle, -1);
        retv_if(NULL == user_data, -1);
 
-       ret = pkgmgrinfo_appinfo_get_appid(handle, &appid);
-       if (ret < 0 || !appid) {
-               _E("pkgmgrinfo_appinfo_get_appid error");
+       _E("AppID: [%s]", app_id);
+       if (!app_id) {
+               _E("appid is NULL: Error in fetching appid ");
                return 0;
        }
 
@@ -543,7 +540,7 @@ static Eina_Bool _uninstall_cb(const char *app_id, Evas_Object *item, void *data
 static w_home_error_e _end(const char *package, const char *val, void *data)
 {
        pkgmgr_request_s *rt = NULL;
-       pkgmgrinfo_pkginfo_h handle = NULL;
+       package_info_h handle = NULL;
 
        retv_if(!_exist_request_in_list(package), W_HOME_ERROR_FAIL);
 
@@ -569,20 +566,20 @@ static w_home_error_e _end(const char *package, const char *val, void *data)
                goto OUT;
        }
 
-       retv_if(PMINFO_R_OK != pkgmgrinfo_pkginfo_get_pkginfo(package, &handle), W_HOME_ERROR_FAIL);
+       retv_if(PACKAGE_MANAGER_ERROR_NONE != package_manager_get_package_info(package, &handle), W_HOME_ERROR_FAIL);
 
        /* Criteria : appid */
-       if (PMINFO_R_OK != pkgmgrinfo_appinfo_get_list(handle, PMINFO_UI_APP, _end_cb, rt)) {
+       if (PACKAGE_MANAGER_ERROR_NONE != package_info_foreach_app_from_package(handle, PACKAGE_INFO_UIAPP, _end_cb, rt)) {
                if (W_HOME_ERROR_NONE != _remove_request_in_list(package))
                        _E("cannot remove a request(%s:%s)", rt->package, rt->status);
-               pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+               package_info_destroy(handle);
                return W_HOME_ERROR_FAIL;
        }
 
 OUT:
        if (W_HOME_ERROR_NONE != _remove_request_in_list(package))
                _E("cannot remove a request(%s:%s)", rt->package, rt->status);
-       if (handle) pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+       if (handle) package_info_destroy(handle);
 
        return W_HOME_ERROR_NONE;
 }
index b1e7aa0621092448df91ff26971d02f84d2b75c9..f1827fc2a64be1fe8862c1a6622e32a416594ad7 100755 (executable)
@@ -27,7 +27,7 @@
 #include <vconf.h>
 #include <efl_extension.h>
 #include <efl_util.h>
-#include <pkgmgr-info.h>
+#include <package_manager.h>
 #include <widget_service.h>
 #include <bundle_internal.h>
 #include <package_manager.h>
@@ -505,16 +505,16 @@ static char *_get_app_id(const char *pkgname)
 {
        int ret = 0;
        char *appid = 0;
-       pkgmgrinfo_pkginfo_h handle = NULL;
+       package_info_h handle = NULL;
        retv_if(pkgname == NULL, NULL);
 
-       ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgname, &handle);
-       if (ret != PMINFO_R_OK) {
+       ret = package_manager_get_package_info(pkgname, &handle);
+       if (ret != PACKAGE_MANAGER_ERROR_NONE) {
                _E("Failed to get pkg information from pkgmgr");
                goto ERR;
        }
-       ret = pkgmgrinfo_pkginfo_get_mainappid(handle, &appid);
-       if (ret != PMINFO_R_OK) {
+       ret = package_info_get_main_app_id(handle, &appid);
+       if (ret != PACKAGE_MANAGER_ERROR_NONE) {
                _E("Failed to get mainapp ID information from pkgmgr");
                goto ERR;
        }
@@ -523,7 +523,7 @@ static char *_get_app_id(const char *pkgname)
                appid = strdup(appid);
 ERR:
        if (handle != NULL)
-               pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+               package_info_destroy(handle);
 
        return appid;
 }
@@ -568,13 +568,13 @@ static int _get_app_type(char *pkgname)
        retv_if(pkgname == NULL, APP_TYPE_NATIVE);
 
        ret = package_manager_get_package_info(pkgname, &handle);
-       if (ret != PMINFO_R_OK) {
+       if (ret != PACKAGE_MANAGER_ERROR_NONE) {
                _E("Failed to get pkg information from pkgmgr");
                return APP_TYPE_NATIVE;
        }
 
        ret = package_info_get_type(handle, &apptype);
-       if (ret != PMINFO_R_OK) {
+       if (ret != PACKAGE_MANAGER_ERROR_NONE) {
                _E("Failed to get app type from pkginfo handler");
                goto ERR;
        }