Move FinishedSnapshotWrites call back to PostinstallRunnerAction

After FinishedSnapshotWrites is called, if device reboots w/o slot
switch, libsnapshot will discard all update state. This makes slot
switching after reboot difficult. For better UX, move back.

This reverts commit 5b00dc5386e67db5609e79f9e5c603d4ef1098a9.

Reason for revert: b/318986391

Change-Id: If33d7661a907d779f1a860b439a707885a8882bf
diff --git a/aosp/update_attempter_android.cc b/aosp/update_attempter_android.cc
index 1adaabc..e41531c 100644
--- a/aosp/update_attempter_android.cc
+++ b/aosp/update_attempter_android.cc
@@ -1325,21 +1325,22 @@
   CHECK_NE(install_plan_.source_slot, UINT32_MAX);
   CHECK_NE(install_plan_.target_slot, UINT32_MAX);
 
-  auto install_plan_action = std::make_unique<InstallPlanAction>(install_plan_);
   auto postinstall_runner_action =
       std::make_unique<PostinstallRunnerAction>(boot_control_, hardware_);
-  SetStatusAndNotify(UpdateStatus::VERIFYING);
   postinstall_runner_action->set_delegate(this);
-  ErrorCode error_code{};
 
   // If last error code is kUpdatedButNotActive, we know that we reached this
   // state by calling applyPayload() with switch_slot=false. That applyPayload()
   // call would have already performed filesystem verification, therefore, we
   // can safely skip the verification to save time.
   if (last_error_ == ErrorCode::kUpdatedButNotActive) {
+    auto install_plan_action =
+        std::make_unique<InstallPlanAction>(install_plan_);
     BondActions(install_plan_action.get(), postinstall_runner_action.get());
     processor_->EnqueueAction(std::move(install_plan_action));
+    SetStatusAndNotify(UpdateStatus::FINALIZING);
   } else {
+    ErrorCode error_code{};
     if (!boot_control_->GetDynamicPartitionControl()
              ->PreparePartitionsForUpdate(GetCurrentSlot(),
                                           GetTargetSlot(),
@@ -1361,7 +1362,8 @@
                                 utils::ErrorCodeToString(error_code),
                             error_code);
     }
-
+    auto install_plan_action =
+        std::make_unique<InstallPlanAction>(install_plan_);
     auto filesystem_verifier_action =
         std::make_unique<FilesystemVerifierAction>(
             boot_control_->GetDynamicPartitionControl());
@@ -1371,6 +1373,7 @@
                 postinstall_runner_action.get());
     processor_->EnqueueAction(std::move(install_plan_action));
     processor_->EnqueueAction(std::move(filesystem_verifier_action));
+    SetStatusAndNotify(UpdateStatus::VERIFYING);
   }
 
   processor_->EnqueueAction(std::move(postinstall_runner_action));