Settings: Add option to disable logging

Bug: 26178938
Change-Id: I64263595705ceb1e6816e3cdfa982929877ff5b2
This commit is contained in:
Mark Salyzyn
2015-12-22 14:09:48 -08:00
parent 142193550e
commit 285afa8d15
77 changed files with 248 additions and 2 deletions

View File

@@ -147,6 +147,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
private static final String DEBUG_DEBUGGING_CATEGORY_KEY = "debug_debugging_category";
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_TAG_PROPERTY = "persist.log.tag";
private static final String SELECT_LOGD_DEFAULT_SIZE_PROPERTY = "ro.logd.size";
private static final String WIFI_DISPLAY_CERTIFICATION_KEY = "wifi_display_certification";
@@ -1258,21 +1259,30 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
private void updateLogdSizeValues() {
if (mLogdSize != null) {
String currentTag = SystemProperties.get(SELECT_LOGD_TAG_PROPERTY);
String currentValue = SystemProperties.get(SELECT_LOGD_SIZE_PROPERTY);
if ((currentTag != null) && currentTag.equals("S")) {
currentValue = "32768";
}
if (currentValue == null) {
currentValue = SystemProperties.get(SELECT_LOGD_DEFAULT_SIZE_PROPERTY);
if (currentValue == null) {
currentValue = "256K";
if (SystemProperties.get("ro.config.low_ram").equals("true")) {
currentValue = "64K";
} else {
currentValue = "256K";
}
}
}
String[] values = getResources().getStringArray(R.array.select_logd_size_values);
String[] titles = getResources().getStringArray(R.array.select_logd_size_titles);
int index = 2; // punt to second entry if not found
if (SystemProperties.get("ro.config.low_ram").equals("true")) {
mLogdSize.setEntries(R.array.select_logd_size_lowram_titles);
titles = getResources().getStringArray(R.array.select_logd_size_lowram_titles);
index = 1;
}
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 < titles.length; i++) {
if (currentValue.equals(values[i])
|| currentValue.equals(titles[i])) {
@@ -1291,6 +1301,13 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
if (currentValue != null) {
DEFAULT_LOG_RING_BUFFER_SIZE_IN_BYTES = currentValue;
}
boolean disable = (newValue != null) && (newValue.equals("32768"));
if (disable) {
newValue = "65536";
SystemProperties.set(SELECT_LOGD_TAG_PROPERTY, "S");
} else {
SystemProperties.set(SELECT_LOGD_TAG_PROPERTY, "");
}
final String size = (newValue != null) ?
newValue.toString() : DEFAULT_LOG_RING_BUFFER_SIZE_IN_BYTES;
SystemProperties.set(SELECT_LOGD_SIZE_PROPERTY, size);