OSDN Git Service

Preserve FRP lock if wiped during SUW
authorRussell Brenner <russellbrenner@google.com>
Fri, 6 Nov 2015 00:03:20 +0000 (16:03 -0800)
committerThe Android Automerger <android-build@google.com>
Wed, 2 Dec 2015 01:41:41 +0000 (17:41 -0800)
Guard against FRP attacks by keeping the persistent data block
intact, if a factory reset has been issued during SUW.

[resolves merge conflicts with ag/808069]

Bug: 25290269
Change-Id: Id26b4c10235ad126632b71875592a4fa70a39b24

src/com/android/settings/MasterClearConfirm.java

index 7319a4e..da10b2a 100644 (file)
@@ -20,6 +20,7 @@ import android.app.ProgressDialog;
 import android.content.Context;
 import android.content.pm.ActivityInfo;
 import android.os.AsyncTask;
+import android.provider.Settings;
 import android.service.persistentdata.PersistentDataBlockManager;
 
 import com.android.internal.logging.MetricsLogger;
@@ -63,8 +64,12 @@ public class MasterClearConfirm extends InstrumentedFragment {
             final PersistentDataBlockManager pdbManager = (PersistentDataBlockManager)
                     getActivity().getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
 
-            if (pdbManager != null && !pdbManager.getOemUnlockEnabled()) {
-                // if OEM unlock is enabled, this will be wiped during FR process.
+            if (pdbManager != null && !pdbManager.getOemUnlockEnabled() &&
+                    Settings.Global.getInt(getActivity().getContentResolver(),
+                            Settings.Global.DEVICE_PROVISIONED, 0) != 0) {
+                // if OEM unlock is enabled, this will be wiped during FR process. If disabled, it
+                // will be wiped here, unless the device is still being provisioned, in which case
+                // the persistent data block will be preserved.
                 new AsyncTask<Void, Void, Void>() {
                     int mOldOrientation;
                     ProgressDialog mProgressDialog;