SetupWizard: Check for frp in finish receiver
CYNGNOS-886 Change-Id: I97af3285d9321f2f153676eaac081e5408300661
This commit is contained in:
@@ -13,7 +13,7 @@ public class FinishSetupReceiver extends BroadcastReceiver {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
if (SetupWizardUtils.isDeviceLocked()) {
|
if (SetupWizardUtils.isDeviceLocked() || SetupWizardUtils.frpEnabled(context)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Settings.Global.putInt(context.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 1);
|
Settings.Global.putInt(context.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 1);
|
||||||
|
@@ -30,6 +30,7 @@ import android.os.IBinder;
|
|||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
|
import android.service.persistentdata.PersistentDataBlockManager;
|
||||||
import android.telephony.ServiceState;
|
import android.telephony.ServiceState;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
@@ -142,6 +143,14 @@ public class SetupWizardUtils {
|
|||||||
return false;
|
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() {
|
public static boolean hasKillSwitch() {
|
||||||
IBinder b = ServiceManager.getService(Context.KILLSWITCH_SERVICE);
|
IBinder b = ServiceManager.getService(Context.KILLSWITCH_SERVICE);
|
||||||
IKillSwitchService service = IKillSwitchService.Stub.asInterface(b);
|
IKillSwitchService service = IKillSwitchService.Stub.asInterface(b);
|
||||||
|
Reference in New Issue
Block a user