Set install location to internal when external storage is not available 94/156694/1
authorSangyoon Jang <jeremy.jang@samsung.com>
Thu, 19 Oct 2017 12:09:14 +0000 (21:09 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Thu, 19 Oct 2017 12:09:14 +0000 (21:09 +0900)
Change-Id: If10270f36776d1151c99e0ff87bff217f776175f
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/common/step/filesystem/step_acquire_external_storage.cc

index 519ca72..3aa4f2b 100644 (file)
@@ -15,6 +15,7 @@
 
 namespace {
 
+const char kInstalledInternally[] = "installed_internal";
 const char kInstalledExternally[] = "installed_external";
 const char kInternalOnly[] = "internal-only";
 const char kPreferExternal[] = "prefer-external";
@@ -54,14 +55,20 @@ Step::Status StepAcquireExternalStorage::process() {
             context_->unpacked_dir_path.get(),
             context_->uid.get());
 
+  // TODO(jeremy.jang): This checking should be moved to
+  // StepCheckInstallLocation
   if (storage == Storage::EXTERNAL && !context_->external_storage) {
     if (!installed_) {
       LOG(WARNING) << "Cannot initialize external storage "
                    << "for installed package";
-      storage = Storage::INTERNAL;
+      context_->storage.set(Storage::INTERNAL);
+      free(manifest->installed_storage);
+      manifest->installed_storage = strdup(kInstalledInternally);
     } else {
       LOG(ERROR) << "Cannot initialize external storage for updated package";
-      storage = Storage::INTERNAL;
+      context_->storage.set(Storage::INTERNAL);
+      free(manifest->installed_storage);
+      manifest->installed_storage = strdup(kInstalledInternally);
     }
   }