refactor setting installed_storage 08/72908/1 accepted/tizen/common/20160606.141715 accepted/tizen/ivi/20160606.040558 accepted/tizen/mobile/20160606.035159 accepted/tizen/tv/20160606.035900 accepted/tizen/wearable/20160606.040103 submit/tizen/20160603.030057
authorjongmyeongko <jongmyeong.ko@samsung.com>
Fri, 3 Jun 2016 04:18:36 +0000 (13:18 +0900)
committerjongmyeongko <jongmyeong.ko@samsung.com>
Fri, 3 Jun 2016 04:18:36 +0000 (13:18 +0900)
Change-Id: Iaa29a44bf3639bde4d02a727969da04e5a66f240
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
src/common/pkgmgr_registration.cc
src/common/step/configuration/step_parse_manifest.cc

index a654d3f..bacd18d 100644 (file)
@@ -353,10 +353,12 @@ bool QueryPrivilegesForPkgId(const std::string& pkg_id, uid_t uid,
 }
 
 std::string QueryStorageForPkgId(const std::string& pkg_id, uid_t uid) {
+  // initial & default : internal
+  std::string installed_location = "installed_internal";
   pkgmgrinfo_pkginfo_h package_info;
   if (pkgmgrinfo_pkginfo_get_usr_pkginfo(pkg_id.c_str(), uid, &package_info)
       != PMINFO_R_OK) {
-    return "";
+    return installed_location;
   }
 
   pkgmgrinfo_installed_storage storage;
@@ -365,17 +367,12 @@ std::string QueryStorageForPkgId(const std::string& pkg_id, uid_t uid) {
   pkgmgrinfo_pkginfo_destroy_pkginfo(package_info);
 
   if (!ok)
-    return "";
-
-  // TODO(t.iwanek): enum is used in pkgmgr API, whereas here we assign internal
-  // values known to pkgmgr
-  if (storage == PMINFO_INTERNAL_STORAGE) {
-    return "installed_internal";
-  } else if (storage == PMINFO_EXTERNAL_STORAGE) {
-    return "installed_external";
-  } else {
-    return "";
-  }
+    return installed_location;
+
+  if (storage == PMINFO_EXTERNAL_STORAGE)
+    installed_location = "installed_external";
+
+  return installed_location;
 }
 
 bool IsPackageInstalled(const std::string& pkg_id, RequestMode request_mode) {
index a2ee835..29eb916 100644 (file)
@@ -218,13 +218,9 @@ bool StepParseManifest::FillPackageInfo(manifest_x* manifest) {
   // set installed_storage if package is installed
   // this is internal field in package manager but after reading configuration
   // we must know it
-  if (manifest_location_ == ManifestLocation::INSTALLED ||
-      manifest_location_ == ManifestLocation::RECOVERY) {
-    std::string storage = QueryStorageForPkgId(manifest->package,
-                                               context_->uid.get());
-    if (!storage.empty())
-      manifest->installed_storage = strdup(storage.c_str());
-  }
+  std::string storage = QueryStorageForPkgId(manifest->package,
+                                            context_->uid.get());
+  manifest->installed_storage = strdup(storage.c_str());
 
   if (ui_application_list) {
     manifest->mainapp_id =