Fix Application/Package to use pkgmgr API for Multi-User version.
authorWonYoung Choi <wy80.choi@samsung.com>
Wed, 3 Jun 2015 00:21:03 +0000 (09:21 +0900)
committerWonYoung Choi <wy80.choi@samsung.com>
Wed, 3 Jun 2015 00:22:22 +0000 (09:22 +0900)
Change-Id: I283e5586557d0e1fbfdb3546852e84bf2f0a87c7

src/application/application_manager.cc
src/application/application_utils.cc
src/package/package_info_provider.cc

index a84a583633e96eab26eeb58efb6a16f30b2a71db..2ec23546b0194450c09cb641b51f915e7000909e 100755 (executable)
@@ -78,7 +78,7 @@ void ApplicationManager::GetCurrentApplication(const std::string& app_id,
 
   // obtain handle to application info
   pkgmgrinfo_appinfo_h handle;
-  int ret = pkgmgrinfo_appinfo_get_appinfo(app_id.c_str(), &handle);
+  int ret = pkgmgrinfo_appinfo_get_usr_appinfo(app_id.c_str(), getuid(), &handle);
   if (PMINFO_R_OK != ret) {
     LoggerE("Failed to get app info.");
     ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to get app info."), out);
@@ -674,7 +674,7 @@ void ApplicationManager::FindAppControl(const picojson::value& args) {
       }
 
       pkgmgrinfo_appinfo_h handle;
-      int ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+      int ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid, getuid(), &handle);
       if (PMINFO_R_OK != ret) {
         LoggerE("Failed to get appInfo");
       } else {
@@ -855,10 +855,10 @@ void ApplicationManager::GetAppsInfo(const picojson::value& args) {
       return 0;
     };
 
-    int ret = pkgmgrinfo_appinfo_get_installed_list(app_info_cb, &array);
+    int ret = pkgmgrinfo_appinfo_get_usr_installed_list(app_info_cb, getuid(), &array);
 
     if (APP_MANAGER_ERROR_NONE != ret) {
-      LoggerE("pkgmgrinfo_appinfo_get_installed_list error");
+      LoggerE("pkgmgrinfo_appinfo_get_usr_installed_list error");
       ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Unknown error."), &response_obj);
     } else {
       ReportSuccess(result, response_obj);
@@ -883,7 +883,7 @@ void ApplicationManager::GetAppInfo(const std::string& app_id, picojson::object*
 
   pkgmgrinfo_appinfo_h handle = nullptr;
 
-  if (PMINFO_R_OK != pkgmgrinfo_appinfo_get_appinfo(app_id.c_str(), &handle)) {
+  if (PMINFO_R_OK != pkgmgrinfo_appinfo_get_usr_appinfo(app_id.c_str(), getuid(), &handle)) {
     LoggerE("Failed to get app info");
     ReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "Failed to get app info."), out);
     return;
@@ -1024,7 +1024,7 @@ void ApplicationManager::GetAppSharedUri(const std::string& app_id, picojson::ob
 
   pkgmgrinfo_pkginfo_h pkg_info = nullptr;
 
-  int ret = pkgmgrinfo_pkginfo_get_pkginfo(package_id, &pkg_info);
+  int ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(package_id, getuid(), &pkg_info);
   std::unique_ptr<std::remove_pointer<pkgmgrinfo_pkginfo_h>::type, int(*)(pkgmgrinfo_pkginfo_h)>
   pkg_info_ptr(pkg_info, &pkgmgrinfo_pkginfo_destroy_pkginfo); // automatically release the memory
 
@@ -1056,7 +1056,7 @@ void ApplicationManager::GetAppMetaData(const std::string& app_id, picojson::obj
 
   pkgmgrinfo_appinfo_h handle = nullptr;
 
-  int ret = pkgmgrinfo_appinfo_get_appinfo(app_id.c_str(), &handle);
+  int ret = pkgmgrinfo_appinfo_get_usr_appinfo(app_id.c_str(), getuid(), &handle);
   std::unique_ptr<std::remove_pointer<pkgmgrinfo_appinfo_h>::type, int(*)(pkgmgrinfo_appinfo_h)>
   pkg_info_ptr(handle, &pkgmgrinfo_appinfo_destroy_appinfo); // automatically release the memory
 
@@ -1191,7 +1191,7 @@ class ApplicationListChangedBroker {
         case Event::kUpdated:
         {
           pkgmgrinfo_appinfo_h handle = nullptr;
-          if (PMINFO_R_OK != pkgmgrinfo_appinfo_get_appinfo(app_id.c_str(), &handle)) {
+          if (PMINFO_R_OK != pkgmgrinfo_appinfo_get_usr_appinfo(app_id.c_str(), getuid(), &handle)) {
             LoggerE("Failed to get application information handle.");
             continue;
           }
index e532becda2dd98291f1c1e32edf2da39b78a3514..e2fa81e6d6c1cc1cd2b9fe861cbc24f98d35f899 100755 (executable)
@@ -102,7 +102,7 @@ void ApplicationUtils::CreateApplicationInformation(const pkgmgrinfo_appinfo_h h
   }
 
   pkgmgrinfo_pkginfo_h pkginfo;
-  ret = pkgmgrinfo_pkginfo_get_pkginfo(tmp_str, &pkginfo);
+  ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(tmp_str, getuid(), &pkginfo);
   if (PMINFO_R_OK != ret) {
     LoggerE("Failed to get package info");
   } else {
index 0c829d4297d0e52a55f61a4d6065c07b9cf7b74e..3378977f40665e5654a20968a70c69d52ddbe709 100644 (file)
@@ -65,7 +65,7 @@ void PackageInfoProvider::GetPackagesInfo(
   start_time = clock();
 
   picojson::array array_data;
-  if ( pkgmgrinfo_pkginfo_get_list(PackageInfoGetListCb, &array_data)
+  if ( pkgmgrinfo_pkginfo_get_usr_list(PackageInfoGetListCb, &array_data, getuid())
       != PMINFO_R_OK ) {
     LoggerE("Failed to get package information");
     REPORT_ERROR(out, UnknownException("Any other platform error occurs"));
@@ -105,7 +105,7 @@ void PackageInfoProvider::GetPackageInfo(
   }
 
   pkgmgrinfo_pkginfo_h info;
-  if ( pkgmgrinfo_pkginfo_get_pkginfo(package_id, &info)
+  if ( pkgmgrinfo_pkginfo_get_usr_pkginfo(package_id, getuid(), &info)
       != PMINFO_R_OK ) {
     LoggerE("Failed to get pkginfo");
     REPORT_ERROR(out, NotFoundException("The package with the specified ID is not found"));