Fix plain VAB OTA failure

libsnapshot expects partitions to be mapped when calling
FinishUpdate/FinishedSnapshotWrites

Test: th
Bug: 274028986
Change-Id: I922e255b5e28f81ffdaad56feac8d2904f98180d
diff --git a/payload_consumer/postinstall_runner_action.cc b/payload_consumer/postinstall_runner_action.cc
index 6beca56..a6fa4b3 100644
--- a/payload_consumer/postinstall_runner_action.cc
+++ b/payload_consumer/postinstall_runner_action.cc
@@ -430,12 +430,6 @@
 }
 
 void PostinstallRunnerAction::CompletePostinstall(ErrorCode error_code) {
-  if (!install_plan_.partitions.empty()) {
-    auto dynamic_control = boot_control_->GetDynamicPartitionControl();
-    CHECK(dynamic_control);
-    dynamic_control->UnmapAllPartitions();
-    LOG(INFO) << "Unmapped all partitions.";
-  }
   // We only attempt to mark the new slot as active if all the postinstall
   // steps succeeded.
   if (error_code == ErrorCode::kSuccess) {
@@ -454,6 +448,12 @@
       error_code = ErrorCode::kUpdatedButNotActive;
     }
   }
+  if (!install_plan_.partitions.empty()) {
+    auto dynamic_control = boot_control_->GetDynamicPartitionControl();
+    CHECK(dynamic_control);
+    dynamic_control->UnmapAllPartitions();
+    LOG(INFO) << "Unmapped all partitions.";
+  }
 
   ScopedActionCompleter completer(processor_, this);
   completer.set_code(error_code);