Block developer settings during SUW
Block access to development settings by tapping on the build number
in "About phone". Once SUW has completed, taps will be allowed.
Bug: 25290269
Change-Id: I9b2787712237f28fba446abab15a9e1c075d0419
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index a001fd7..c80da67 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -259,7 +259,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 88c77ab..405b33d 100644
--- a/src/com/android/settings/DeviceInfoSettings.java
+++ b/src/com/android/settings/DeviceInfoSettings.java
@@ -209,6 +209,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;