Merge "Fix crash if trying to erase the FRP data." into main

This commit is contained in:
Tom Hsu
2024-07-25 08:57:25 +00:00
committed by Android (Google) Code Review
2 changed files with 14 additions and 2 deletions

View File

@@ -89,8 +89,7 @@ public class MainClearConfirm extends InstrumentedFragment {
final PersistentDataBlockManager pdbManager;
// pre-flight check hardware support PersistentDataBlockManager
if (!SystemProperties.get(PERSISTENT_DATA_BLOCK_PROP).equals("")) {
pdbManager = (PersistentDataBlockManager)
getActivity().getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
pdbManager = getActivity().getSystemService(PersistentDataBlockManager.class);
} else {
pdbManager = null;
}
@@ -152,6 +151,11 @@ public class MainClearConfirm extends InstrumentedFragment {
return false;
}
// Do not try to erase factory reset protection data if the protection is alive.
if (pdbManager.isFactoryResetProtectionActive()) {
return false;
}
// The persistent data block will persist if the device is still being provisioned.
if (isDeviceStillBeingProvisioned()) {
return false;