Fix usage of backup manifest in recover parser plugin 94/267294/1
authorIlho Kim <ilho159.kim@samsung.com>
Wed, 1 Dec 2021 04:55:59 +0000 (13:55 +0900)
committerIlho Kim <ilho159.kim@samsung.com>
Wed, 1 Dec 2021 04:55:59 +0000 (13:55 +0900)
When in RecoverInstall mode and ReadonlyUpdateInstall in RecoverUpgrade mode
Fix the problem of misusing the backup manifest in the recover parser plugin

Change-Id: I569b9c96c457ba39ec1bb482cd21440f52980563
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
src/common/step/pkgmgr/step_recover_parser_plugins.cc

index 310043f..8fb4e71 100644 (file)
@@ -34,6 +34,15 @@ ci::Plugin::ActionType GetActionType(ci::InstallerContext* context) {
   }
 }
 
+bool IsNeedToUseBackupManifest(ci::InstallerContext* context) {
+  ci::RequestType type = context->recovery_info.get().recovery_file->type();
+  if (type == ci::RequestType::Update || type == ci::RequestType::Delta ||
+      type == ci::RequestType::MountUpdate)
+    return true;
+
+  return false;
+}
+
 }  // namespace
 
 namespace common_installer {
@@ -68,7 +77,9 @@ bool StepRecoverParserPlugin::SetXmlPath() {
           context_->is_readonly_package.get()))
       / context_->pkgid.get();
   xml_path += ".xml";
-  context_->xml_path.set(GetBackupPathForManifestFile(xml_path));
+  if (IsNeedToUseBackupManifest(context_))
+    xml_path = GetBackupPathForManifestFile(xml_path);
+  context_->xml_path.set(xml_path);
   return true;
 }