diff --git a/src/com/cyanogenmod/setupwizard/setup/FinishSetupReceiver.java b/src/com/cyanogenmod/setupwizard/setup/FinishSetupReceiver.java index fdd77a2..d3db8ff 100644 --- a/src/com/cyanogenmod/setupwizard/setup/FinishSetupReceiver.java +++ b/src/com/cyanogenmod/setupwizard/setup/FinishSetupReceiver.java @@ -13,7 +13,7 @@ public class FinishSetupReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { - if (SetupWizardUtils.isDeviceLocked()) { + if (SetupWizardUtils.isDeviceLocked() || SetupWizardUtils.frpEnabled(context)) { return; } Settings.Global.putInt(context.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 1); diff --git a/src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java b/src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java index c802335..a723923 100644 --- a/src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java +++ b/src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java @@ -30,6 +30,7 @@ import android.os.IBinder; import android.os.ServiceManager; import android.os.UserHandle; import android.os.UserManager; +import android.service.persistentdata.PersistentDataBlockManager; import android.telephony.ServiceState; import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; @@ -142,6 +143,14 @@ public class SetupWizardUtils { return false; } + public static boolean frpEnabled(Context context) { + final PersistentDataBlockManager pdbManager = (PersistentDataBlockManager) + context.getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE); + return pdbManager != null + && pdbManager.getDataBlockSize() > 0 + && !pdbManager.getOemUnlockEnabled(); + } + public static boolean hasKillSwitch() { IBinder b = ServiceManager.getService(Context.KILLSWITCH_SERVICE); IKillSwitchService service = IKillSwitchService.Stub.asInterface(b);