}
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;
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) {
// 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 =