summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2014-05-12 10:19:09 -0700
committerMark Salyzyn <salyzyn@google.com>2014-06-13 20:20:08 +0000
commit408c89bfb5738322fbea5e4119f7052173ceefc6 (patch)
tree36b9201f1b78424a96818b2ee577475f877770da /src
parent2ce0dcdad47e132dbe0f9cd16146b8e3c6b11cd6 (diff)
downloadpackages_apps_Settings-408c89bfb5738322fbea5e4119f7052173ceefc6.zip
packages_apps_Settings-408c89bfb5738322fbea5e4119f7052173ceefc6.tar.gz
packages_apps_Settings-408c89bfb5738322fbea5e4119f7052173ceefc6.tar.bz2
logd: Add Developer settings for size
- Dependent on some logd/init/selinux security changes. Bug: 14563261 Change-Id: I11e3aa97a0ba40c3f55041d98c02d7e73629e984
Diffstat (limited to 'src')
-rw-r--r--src/com/android/settings/DevelopmentSettings.java48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 229f169..a16f8b6 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -130,6 +130,9 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
private static final String DEBUG_DEBUGGING_CATEGORY_KEY = "debug_debugging_category";
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 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";
@@ -185,6 +188,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
private CheckBoxPreference mDebugLayout;
private CheckBoxPreference mForceRtlLayout;
private ListPreference mDebugHwOverdraw;
+ private ListPreference mLogdSize;
private ListPreference mTrackFrameTime;
private ListPreference mShowNonRectClip;
private ListPreference mWindowAnimationScale;
@@ -291,6 +295,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
mForceRtlLayout = findAndInitCheckboxPref(FORCE_RTL_LAYOUT_KEY);
mDebugHwOverdraw = addListPreference(DEBUG_HW_OVERDRAW_KEY);
mWifiDisplayCertification = findAndInitCheckboxPref(WIFI_DISPLAY_CERTIFICATION_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);
@@ -496,6 +502,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
updateVerifyAppsOverUsbOptions();
updateBugreportOptions();
updateForceRtlOptions();
+ updateLogdSizeValues();
updateWifiDisplayCertificationOptions();
}
@@ -509,6 +516,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
}
}
resetDebuggerOptions();
+ writeLogdSizeOption(null);
writeAnimationScaleOption(0, mWindowAnimationScale, null);
writeAnimationScaleOption(1, mTransitionAnimationScale, null);
writeAnimationScaleOption(2, mAnimatorDurationScale, null);
@@ -958,6 +966,43 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
mWifiDisplayCertification.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);
@@ -1284,6 +1329,9 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
updateHdcpValues();
pokeSystemProperties();
return true;
+ } else if (preference == mLogdSize) {
+ writeLogdSizeOption(newValue);
+ return true;
} else if (preference == mWindowAnimationScale) {
writeAnimationScaleOption(0, mWindowAnimationScale, newValue);
return true;