Add dev setting to enable global actions bug report button.

Change-Id: I3768f95e1c6fbec9c10186093e5e1d48b0ef6ae4
This commit is contained in:
Dianne Hackborn
2012-08-07 11:26:32 -07:00
parent 0a83748580
commit 2d803a3931
4 changed files with 22 additions and 14 deletions

View File

@@ -2869,6 +2869,10 @@
<string name="enable_adb">USB debugging</string> <string name="enable_adb">USB debugging</string>
<!-- Setting checkbox summary for Whether to enable USB debugging support on the phone --> <!-- Setting checkbox summary for Whether to enable USB debugging support on the phone -->
<string name="enable_adb_summary">Debug mode when USB is connected</string> <string name="enable_adb_summary">Debug mode when USB is connected</string>
<!-- [CHAR LIMIT=NONE] Setting checkbox title for Whether to include bug report item in power menu. -->
<string name="bugreport_in_power">Power menu bug reports</string>
<!-- [CHAR LIMIT=NONE] Setting checkbox summary for Whether to include bug report item in power -->
<string name="bugreport_in_power_summary">Include option in power menu for taking a bug report</string>
<!-- Setting Checkbox title whether to keep the screen on when plugged in to a power source --> <!-- Setting Checkbox title whether to keep the screen on when plugged in to a power source -->
<string name="keep_screen_on">Stay awake</string> <string name="keep_screen_on">Stay awake</string>
<!-- setting Checkbox summary whether to keep the screen on when plugged in --> <!-- setting Checkbox summary whether to keep the screen on when plugged in -->
@@ -3397,16 +3401,6 @@
<!-- Summary text of the "automatic restore" setting --> <!-- Summary text of the "automatic restore" setting -->
<string name="auto_restore_summary">When reinstalling an app, restore backed up settings and data</string> <string name="auto_restore_summary">When reinstalling an app, restore backed up settings and data</string>
<!-- Take bug report menu title [CHAR LIMIT=NONE] -->
<string name="bugreport_title">Take bug report</string>
<!-- Message in bugreport dialog describing what it does [CHAR LIMIT=NONE] -->
<string name="bugreport_message">This will collect information about your
current device state, to send as an e-mail message. It will take a little
time from starting the bug report until it is ready to be sent; please be
patient.</string>
<!-- Button in bugreport dialog to confirm starting the report [CHAR LIMIT=NONE] -->
<string name="report">Report</string>
<!-- Local (desktop) backup password menu title [CHAR LIMIT=25] --> <!-- Local (desktop) backup password menu title [CHAR LIMIT=25] -->
<string name="local_backup_password_title">Desktop backup password</string> <string name="local_backup_password_title">Desktop backup password</string>
<!-- Summary text of the "local backup password" setting when the user has not supplied a password --> <!-- Summary text of the "local backup password" setting when the user has not supplied a password -->

View File

@@ -18,8 +18,8 @@
android:title="@string/development_settings_title"> android:title="@string/development_settings_title">
<com.android.settings.BugreportPreference <com.android.settings.BugreportPreference
android:key="bugreport" android:key="bugreport"
android:title="@string/bugreport_title" android:title="@*android:string/bugreport_title"
android:dialogTitle="@string/bugreport_title" /> android:dialogTitle="@*android:string/bugreport_title" />
<PreferenceScreen <PreferenceScreen
android:key="local_backup_password" android:key="local_backup_password"
@@ -57,6 +57,11 @@
android:title="@string/enable_adb" android:title="@string/enable_adb"
android:summary="@string/enable_adb_summary"/> android:summary="@string/enable_adb_summary"/>
<CheckBoxPreference
android:key="bugreport_in_power"
android:title="@string/bugreport_in_power"
android:summary="@string/bugreport_in_power_summary"/>
<CheckBoxPreference <CheckBoxPreference
android:key="allow_mock_location" android:key="allow_mock_location"
android:title="@string/allow_mock_location" android:title="@string/allow_mock_location"

View File

