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

@@ -77,6 +77,7 @@ public class MainClearConfirmTest {
when(mMockActivity.getSystemService(Context.DEVICE_POLICY_SERVICE))
.thenReturn(mDevicePolicyManager);
when(mPersistentDataBlockManager.isFactoryResetProtectionActive()).thenReturn(false);
}
@Test
@@ -112,6 +113,13 @@ public class MainClearConfirmTest {
assertThat(mMainClearConfirm.shouldWipePersistentDataBlock(null)).isFalse();
}
@Test
public void shouldWipePersistentDataBlock_frpIsAlive_shouldReturnFalse() {
when(mPersistentDataBlockManager.isFactoryResetProtectionActive()).thenReturn(true);
assertThat(mMainClearConfirm.shouldWipePersistentDataBlock(mPersistentDataBlockManager))
.isFalse();
}
@Test
public void shouldWipePersistentDataBlock_deviceIsStillBeingProvisioned_shouldReturnFalse() {
doReturn(true).when(mMainClearConfirm).isDeviceStillBeingProvisioned();