recovery: Remove the "Format system partition" menu on A/B devices
Addresses https://gitlab.com/LineageOS/issues/android/-/issues/1893
Change-Id: I05351055ff0d67d67e5cbe295492e7ed553c2c53
diff --git a/recovery_main.cpp b/recovery_main.cpp
index 8ac63d2..a4bbbc6 100644
--- a/recovery_main.cpp
+++ b/recovery_main.cpp
@@ -470,6 +470,13 @@
device->RemoveMenuItemForAction(Device::WIPE_CACHE);
}
+ if (android::base::GetBoolProperty("ro.build.ab_update", false)) {
+ // There's not much point in formatting the active slot's system partition
+ // because ROMs are flashed to the inactive slot. Removing the menu option
+ // prevents users from accidentally trashing a functioning ROM.
+ device->RemoveMenuItemForAction(Device::WIPE_SYSTEM);
+ }
+
if (!android::base::GetBoolProperty("ro.boot.dynamic_partitions", false) &&
!android::base::GetBoolProperty("ro.fastbootd.available", false)) {
device->RemoveMenuItemForAction(Device::ENTER_FASTBOOT);