New development setting for ANRs.

Change-Id: I1fcde9d371bbb6e0eef0da7749a8c8cfb9a2c881
This commit is contained in:
Dianne Hackborn
2011-08-02 15:08:04 -07:00
parent 8d7f9594cd
commit d5119bd397
3 changed files with 32 additions and 0 deletions

View File

@@ -3395,6 +3395,12 @@ found in the list of installed applications.</string>
<!-- UI debug setting: limit number of running background processes [CHAR LIMIT=25] --> <!-- UI debug setting: limit number of running background processes [CHAR LIMIT=25] -->
<string name="app_process_limit_title">Background process limit</string> <string name="app_process_limit_title">Background process limit</string>
<!-- UI debug setting: show all ANRs? [CHAR LIMIT=25] -->
<string name="show_all_anrs">Show all ANRs</string>
<!-- UI debug setting: show all ANRs summary [CHAR LIMIT=50] -->
<string name="show_all_anrs_summary">Show Application Not Responding dialog
for background apps</string>
<!-- Activity title for network data usage summary. [CHAR LIMIT=25] --> <!-- Activity title for network data usage summary. [CHAR LIMIT=25] -->
<string name="data_usage_summary_title">Data usage</string> <string name="data_usage_summary_title">Data usage</string>
<!-- Title for option to pick visible time range from a list available usage periods. [CHAR LIMIT=25] --> <!-- Title for option to pick visible time range from a list available usage periods. [CHAR LIMIT=25] -->

View File

@@ -93,6 +93,11 @@
android:entries="@array/app_process_limit_entries" android:entries="@array/app_process_limit_entries"
android:entryValues="@array/app_process_limit_values" /> android:entryValues="@array/app_process_limit_values" />
<CheckBoxPreference
android:key="show_all_anrs"
android:title="@string/show_all_anrs"
android:summary="@string/show_all_anrs_summary"/>
</PreferenceCategory> </PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>

View File

@@ -65,6 +65,8 @@ public class DevelopmentSettings extends PreferenceFragment
= "immediately_destroy_activities"; = "immediately_destroy_activities";
private static final String APP_PROCESS_LIMIT_KEY = "app_process_limit"; private static final String APP_PROCESS_LIMIT_KEY = "app_process_limit";
private static final String SHOW_ALL_ANRS_KEY = "show_all_anrs";
private IWindowManager mWindowManager; private IWindowManager mWindowManager;
private CheckBoxPreference mEnableAdb; private CheckBoxPreference mEnableAdb;
@@ -81,6 +83,8 @@ public class DevelopmentSettings extends PreferenceFragment
private CheckBoxPreference mImmediatelyDestroyActivities; private CheckBoxPreference mImmediatelyDestroyActivities;
private ListPreference mAppProcessLimit; private ListPreference mAppProcessLimit;
private CheckBoxPreference mShowAllANRs;
// To track whether Yes was clicked in the adb warning dialog // To track whether Yes was clicked in the adb warning dialog
private boolean mOkClicked; private boolean mOkClicked;
@@ -112,6 +116,9 @@ public class DevelopmentSettings extends PreferenceFragment
mAppProcessLimit = (ListPreference) findPreference(APP_PROCESS_LIMIT_KEY); mAppProcessLimit = (ListPreference) findPreference(APP_PROCESS_LIMIT_KEY);
mAppProcessLimit.setOnPreferenceChangeListener(this); mAppProcessLimit.setOnPreferenceChangeListener(this);
mShowAllANRs = (CheckBoxPreference) findPreference(
SHOW_ALL_ANRS_KEY);
removeHdcpOptionsForProduction(); removeHdcpOptionsForProduction();
} }
@@ -144,6 +151,7 @@ public class DevelopmentSettings extends PreferenceFragment
updateAnimationScaleOptions(); updateAnimationScaleOptions();
updateImmediatelyDestroyActivitiesOptions(); updateImmediatelyDestroyActivitiesOptions();
updateAppProcessLimitOptions(); updateAppProcessLimitOptions();
updateShowAllANRsOptions();
} }
private void updateHdcpValues() { private void updateHdcpValues() {
@@ -330,6 +338,17 @@ public class DevelopmentSettings extends PreferenceFragment
} }
} }
private void writeShowAllANRsOptions() {
Settings.Secure.putInt(getActivity().getContentResolver(),
Settings.Secure.ANR_SHOW_BACKGROUND,
mShowAllANRs.isChecked() ? 1 : 0);
}
private void updateShowAllANRsOptions() {
mShowAllANRs.setChecked(Settings.Secure.getInt(
getActivity().getContentResolver(), Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0);
}
@Override @Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
@@ -372,6 +391,8 @@ public class DevelopmentSettings extends PreferenceFragment
writeCpuUsageOptions(); writeCpuUsageOptions();
} else if (preference == mImmediatelyDestroyActivities) { } else if (preference == mImmediatelyDestroyActivities) {
writeImmediatelyDestroyActivitiesOptions(); writeImmediatelyDestroyActivitiesOptions();
} else if (preference == mShowAllANRs) {
writeShowAllANRsOptions();
} }
return false; return false;