Settings: crashing when turning ON<>OFF developer option. DO NOT MERGE

- prevent NPE
- define default value (to 256K)
- add more logs for showing value which has been set or any exception

Bug: 15687210
Change-Id: I8f067f14d81ee56631d1ad74b91b5ede26cae125
This commit is contained in:
Fabrice Di Meglio
2014-06-17 09:33:03 -07:00
committed by Mark Salyzyn
parent 20f1b207d0
commit 07d976e431

View File

@@ -150,6 +150,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
private static final int RESULT_DEBUG_APP = 1000;
private static String DEFAULT_LOG_RING_BUFFER_SIZE_IN_BYTES = "262144"; // 256K
private IWindowManager mWindowManager;
private IBackupManager mBackupManager;
private DevicePolicyManager mDpm;
@@ -993,12 +995,16 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
}
private void writeLogdSizeOption(Object newValue) {
SystemProperties.set(SELECT_LOGD_SIZE_PROPERTY, newValue.toString());
final String size = (newValue != null) ?
newValue.toString() : DEFAULT_LOG_RING_BUFFER_SIZE_IN_BYTES;
SystemProperties.set(SELECT_LOGD_SIZE_PROPERTY, size);
pokeSystemProperties();
try {
Process p = Runtime.getRuntime().exec("logcat -b all -G " + newValue.toString());
int status = p.waitFor();
Process p = Runtime.getRuntime().exec("logcat -b all -G " + size);
p.waitFor();
Log.i(TAG, "Logcat ring buffer sizes set to: " + size);
} catch (Exception e) {
Log.w(TAG, "Cannot set logcat ring buffer sizes", e);
}
updateLogdSizeValues();
}