diff options
-rw-r--r-- | src/com/android/settings/DevelopmentSettings.java | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java index e1d29b5..cfc1b7f 100644 --- a/src/com/android/settings/DevelopmentSettings.java +++ b/src/com/android/settings/DevelopmentSettings.java @@ -295,7 +295,9 @@ public class DevelopmentSettings extends PreferenceFragment mRootAccess = (ListPreference) findPreference(ROOT_ACCESS_KEY); mRootAccess.setOnPreferenceChangeListener(this); - removeRootOptionsIfRequired(); + if (!removeRootOptionsIfRequired()) { + mAllPrefs.add(mRootAccess); + } } private CheckBoxPreference findAndInitCheckboxPref(String key) { @@ -308,13 +310,16 @@ public class DevelopmentSettings extends PreferenceFragment return pref; } - private void removeRootOptionsIfRequired() { + private boolean removeRootOptionsIfRequired() { // user builds don't get root, and eng always gets root if (!Build.IS_DEBUGGABLE || "eng".equals(Build.TYPE)) { if (mRootAccess != null) { getPreferenceScreen().removePreference(mRootAccess); + return true; } } + + return false; } @Override @@ -459,6 +464,7 @@ public class DevelopmentSettings extends PreferenceFragment } } resetDebuggerOptions(); + resetRootAccessOptions(); writeAnimationScaleOption(0, mWindowAnimationScale, null); writeAnimationScaleOption(1, mTransitionAnimationScale, null); writeAnimationScaleOption(2, mAnimatorDurationScale, null); @@ -492,6 +498,19 @@ public class DevelopmentSettings extends PreferenceFragment updateRootAccessOptions(); } + private void resetRootAccessOptions() { + String oldValue = SystemProperties.get(ROOT_ACCESS_PROPERTY, "1"); + SystemProperties.set(ROOT_ACCESS_PROPERTY, "1"); + if (!oldValue.equals("1") && "1".equals(SystemProperties.get("service.adb.root", "0"))) { + SystemProperties.set("service.adb.root", "0"); + Settings.Secure.putInt(getActivity().getContentResolver(), + Settings.Secure.ADB_ENABLED, 0); + Settings.Secure.putInt(getActivity().getContentResolver(), + Settings.Secure.ADB_ENABLED, 1); + } + updateRootAccessOptions(); + } + private void updateHdcpValues() { int index = 1; // Defaults to drm-only. Needs to match with R.array.hdcp_checking_values ListPreference hdcpChecking = (ListPreference) findPreference(HDCP_CHECKING_KEY); |