diff options
Diffstat (limited to 'src/com/android/settings/DevelopmentSettings.java')
-rw-r--r-- | src/com/android/settings/DevelopmentSettings.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java index 6d1cadc..02045ab 100644 --- a/src/com/android/settings/DevelopmentSettings.java +++ b/src/com/android/settings/DevelopmentSettings.java @@ -139,6 +139,9 @@ public class DevelopmentSettings extends SettingsPreferenceFragment private static final String DEBUG_APPLICATIONS_CATEGORY_KEY = "debug_applications_category"; private static final String WIFI_DISPLAY_CERTIFICATION_KEY = "wifi_display_certification"; private static final String WIFI_VERBOSE_LOGGING_KEY = "wifi_verbose_logging"; + private static final String SELECT_LOGD_SIZE_KEY = "select_logd_size"; + private static final String SELECT_LOGD_SIZE_PROPERTY = "persist.logd.size"; + private static final String SELECT_LOGD_DEFAULT_SIZE_PROPERTY = "ro.logd.size"; private static final String OPENGL_TRACES_KEY = "enable_opengl_traces"; @@ -201,6 +204,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment private CheckBoxPreference mDebugLayout; private CheckBoxPreference mForceRtlLayout; private ListPreference mDebugHwOverdraw; + private ListPreference mLogdSize; private ListPreference mTrackFrameTime; private ListPreference mShowNonRectClip; private ListPreference mWindowAnimationScale; @@ -316,6 +320,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment mDebugHwOverdraw = addListPreference(DEBUG_HW_OVERDRAW_KEY); mWifiDisplayCertification = findAndInitCheckboxPref(WIFI_DISPLAY_CERTIFICATION_KEY); mWifiVerboseLogging = findAndInitCheckboxPref(WIFI_VERBOSE_LOGGING_KEY); + mLogdSize = addListPreference(SELECT_LOGD_SIZE_KEY); + mWindowAnimationScale = addListPreference(WINDOW_ANIMATION_SCALE_KEY); mTransitionAnimationScale = addListPreference(TRANSITION_ANIMATION_SCALE_KEY); mAnimatorDurationScale = addListPreference(ANIMATOR_DURATION_SCALE_KEY); @@ -520,6 +526,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment updateVerifyAppsOverUsbOptions(); updateBugreportOptions(); updateForceRtlOptions(); + updateLogdSizeValues(); updateWifiDisplayCertificationOptions(); updateWifiVerboseLoggingOptions(); updateSimulateColorSpace(); @@ -536,6 +543,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment } } resetDebuggerOptions(); + writeLogdSizeOption(null); writeAnimationScaleOption(0, mWindowAnimationScale, null); writeAnimationScaleOption(1, mTransitionAnimationScale, null); writeAnimationScaleOption(2, mAnimatorDurationScale, null); @@ -1037,6 +1045,43 @@ public class DevelopmentSettings extends SettingsPreferenceFragment mWifiManager.enableVerboseLogging(mWifiVerboseLogging.isChecked() ? 1 : 0); } + private void updateLogdSizeValues() { + if (mLogdSize != null) { + String currentValue = SystemProperties.get(SELECT_LOGD_SIZE_PROPERTY); + if (currentValue == null) { + currentValue = SystemProperties.get(SELECT_LOGD_DEFAULT_SIZE_PROPERTY); + if (currentValue == null) { + currentValue = "256K"; + } + } + String[] values = getResources().getStringArray(R.array.select_logd_size_values); + String[] titles = getResources().getStringArray(R.array.select_logd_size_titles); + String[] summaries = getResources().getStringArray(R.array.select_logd_size_summaries); + int index = 1; // punt to second entry if not found + for (int i = 0; i < values.length; i++) { + if (currentValue.equals(values[i]) + || currentValue.equals(titles[i])) { + index = i; + break; + } + } + mLogdSize.setValue(values[index]); + mLogdSize.setSummary(summaries[index]); + mLogdSize.setOnPreferenceChangeListener(this); + } + } + + private void writeLogdSizeOption(Object newValue) { + SystemProperties.set(SELECT_LOGD_SIZE_PROPERTY, newValue.toString()); + pokeSystemProperties(); + try { + Process p = Runtime.getRuntime().exec("logcat -b all -G " + newValue.toString()); + int status = p.waitFor(); + } catch (Exception e) { + } + updateLogdSizeValues(); + } + private void updateCpuUsageOptions() { updateCheckBox(mShowCpuUsage, Settings.Global.getInt(getActivity().getContentResolver(), Settings.Global.SHOW_PROCESSES, 0) != 0); @@ -1383,6 +1428,9 @@ public class DevelopmentSettings extends SettingsPreferenceFragment updateHdcpValues(); pokeSystemProperties(); return true; + } else if (preference == mLogdSize) { + writeLogdSizeOption(newValue); + return true; } else if (preference == mWindowAnimationScale) { writeAnimationScaleOption(0, mWindowAnimationScale, newValue); return true; |