Check for system_other existence in recovery mode as well. am: ddf27738af

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/update_engine/+/11796618

Change-Id: Ic39e0943a2aa02771411fe662978a666784cee3a
diff --git a/dynamic_partition_control_android.cc b/dynamic_partition_control_android.cc
index 5ed604a..ecd6252 100644
--- a/dynamic_partition_control_android.cc
+++ b/dynamic_partition_control_android.cc
@@ -570,18 +570,15 @@
   path->clear();
   *should_unmap = false;
 
-  // In recovery, just erase no matter what.
-  //   - On devices with retrofit dynamic partitions, no logical partitions
-  //     should be mounted at this point. Hence it should be safe to erase.
-  // Otherwise, do check that AVB is enabled on system_other before erasing.
-  if (!IsRecovery()) {
-    auto has_avb = IsAvbEnabledOnSystemOther();
-    TEST_AND_RETURN_FALSE(has_avb.has_value());
-    if (!has_avb.value()) {
-      LOG(INFO) << "AVB is not enabled on system_other. Skip erasing.";
-      return true;
-    }
+  // Check that AVB is enabled on system_other before erasing.
+  auto has_avb = IsAvbEnabledOnSystemOther();
+  TEST_AND_RETURN_FALSE(has_avb.has_value());
+  if (!has_avb.value()) {
+    LOG(INFO) << "AVB is not enabled on system_other. Skip erasing.";
+    return true;
+  }
 
+  if (!IsRecovery()) {
     // Found unexpected avb_keys for system_other on devices retrofitting
     // dynamic partitions. Previous crash in update_engine may leave logical
     // partitions mapped on physical system_other partition. It is difficult to