@@ -33,8 +33,8 @@ public class BugreportPreference extends DialogPreference {
@Override @Override
protected void onPrepareDialogBuilder(Builder builder) { protected void onPrepareDialogBuilder(Builder builder) {
super.onPrepareDialogBuilder(builder); super.onPrepareDialogBuilder(builder);
builder.setPositiveButton(R.string.report, this); builder.setPositiveButton(com.android.internal.R.string.report, this);
builder.setMessage(R.string.bugreport_message); builder.setMessage(com.android.internal.R.string.bugreport_message);
} }
@Override @Override

View File

@@ -79,6 +79,7 @@ public class DevelopmentSettings extends PreferenceFragment
private static final String ENFORCE_READ_EXTERNAL = "enforce_read_external"; private static final String ENFORCE_READ_EXTERNAL = "enforce_read_external";
private static final String LOCAL_BACKUP_PASSWORD = "local_backup_password"; 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 HARDWARE_UI_PROPERTY = "persist.sys.ui.hw";
private static final String BUGREPORT_IN_POWER_KEY = "bugreport_in_power";
private static final String DEBUG_APP_KEY = "debug_app"; private static final String DEBUG_APP_KEY = "debug_app";
private static final String WAIT_FOR_DEBUGGER_KEY = "wait_for_debugger"; private static final String WAIT_FOR_DEBUGGER_KEY = "wait_for_debugger";
@@ -118,6 +119,7 @@ public class DevelopmentSettings extends PreferenceFragment
private boolean mDontPokeProperties; private boolean mDontPokeProperties;
private CheckBoxPreference mEnableAdb; private CheckBoxPreference mEnableAdb;
private CheckBoxPreference mBugreportInPower;
private CheckBoxPreference mKeepScreenOn; private CheckBoxPreference mKeepScreenOn;
private CheckBoxPreference mEnforceReadExternal; private CheckBoxPreference mEnforceReadExternal;
private CheckBoxPreference mAllowMockLocation; private CheckBoxPreference mAllowMockLocation;
@@ -170,6 +172,7 @@ public class DevelopmentSettings extends PreferenceFragment
addPreferencesFromResource(R.xml.development_prefs); addPreferencesFromResource(R.xml.development_prefs);
mEnableAdb = findAndInitCheckboxPref(ENABLE_ADB); mEnableAdb = findAndInitCheckboxPref(ENABLE_ADB);
mBugreportInPower = findAndInitCheckboxPref(BUGREPORT_IN_POWER_KEY);
mKeepScreenOn = findAndInitCheckboxPref(KEEP_SCREEN_ON); mKeepScreenOn = findAndInitCheckboxPref(KEEP_SCREEN_ON);
mEnforceReadExternal = findAndInitCheckboxPref(ENFORCE_READ_EXTERNAL); mEnforceReadExternal = findAndInitCheckboxPref(ENFORCE_READ_EXTERNAL);
mAllowMockLocation = findAndInitCheckboxPref(ALLOW_MOCK_LOCATION); mAllowMockLocation = findAndInitCheckboxPref(ALLOW_MOCK_LOCATION);
@@ -333,6 +336,8 @@ public class DevelopmentSettings extends PreferenceFragment
mHaveDebugSettings = false; mHaveDebugSettings = false;
updateCheckBox(mEnableAdb, Settings.Secure.getInt(cr, updateCheckBox(mEnableAdb, Settings.Secure.getInt(cr,
Settings.Secure.ADB_ENABLED, 0) != 0); Settings.Secure.ADB_ENABLED, 0) != 0);
updateCheckBox(mBugreportInPower, Settings.Secure.getInt(cr,
Settings.Secure.BUGREPORT_IN_POWER_MENU, 0) != 0);
updateCheckBox(mKeepScreenOn, Settings.System.getInt(cr, updateCheckBox(mKeepScreenOn, Settings.System.getInt(cr,
Settings.System.STAY_ON_WHILE_PLUGGED_IN, 0) != 0); Settings.System.STAY_ON_WHILE_PLUGGED_IN, 0) != 0);
updateCheckBox(mEnforceReadExternal, isPermissionEnforced(context, READ_EXTERNAL_STORAGE)); updateCheckBox(mEnforceReadExternal, isPermissionEnforced(context, READ_EXTERNAL_STORAGE));
@@ -809,6 +814,10 @@ public class DevelopmentSettings extends PreferenceFragment
Settings.Secure.putInt(getActivity().getContentResolver(), Settings.Secure.putInt(getActivity().getContentResolver(),
Settings.Secure.ADB_ENABLED, 0); Settings.Secure.ADB_ENABLED, 0);
} }
} else if (preference == mBugreportInPower) {
Settings.Secure.putInt(getActivity().getContentResolver(),
Settings.Secure.BUGREPORT_IN_POWER_MENU,
mBugreportInPower.isChecked() ? 1 : 0);
} else if (preference == mKeepScreenOn) { } else if (preference == mKeepScreenOn) {
Settings.System.putInt(getActivity().getContentResolver(), Settings.System.putInt(getActivity().getContentResolver(),
Settings.System.STAY_ON_WHILE_PLUGGED_IN, Settings.System.STAY_ON_WHILE_PLUGGED_IN,