diff options
author | Jeff Sharkey <jsharkey@android.com> | 2012-10-29 13:59:07 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2012-10-29 14:57:41 -0700 |
commit | 2817c46c0459f67cfb886320fbc457786fdd5080 (patch) | |
tree | 790fcedf0e78410244ad2a29b8b62525f578628c /src/com | |
parent | e508a26e037c1b0a813575f1154da0ede7644979 (diff) | |
download | packages_apps_settings-2817c46c0459f67cfb886320fbc457786fdd5080.zip packages_apps_settings-2817c46c0459f67cfb886320fbc457786fdd5080.tar.gz packages_apps_settings-2817c46c0459f67cfb886320fbc457786fdd5080.tar.bz2 |
Selectively enable bugreport in power menu.
The underlying bugreport init service depends on USB debugging being
turned on for user builds. This change makes the developer options
UI reflect this constraint.
Bug: 7427434
Change-Id: I8dc16cc53ec4a97a3b39ee631694456be3bde081
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/settings/DevelopmentSettings.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java index e490aa6..aeedb0c 100644 --- a/src/com/android/settings/DevelopmentSettings.java +++ b/src/com/android/settings/DevelopmentSettings.java @@ -94,6 +94,7 @@ public class DevelopmentSettings extends PreferenceFragment private static final String LOCAL_BACKUP_PASSWORD = "local_backup_password"; private static final String HARDWARE_UI_PROPERTY = "persist.sys.ui.hw"; private static final String MSAA_PROPERTY = "debug.egl.force_msaa"; + private static final String BUGREPORT = "bugreport"; private static final String BUGREPORT_IN_POWER_KEY = "bugreport_in_power"; private static final String OPENGL_TRACES_PROPERTY = "debug.egl.trace"; @@ -144,6 +145,7 @@ public class DevelopmentSettings extends PreferenceFragment private boolean mDontPokeProperties; private CheckBoxPreference mEnableAdb; + private Preference mBugreport; private CheckBoxPreference mBugreportInPower; private CheckBoxPreference mKeepScreenOn; private CheckBoxPreference mEnforceReadExternal; @@ -203,6 +205,7 @@ public class DevelopmentSettings extends PreferenceFragment addPreferencesFromResource(R.xml.development_prefs); mEnableAdb = findAndInitCheckboxPref(ENABLE_ADB); + mBugreport = findPreference(BUGREPORT); mBugreportInPower = findAndInitCheckboxPref(BUGREPORT_IN_POWER_KEY); mKeepScreenOn = findAndInitCheckboxPref(KEEP_SCREEN_ON); mEnforceReadExternal = findAndInitCheckboxPref(ENFORCE_READ_EXTERNAL); @@ -417,6 +420,7 @@ public class DevelopmentSettings extends PreferenceFragment updateAppProcessLimitOptions(); updateShowAllANRsOptions(); updateVerifyAppsOverUsbOptions(); + updateBugreportOptions(); } private void resetDangerousOptions() { @@ -548,6 +552,25 @@ public class DevelopmentSettings extends PreferenceFragment Settings.Global.PACKAGE_VERIFIER_SETTING_VISIBLE, 1) > 0; } + private void updateBugreportOptions() { + if ("user".equals(Build.TYPE)) { + final ContentResolver resolver = getActivity().getContentResolver(); + final boolean adbEnabled = Settings.Global.getInt( + resolver, Settings.Global.ADB_ENABLED, 0) != 0; + if (adbEnabled) { + mBugreport.setEnabled(true); + mBugreportInPower.setEnabled(true); + } else { + mBugreport.setEnabled(false); + mBugreportInPower.setEnabled(false); + mBugreportInPower.setChecked(false); + Settings.Secure.putInt(resolver, Settings.Secure.BUGREPORT_IN_POWER_MENU, 0); + } + } else { + mBugreportInPower.setEnabled(true); + } + } + // Returns the current state of the system property that controls // strictmode flashes. One of: // 0: not explicitly set one way or another @@ -988,6 +1011,7 @@ public class DevelopmentSettings extends PreferenceFragment Settings.Global.ADB_ENABLED, 0); mVerifyAppsOverUsb.setEnabled(false); mVerifyAppsOverUsb.setChecked(false); + updateBugreportOptions(); } } else if (preference == mBugreportInPower) { Settings.Secure.putInt(getActivity().getContentResolver(), @@ -1100,6 +1124,7 @@ public class DevelopmentSettings extends PreferenceFragment Settings.Global.ADB_ENABLED, 1); mVerifyAppsOverUsb.setEnabled(true); updateVerifyAppsOverUsbOptions(); + updateBugreportOptions(); } else { // Reset the toggle mEnableAdb.setChecked(false); |