Reset libsnapshot states before applying a new update

Sometimes, update_engine's state are corrupted and cannot resume an
update, but libsnapshot's state are still kept around. This causes
kDeviceOpenError when applying new updates. To fix it, reset libsnapshot
state if update_engine cannot resume the OTA.

Test: th
Bug: 254211456
Change-Id: I2634cb2940a6f165bad3a7df7a81ff01f1f03408
diff --git a/aosp/update_attempter_android.cc b/aosp/update_attempter_android.cc
index 9b90030..1243a7f 100644
--- a/aosp/update_attempter_android.cc
+++ b/aosp/update_attempter_android.cc
@@ -266,16 +266,8 @@
                             DeltaPerformer::CanResumeUpdate(prefs_, payload_id);
   if (!install_plan_.is_resume) {
     boot_control_->GetDynamicPartitionControl()->Cleanup();
-    // No need to reset dynamic_partititon_metadata_updated. If previous calls
-    // to AllocateSpaceForPayload uses the same payload_id, reuse preallocated
-    // space. Otherwise, DeltaPerformer re-allocates space when the payload is
-    // applied.
-    if (!DeltaPerformer::ResetUpdateProgress(
-            prefs_,
-            false /* quick */,
-            true /* skip_dynamic_partititon_metadata_updated */)) {
-      LOG(WARNING) << "Unable to reset the update progress.";
-    }
+    boot_control_->GetDynamicPartitionControl()->ResetUpdate(prefs_);
+
     if (!prefs_->SetString(kPrefsUpdateCheckResponseHash, payload_id)) {
       LOG(WARNING) << "Unable to save the update check response hash.";
     }