Fix issues with setShouldSwitchSlotOnReboot

1. Inherit powerwash setting from last applyPayload call
2. reject setShouldSwitchSlotOnReboot after ResetStatus

Bug: 376805981
Bug: 377642178
Change-Id: I1d00f76a4e421996ca6949686fea46a73429088e
diff --git a/aosp/update_attempter_android.cc b/aosp/update_attempter_android.cc
index 6b05603..9f7ec97 100644
--- a/aosp/update_attempter_android.cc
+++ b/aosp/update_attempter_android.cc
@@ -506,6 +506,10 @@
         "Status reset not allowed in this state, please "
         "cancel on going OTA first.");
   }
+  // last_error_ is used by setShouldSwitchSlot to determine if
+  // FilesystemVerification is done. Since we are discarding update
+  // state, discard this cache as well.
+  last_error_ = ErrorCode::kSuccess;
 
   if (apex_handler_android_ != nullptr) {
     LOG(INFO) << "Cleaning up reserved space for compressed APEX (if any)";
@@ -1339,6 +1343,9 @@
   // Don't run postinstall, we just need PostinstallAction to switch the slots.
   install_plan_.run_post_install = false;
   install_plan_.is_resume = true;
+  // previous ApplyPayload() call may have requested powerwash, these
+  // settings would be saved in `this->install_plan_`. Inherit that setting.
+  install_plan_.powerwash_required = this->install_plan_.powerwash_required;
 
   CHECK_NE(install_plan_.source_slot, UINT32_MAX);
   CHECK_NE(install_plan_.target_slot, UINT32_MAX);