diff options
author | Thiago Vinícius Freire de Araújo Ribeiro <thiagovfar@gmail.com> | 2013-05-05 13:58:59 -0300 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2015-12-23 13:13:03 -0800 |
commit | 436355b067510e5bb10bc13ac30ee196e634c8ec (patch) | |
tree | 4e70c24cb1c0d07e9c47f1ea30a6b6c8b6315afd /src/com/android/settings/DevelopmentSettings.java | |
parent | b5886584cd24f92652f418567a2577ea8b76fb16 (diff) | |
download | packages_apps_Settings-436355b067510e5bb10bc13ac30ee196e634c8ec.zip packages_apps_Settings-436355b067510e5bb10bc13ac30ee196e634c8ec.tar.gz packages_apps_Settings-436355b067510e5bb10bc13ac30ee196e634c8ec.tar.bz2 |
Development Settings: fix setting reset on disable
When Development Settings are disabled, some settings are
reset to values other than the default. This fixes it.
- Adb notify should reset to enabled
- Verify apps over usb should reset to enabled
Change-Id: Ifa1ee25cfab32b7a236e02055006f0d2a4b07f37
Diffstat (limited to 'src/com/android/settings/DevelopmentSettings.java')
-rw-r--r-- | src/com/android/settings/DevelopmentSettings.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java index 0d8b6a4..24fe2bb 100644 --- a/src/com/android/settings/DevelopmentSettings.java +++ b/src/com/android/settings/DevelopmentSettings.java @@ -335,7 +335,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment findPreference(DEBUG_DEBUGGING_CATEGORY_KEY); mEnableAdb = findAndInitSwitchPref(ENABLE_ADB); - mAdbNotify = findAndInitSwitchPref(ADB_NOTIFY); + mAdbNotify = (SwitchPreference) findPreference(ADB_NOTIFY); mAllPrefs.add(mAdbNotify); mAdbOverNetwork = findAndInitSwitchPref(ADB_TCPIP); @@ -387,7 +387,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment mMockLocationAppPref = findPreference(MOCK_LOCATION_APP_KEY); mAllPrefs.add(mMockLocationAppPref); - mVerifyAppsOverUsb = findAndInitSwitchPref(VERIFY_APPS_OVER_USB_KEY); + mVerifyAppsOverUsb = (SwitchPreference) findPreference(VERIFY_APPS_OVER_USB_KEY); + mAllPrefs.add(mVerifyAppsOverUsb); if (!showVerifierSetting()) { if (debugDebuggingCategory != null) { debugDebuggingCategory.removePreference(mVerifyAppsOverUsb); @@ -774,6 +775,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment resetDebuggerOptions(); writeLogdSizeOption(null); resetRootAccessOptions(); + resetAdbNotifyOptions(); + resetVerifyAppsOverUsbOptions(); resetDevelopmentShortcutOptions(); resetUpdateRecoveryOptions(); writeAnimationScaleOption(0, mWindowAnimationScale, null); @@ -832,6 +835,11 @@ public class DevelopmentSettings extends SettingsPreferenceFragment updateRootAccessOptions(); } + private void resetAdbNotifyOptions() { + CMSettings.Secure.putInt(getActivity().getContentResolver(), + CMSettings.Secure.ADB_NOTIFY, 1); + } + private void updateStayAwakeOptions() { int index = Settings.Global.getInt(getActivity().getContentResolver(), Settings.Global.STAY_ON_WHILE_PLUGGED_IN, 0); @@ -1018,6 +1026,11 @@ public class DevelopmentSettings extends SettingsPreferenceFragment Settings.Global.PACKAGE_VERIFIER_INCLUDE_ADB, mVerifyAppsOverUsb.isChecked() ? 1 : 0); } + private void resetVerifyAppsOverUsbOptions() { + Settings.Global.putInt(getActivity().getContentResolver(), + Settings.Global.PACKAGE_VERIFIER_INCLUDE_ADB, 1); + } + private boolean enableVerifierSetting() { final ContentResolver cr = getActivity().getContentResolver(); if (Settings.Global.getInt(cr, Settings.Global.ADB_ENABLED, 0) == 0) { |