Check for system_other existence in recovery mode as well.
This removes the recovery mode conditional, to ensure we
check for the existence of system_other in recovery mode as
well, before going ahead with performing avb related
operations on system_other.
Bug: 155053192
Test: adb sideload of OTA zip in recovery mode now passes
on a device which doesn't have system_other enabled.
Change-Id: I1884755aad2a8d37f540dbee73c7c7baab2759e7
diff --git a/dynamic_partition_control_android.cc b/dynamic_partition_control_android.cc
index 829e3eb..79c269c 100644
--- a/dynamic_partition_control_android.cc
+++ b/dynamic_partition_control_android.cc
@@ -579,18 +579,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