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:
committed by
Mark Salyzyn
parent
20f1b207d0
commit
07d976e431
@@ -150,6 +150,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
|||||||
|
|
||||||
private static final int RESULT_DEBUG_APP = 1000;
|
private static final int RESULT_DEBUG_APP = 1000;
|
||||||
|
|
||||||
|
private static String DEFAULT_LOG_RING_BUFFER_SIZE_IN_BYTES = "262144"; // 256K
|
||||||
|
|
||||||
private IWindowManager mWindowManager;
|
private IWindowManager mWindowManager;
|
||||||
private IBackupManager mBackupManager;
|
private IBackupManager mBackupManager;
|
||||||
private DevicePolicyManager mDpm;
|
private DevicePolicyManager mDpm;
|
||||||
@@ -993,12 +995,16 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void writeLogdSizeOption(Object newValue) {
|
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();
|
pokeSystemProperties();
|
||||||
try {
|
try {
|
||||||
Process p = Runtime.getRuntime().exec("logcat -b all -G " + newValue.toString());
|
Process p = Runtime.getRuntime().exec("logcat -b all -G " + size);
|
||||||
int status = p.waitFor();
|
p.waitFor();
|
||||||
|
Log.i(TAG, "Logcat ring buffer sizes set to: " + size);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Log.w(TAG, "Cannot set logcat ring buffer sizes", e);
|
||||||
}
|
}
|
||||||
updateLogdSizeValues();
|
updateLogdSizeValues();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user