Loading src/com/android/settings/DevelopmentSettings.java +47 −14 Original line number Diff line number Diff line Loading @@ -161,10 +161,13 @@ public class DevelopmentSettings extends SettingsPreferenceFragment private static final String SELECT_LOGD_OFF_SIZE_MARKER_VALUE = "32768"; private static final String SELECT_LOGPERSIST_KEY = "select_logpersist"; private static final String SELECT_LOGPERSIST_PROPERTY = "persist.logd.logpersistd"; private static final String ACTUAL_LOGPERSIST_PROPERTY = "logd.logpersistd"; private static final String SELECT_LOGPERSIST_PROPERTY_SERVICE = "logcatd"; private static final String SELECT_LOGPERSIST_PROPERTY_CLEAR = "clear"; private static final String SELECT_LOGPERSIST_PROPERTY_STOP = "stop"; private static final String SELECT_LOGPERSIST_PROPERTY_BUFFER = "persist.logd.logpersistd.buffer"; private static final String ACTUAL_LOGPERSIST_PROPERTY_BUFFER = "logd.logpersistd.buffer"; private static final String ACTUAL_LOGPERSIST_PROPERTY_ENABLE = "logd.logpersistd.enable"; private static final String WIFI_DISPLAY_CERTIFICATION_KEY = "wifi_display_certification"; private static final String WIFI_VERBOSE_LOGGING_KEY = "wifi_verbose_logging"; Loading Loading @@ -1355,12 +1358,16 @@ public class DevelopmentSettings extends SettingsPreferenceFragment String currentValue = SystemProperties.get(SELECT_LOGD_SIZE_PROPERTY); if ((currentTag != null) && currentTag.startsWith(SELECT_LOGD_TAG_SILENCE)) { currentValue = SELECT_LOGD_OFF_SIZE_MARKER_VALUE; } if (mLogpersist != null) { String currentLogpersistEnable = SystemProperties.get(ACTUAL_LOGPERSIST_PROPERTY_ENABLE); if ((currentLogpersistEnable == null) || !currentLogpersistEnable.equals("true") || currentValue.equals(SELECT_LOGD_OFF_SIZE_MARKER_VALUE)) { writeLogpersistOption(null, true); mLogpersist.setEnabled(false); } } else { if ((mLogpersist != null) && mLastEnabledState) { } else if (mLastEnabledState) { mLogpersist.setEnabled(true); } } Loading Loading @@ -1435,11 +1442,11 @@ public class DevelopmentSettings extends SettingsPreferenceFragment if (mLogpersist == null) { return; } String currentValue = SystemProperties.get(SELECT_LOGPERSIST_PROPERTY); String currentValue = SystemProperties.get(ACTUAL_LOGPERSIST_PROPERTY); if (currentValue == null) { currentValue = ""; } String currentBuffers = SystemProperties.get(SELECT_LOGPERSIST_PROPERTY_BUFFER); String currentBuffers = SystemProperties.get(ACTUAL_LOGPERSIST_PROPERTY_BUFFER); if ((currentBuffers == null) || (currentBuffers.length() == 0)) { currentBuffers = "all"; } Loading Loading @@ -1471,7 +1478,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment mLogpersistCleared = false; } else if (!mLogpersistCleared) { // would File.delete() directly but need to switch uid/gid to access SystemProperties.set(SELECT_LOGPERSIST_PROPERTY, SELECT_LOGPERSIST_PROPERTY_CLEAR); SystemProperties.set(ACTUAL_LOGPERSIST_PROPERTY, SELECT_LOGPERSIST_PROPERTY_CLEAR); pokeSystemProperties(); mLogpersistCleared = true; } Loading @@ -1479,11 +1486,25 @@ public class DevelopmentSettings extends SettingsPreferenceFragment private void setLogpersistOff(boolean update) { SystemProperties.set(SELECT_LOGPERSIST_PROPERTY_BUFFER, ""); SystemProperties.set(SELECT_LOGPERSIST_PROPERTY, // deal with trampoline of empty properties SystemProperties.set(ACTUAL_LOGPERSIST_PROPERTY_BUFFER, ""); SystemProperties.set(SELECT_LOGPERSIST_PROPERTY, ""); SystemProperties.set(ACTUAL_LOGPERSIST_PROPERTY, update ? "" : SELECT_LOGPERSIST_PROPERTY_STOP); pokeSystemProperties(); if (update) { updateLogpersistValues(); } else { for (int i = 0; i < 3; i++) { String currentValue = SystemProperties.get(ACTUAL_LOGPERSIST_PROPERTY); if ((currentValue == null) || currentValue.equals("")) { break; } try { Thread.sleep(100); } catch (InterruptedException e) { } } } } Loading @@ -1502,8 +1523,9 @@ public class DevelopmentSettings extends SettingsPreferenceFragment mLogpersistCleared = false; } else if (!mLogpersistCleared) { // if transitioning from on to off, pop up an are you sure? String currentValue = SystemProperties.get(SELECT_LOGPERSIST_PROPERTY); if ((currentValue != null) && (currentValue.length() != 0)) { String currentValue = SystemProperties.get(ACTUAL_LOGPERSIST_PROPERTY); if ((currentValue != null) && currentValue.equals(SELECT_LOGPERSIST_PROPERTY_SERVICE)) { if (mLogpersistClearDialog != null) dismissDialogs(); mLogpersistClearDialog = new AlertDialog.Builder(getActivity()).setMessage( getActivity().getResources().getString( Loading @@ -1520,13 +1542,24 @@ public class DevelopmentSettings extends SettingsPreferenceFragment return; } String currentBuffer = SystemProperties.get(SELECT_LOGPERSIST_PROPERTY_BUFFER); String currentBuffer = SystemProperties.get(ACTUAL_LOGPERSIST_PROPERTY_BUFFER); if ((currentBuffer != null) && !currentBuffer.equals(newValue.toString())) { setLogpersistOff(false); } SystemProperties.set(SELECT_LOGPERSIST_PROPERTY_BUFFER, newValue.toString()); SystemProperties.set(SELECT_LOGPERSIST_PROPERTY, SELECT_LOGPERSIST_PROPERTY_SERVICE); pokeSystemProperties(); for (int i = 0; i < 3; i++) { String currentValue = SystemProperties.get(ACTUAL_LOGPERSIST_PROPERTY); if ((currentValue != null) && currentValue.equals(SELECT_LOGPERSIST_PROPERTY_SERVICE)) { break; } try { Thread.sleep(100); } catch (InterruptedException e) { } } updateLogpersistValues(); } Loading Loading
src/com/android/settings/DevelopmentSettings.java +47 −14 Original line number Diff line number Diff line Loading @@ -161,10 +161,13 @@ public class DevelopmentSettings extends SettingsPreferenceFragment private static final String SELECT_LOGD_OFF_SIZE_MARKER_VALUE = "32768"; private static final String SELECT_LOGPERSIST_KEY = "select_logpersist"; private static final String SELECT_LOGPERSIST_PROPERTY = "persist.logd.logpersistd"; private static final String ACTUAL_LOGPERSIST_PROPERTY = "logd.logpersistd"; private static final String SELECT_LOGPERSIST_PROPERTY_SERVICE = "logcatd"; private static final String SELECT_LOGPERSIST_PROPERTY_CLEAR = "clear"; private static final String SELECT_LOGPERSIST_PROPERTY_STOP = "stop"; private static final String SELECT_LOGPERSIST_PROPERTY_BUFFER = "persist.logd.logpersistd.buffer"; private static final String ACTUAL_LOGPERSIST_PROPERTY_BUFFER = "logd.logpersistd.buffer"; private static final String ACTUAL_LOGPERSIST_PROPERTY_ENABLE = "logd.logpersistd.enable"; private static final String WIFI_DISPLAY_CERTIFICATION_KEY = "wifi_display_certification"; private static final String WIFI_VERBOSE_LOGGING_KEY = "wifi_verbose_logging"; Loading Loading @@ -1355,12 +1358,16 @@ public class DevelopmentSettings extends SettingsPreferenceFragment String currentValue = SystemProperties.get(SELECT_LOGD_SIZE_PROPERTY); if ((currentTag != null) && currentTag.startsWith(SELECT_LOGD_TAG_SILENCE)) { currentValue = SELECT_LOGD_OFF_SIZE_MARKER_VALUE; } if (mLogpersist != null) { String currentLogpersistEnable = SystemProperties.get(ACTUAL_LOGPERSIST_PROPERTY_ENABLE); if ((currentLogpersistEnable == null) || !currentLogpersistEnable.equals("true") || currentValue.equals(SELECT_LOGD_OFF_SIZE_MARKER_VALUE)) { writeLogpersistOption(null, true); mLogpersist.setEnabled(false); } } else { if ((mLogpersist != null) && mLastEnabledState) { } else if (mLastEnabledState) { mLogpersist.setEnabled(true); } } Loading Loading @@ -1435,11 +1442,11 @@ public class DevelopmentSettings extends SettingsPreferenceFragment if (mLogpersist == null) { return; } String currentValue = SystemProperties.get(SELECT_LOGPERSIST_PROPERTY); String currentValue = SystemProperties.get(ACTUAL_LOGPERSIST_PROPERTY); if (currentValue == null) { currentValue = ""; } String currentBuffers = SystemProperties.get(SELECT_LOGPERSIST_PROPERTY_BUFFER); String currentBuffers = SystemProperties.get(ACTUAL_LOGPERSIST_PROPERTY_BUFFER); if ((currentBuffers == null) || (currentBuffers.length() == 0)) { currentBuffers = "all"; } Loading Loading @@ -1471,7 +1478,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment mLogpersistCleared = false; } else if (!mLogpersistCleared) { // would File.delete() directly but need to switch uid/gid to access SystemProperties.set(SELECT_LOGPERSIST_PROPERTY, SELECT_LOGPERSIST_PROPERTY_CLEAR); SystemProperties.set(ACTUAL_LOGPERSIST_PROPERTY, SELECT_LOGPERSIST_PROPERTY_CLEAR); pokeSystemProperties(); mLogpersistCleared = true; } Loading @@ -1479,11 +1486,25 @@ public class DevelopmentSettings extends SettingsPreferenceFragment private void setLogpersistOff(boolean update) { SystemProperties.set(SELECT_LOGPERSIST_PROPERTY_BUFFER, ""); SystemProperties.set(SELECT_LOGPERSIST_PROPERTY, // deal with trampoline of empty properties SystemProperties.set(ACTUAL_LOGPERSIST_PROPERTY_BUFFER, ""); SystemProperties.set(SELECT_LOGPERSIST_PROPERTY, ""); SystemProperties.set(ACTUAL_LOGPERSIST_PROPERTY, update ? "" : SELECT_LOGPERSIST_PROPERTY_STOP); pokeSystemProperties(); if (update) { updateLogpersistValues(); } else { for (int i = 0; i < 3; i++) { String currentValue = SystemProperties.get(ACTUAL_LOGPERSIST_PROPERTY); if ((currentValue == null) || currentValue.equals("")) { break; } try { Thread.sleep(100); } catch (InterruptedException e) { } } } } Loading @@ -1502,8 +1523,9 @@ public class DevelopmentSettings extends SettingsPreferenceFragment mLogpersistCleared = false; } else if (!mLogpersistCleared) { // if transitioning from on to off, pop up an are you sure? String currentValue = SystemProperties.get(SELECT_LOGPERSIST_PROPERTY); if ((currentValue != null) && (currentValue.length() != 0)) { String currentValue = SystemProperties.get(ACTUAL_LOGPERSIST_PROPERTY); if ((currentValue != null) && currentValue.equals(SELECT_LOGPERSIST_PROPERTY_SERVICE)) { if (mLogpersistClearDialog != null) dismissDialogs(); mLogpersistClearDialog = new AlertDialog.Builder(getActivity()).setMessage( getActivity().getResources().getString( Loading @@ -1520,13 +1542,24 @@ public class DevelopmentSettings extends SettingsPreferenceFragment return; } String currentBuffer = SystemProperties.get(SELECT_LOGPERSIST_PROPERTY_BUFFER); String currentBuffer = SystemProperties.get(ACTUAL_LOGPERSIST_PROPERTY_BUFFER); if ((currentBuffer != null) && !currentBuffer.equals(newValue.toString())) { setLogpersistOff(false); } SystemProperties.set(SELECT_LOGPERSIST_PROPERTY_BUFFER, newValue.toString()); SystemProperties.set(SELECT_LOGPERSIST_PROPERTY, SELECT_LOGPERSIST_PROPERTY_SERVICE); pokeSystemProperties(); for (int i = 0; i < 3; i++) { String currentValue = SystemProperties.get(ACTUAL_LOGPERSIST_PROPERTY); if ((currentValue != null) && currentValue.equals(SELECT_LOGPERSIST_PROPERTY_SERVICE)) { break; } try { Thread.sleep(100); } catch (InterruptedException e) { } } updateLogpersistValues(); } Loading