Merge "Check if FRP policy is supported in Settings" into rvc-dev am: d1408a66a6

Change-Id: I65079e2dc5c1cceb8489c7d691cdce08f0788c90
This commit is contained in:
Alex Johnston
2020-04-29 08:33:53 +00:00
committed by Automerger Merge Worker
2 changed files with 23 additions and 2 deletions

View File

@@ -151,11 +151,16 @@ public class MasterClearConfirm extends InstrumentedFragment {
if (isOemUnlockedAllowed()) {
return false;
}
final DevicePolicyManager dpm = (DevicePolicyManager) getActivity()
.getSystemService(Context.DEVICE_POLICY_SERVICE);
// Do not erase the factory reset protection data (from Settings) if factory reset
// protection policy is not supported on the device.
if (!dpm.isFactoryResetProtectionPolicySupported()) {
return false;
}
// Do not erase the factory reset protection data (from Settings) if the
// device is an organization-owned managed profile device and a factory
// reset protection policy has been set.
final DevicePolicyManager dpm = (DevicePolicyManager) getActivity()
.getSystemService(Context.DEVICE_POLICY_SERVICE);
FactoryResetProtectionPolicy frpPolicy = dpm.getFactoryResetProtectionPolicy(null);
if (dpm.isOrganizationOwnedDeviceWithManagedProfile() && frpPolicy != null
&& frpPolicy.isNotEmpty()) {