Merge "Block developer settings during SUW" into lmp-mr1-dev am: 56d630a3ed am: afe5eada5b
am: 8e4f6fbc2e
* commit '8e4f6fbc2ee74a3f7ede9d63f5a2d9c0ce153f70':
Block developer settings during SUW
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 4a4c51d..f9950b7 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -285,7 +285,11 @@
mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
if (android.os.Process.myUserHandle().getIdentifier() != UserHandle.USER_OWNER
- || mUm.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES)) {
+ || mUm.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES)
+ || Settings.Global.getInt(getActivity().getContentResolver(),
+ Settings.Global.DEVICE_PROVISIONED, 0) == 0) {
+ // Block access to developer options if the user is not the owner, if user policy
+ // restricts it, or if the device has not been provisioned
mUnavailable = true;
setPreferenceScreen(new PreferenceScreen(getActivity(), null));
return;
diff --git a/src/com/android/settings/DeviceInfoSettings.java b/src/com/android/settings/DeviceInfoSettings.java
index 1f0cad1..c2ab81e 100644
--- a/src/com/android/settings/DeviceInfoSettings.java
+++ b/src/com/android/settings/DeviceInfoSettings.java
@@ -224,6 +224,12 @@
// Don't enable developer options for secondary users.
if (UserHandle.myUserId() != UserHandle.USER_OWNER) return true;
+ // Don't enable developer options until device has been provisioned
+ if (Settings.Global.getInt(getActivity().getContentResolver(),
+ Settings.Global.DEVICE_PROVISIONED, 0) == 0) {
+ return true;
+ }
+
final UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);
if (um.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES)) return true;