diff options
author | DvTonder <david.vantonder@gmail.com> | 2013-02-18 09:25:26 -0500 |
---|---|---|
committer | d34d <clark@cyngn.com> | 2015-11-06 11:05:41 -0800 |
commit | 74a27aed48d84e93188683676f123f5c501caab0 (patch) | |
tree | 1d57af6b52e21fc91d2305c79c83d47107f5c900 /src/com/android | |
parent | b1530d4782885d200c0386a10fb625c1c8484580 (diff) | |
download | packages_apps_Settings-74a27aed48d84e93188683676f123f5c501caab0.zip packages_apps_Settings-74a27aed48d84e93188683676f123f5c501caab0.tar.gz packages_apps_Settings-74a27aed48d84e93188683676f123f5c501caab0.tar.bz2 |
Settings: Add Advanced reboot (1 of 2)
This commit adds a setting in Development settings for including options
in the power menu for rebooting into recovery or bootloader, defauled to
off.
When enabled, the Advanced reboot options will only be available once the
device is unlocked.
Change-Id: Ib77f0be178d15131b99adbe0abb6ba18b2b7c0b6
From: jackmu95 <jacob.mueller.elz@gmail.com>
Settings: Move 'Advanced reboot' to other position
This commit moves the 'Advanced reboot' checkbox one item down
because it looks a bit strange as first element in the list IMHO.
Before: http://goo.gl/jhw8h
After: http://goo.gl/X3H68
Change-Id: I26d4a5caba3e720b952ec405e200c1528f7a7321
From: ThiagoVinicius <thiagovfar@gmail.com>
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.
- No need to have resetAdvancedReboot(), as it is already
reset by the "unckeck all checkboxes" logic.
Change-Id: If5d88d220d2a17d6e172b2f54facd4afa3bae904
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/settings/DevelopmentSettings.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java index d27d89b..4afd725 100644 --- a/src/com/android/settings/DevelopmentSettings.java +++ b/src/com/android/settings/DevelopmentSettings.java @@ -57,6 +57,7 @@ import android.os.StrictMode; import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; +import android.preference.CheckBoxPreference; import android.preference.ListPreference; import android.preference.Preference; import android.preference.Preference.OnPreferenceChangeListener; @@ -183,6 +184,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment private static final String DEVELOPMENT_TOOLS = "development_tools"; + private static final String ADVANCED_REBOOT_KEY = "advanced_reboot"; + private static final int RESULT_DEBUG_APP = 1000; private static final int RESULT_MOCK_LOCATION_APP = 1001; @@ -272,6 +275,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment private PreferenceScreen mDevelopmentTools; private ColorModePreference mColorModePreference; + private SwitchPreference mAdvancedReboot; + private final ArrayList<Preference> mAllPrefs = new ArrayList<Preference>(); private final ArrayList<SwitchPreference> mResetSwitchPrefs @@ -347,6 +352,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment mDebugViewAttributes = findAndInitSwitchPref(DEBUG_VIEW_ATTRIBUTES); mPassword = (PreferenceScreen) findPreference(LOCAL_BACKUP_PASSWORD); mAllPrefs.add(mPassword); + mAdvancedReboot = findAndInitSwitchPref(ADVANCED_REBOOT_KEY); if (!android.os.Process.myUserHandle().equals(UserHandle.OWNER)) { @@ -354,6 +360,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment disableForUser(mClearAdbKeys); disableForUser(mEnableTerminal); disableForUser(mPassword); + disableForUser(mAdvancedReboot); } mDebugAppPref = findPreference(DEBUG_APP_KEY); @@ -672,6 +679,18 @@ public class DevelopmentSettings extends SettingsPreferenceFragment updateSimulateColorSpace(); updateUSBAudioOptions(); updateRootAccessOptions(); + updateAdvancedRebootOptions(); + } + + private void writeAdvancedRebootOptions() { + Settings.Secure.putInt(getActivity().getContentResolver(), + Settings.Secure.ADVANCED_REBOOT, + mAdvancedReboot.isChecked() ? 1 : 0); + } + + private void updateAdvancedRebootOptions() { + mAdvancedReboot.setChecked(Settings.Secure.getInt(getActivity().getContentResolver(), + Settings.Secure.ADVANCED_REBOOT, 0) != 0); } private void updateAdbOverNetwork() { @@ -1870,6 +1889,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment writeMobileDataAlwaysOnOptions(); } else if (preference == mUSBAudio) { writeUSBAudioOptions(); + } else if (preference == mAdvancedReboot) { + writeAdvancedRebootOptions(); } else if (INACTIVE_APPS_KEY.equals(preference.getKey())) { startInactiveAppsFragment(); } else { |