diff options
author | sarbyn <sarbyn@gmail.com> | 2013-11-30 10:39:08 +0100 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2015-11-07 13:33:42 -0800 |
commit | da6e5f9100aca5c698e1a3f56a182bbd5d5fd699 (patch) | |
tree | e8b04c28ad63c785a498719aab2ba76034f5235e /src/com/android/settings/DevelopmentSettings.java | |
parent | 0183673aefd2303adbc4af8ae3e180fcadd7e039 (diff) | |
download | packages_apps_Settings-da6e5f9100aca5c698e1a3f56a182bbd5d5fd699.zip packages_apps_Settings-da6e5f9100aca5c698e1a3f56a182bbd5d5fd699.tar.gz packages_apps_Settings-da6e5f9100aca5c698e1a3f56a182bbd5d5fd699.tar.bz2 |
Settings: Port "Development shortcut" (1/3)
New setting under "Debug settings" that enables the development shortcut
Change-Id: I9a43e611911f2e278605715f714860ad11236fd9
Modify the Development shortcut help text
Change-Id: I9a43e611911f2e278605715f714860ad11236fd9
Diffstat (limited to 'src/com/android/settings/DevelopmentSettings.java')
-rw-r--r-- | src/com/android/settings/DevelopmentSettings.java | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java index 4afd725..531ea84 100644 --- a/src/com/android/settings/DevelopmentSettings.java +++ b/src/com/android/settings/DevelopmentSettings.java @@ -57,7 +57,6 @@ 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; @@ -82,6 +81,7 @@ import com.android.settings.fuelgauge.InactiveApps; import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.search.Indexable; import com.android.settings.widget.SwitchBar; +import cyanogenmod.providers.CMSettings; import java.util.ArrayList; import java.util.Arrays; @@ -186,6 +186,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment private static final String ADVANCED_REBOOT_KEY = "advanced_reboot"; + private static final String DEVELOPMENT_SHORTCUT_KEY = "development_shortcut"; + private static final int RESULT_DEBUG_APP = 1000; private static final int RESULT_MOCK_LOCATION_APP = 1001; @@ -277,6 +279,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment private SwitchPreference mAdvancedReboot; + private SwitchPreference mDevelopmentShortcut; + private final ArrayList<Preference> mAllPrefs = new ArrayList<Preference>(); private final ArrayList<SwitchPreference> mResetSwitchPrefs @@ -354,6 +358,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment mAllPrefs.add(mPassword); mAdvancedReboot = findAndInitSwitchPref(ADVANCED_REBOOT_KEY); + mDevelopmentShortcut = findAndInitSwitchPref(DEVELOPMENT_SHORTCUT_KEY); + if (!android.os.Process.myUserHandle().equals(UserHandle.OWNER)) { disableForUser(mEnableAdb); @@ -361,6 +367,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment disableForUser(mEnableTerminal); disableForUser(mPassword); disableForUser(mAdvancedReboot); + disableForUser(mDevelopmentShortcut); } mDebugAppPref = findPreference(DEBUG_APP_KEY); @@ -680,6 +687,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment updateUSBAudioOptions(); updateRootAccessOptions(); updateAdvancedRebootOptions(); + updateDevelopmentShortcutOptions(); } private void writeAdvancedRebootOptions() { @@ -693,6 +701,22 @@ public class DevelopmentSettings extends SettingsPreferenceFragment Settings.Secure.ADVANCED_REBOOT, 0) != 0); } + private void resetDevelopmentShortcutOptions() { + CMSettings.Secure.putInt(getActivity().getContentResolver(), + CMSettings.Secure.DEVELOPMENT_SHORTCUT, 0); + } + + private void writeDevelopmentShortcutOptions() { + CMSettings.Secure.putInt(getActivity().getContentResolver(), + CMSettings.Secure.DEVELOPMENT_SHORTCUT, + mDevelopmentShortcut.isChecked() ? 1 : 0); + } + + private void updateDevelopmentShortcutOptions() { + mAdvancedReboot.setChecked(CMSettings.Secure.getInt(getActivity().getContentResolver(), + CMSettings.Secure.DEVELOPMENT_SHORTCUT, 0) != 0); + } + private void updateAdbOverNetwork() { int port = Settings.Secure.getInt(getActivity().getContentResolver(), Settings.Secure.ADB_PORT, 0); @@ -733,6 +757,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment resetDebuggerOptions(); writeLogdSizeOption(null); resetRootAccessOptions(); + resetDevelopmentShortcutOptions(); writeAnimationScaleOption(0, mWindowAnimationScale, null); writeAnimationScaleOption(1, mTransitionAnimationScale, null); writeAnimationScaleOption(2, mAnimatorDurationScale, null); @@ -1893,6 +1918,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment writeAdvancedRebootOptions(); } else if (INACTIVE_APPS_KEY.equals(preference.getKey())) { startInactiveAppsFragment(); + } else if (preference == mDevelopmentShortcut) { + writeDevelopmentShortcutOptions(); } else { return super.onPreferenceTreeClick(preferenceScreen, preference); } |