From 07d976e431527add98c951065a58ee63de048a16 Mon Sep 17 00:00:00 2001 From: Fabrice Di Meglio Date: Tue, 17 Jun 2014 09:33:03 -0700 Subject: 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 --- src/com/android/settings/DevelopmentSettings.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java index a16f8b6..8cda9bb 100644 --- a/src/com/android/settings/DevelopmentSettings.java +++ b/src/com/android/settings/DevelopmentSettings.java @@ -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(); } -- cgit v1.1