diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index 2288520..cd3c5ee 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -148,6 +148,13 @@
             android:entries="@array/select_logd_size_titles"
             android:entryValues="@array/select_logd_size_values" />
 
+        <ListPreference
+            android:key="select_logpersist"
+            android:title="@string/select_logpersist_title"
+            android:dialogTitle="@string/select_logpersist_dialog_title"
+            android:entries="@array/select_logpersist_titles"
+            android:entryValues="@array/select_logpersist_values" />
+
     </PreferenceCategory>
 
     <PreferenceCategory android:key="debug_networking_category"
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 794951b..c988e31 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -172,6 +172,15 @@
     // 32768 is merely a menu marker, 64K is our lowest log buffer size we replace it with.
     private static final String SELECT_LOGD_MINIMUM_SIZE_VALUE = "65536";
     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";
@@ -274,6 +283,7 @@
     private SwitchPreference mForceRtlLayout;
     private ListPreference mDebugHwOverdraw;
     private ListPreference mLogdSize;
+    private ListPreference mLogpersist;
     private ListPreference mUsbConfiguration;
     private ListPreference mTrackFrameTime;
     private ListPreference mShowNonRectClip;
@@ -314,6 +324,9 @@
     private Dialog mAdbKeysDialog;
     private boolean mUnavailable;
 
+    private boolean mLogpersistCleared;
+    private Dialog mLogpersistClearDialog;
+
     public DevelopmentSettings() {
         super(UserManager.DISALLOW_DEBUGGING_FEATURES);
     }
@@ -426,6 +439,18 @@
         mWifiAllowScansWithTraffic = findAndInitSwitchPref(WIFI_ALLOW_SCAN_WITH_TRAFFIC_KEY);
         mMobileDataAlwaysOn = findAndInitSwitchPref(MOBILE_DATA_ALWAYS_ON);
         mLogdSize = addListPreference(SELECT_LOGD_SIZE_KEY);
+        if ("1".equals(SystemProperties.get("ro.debuggable", "0"))) {
+            mLogpersist = addListPreference(SELECT_LOGPERSIST_KEY);
+        } else {
+            mLogpersist = (ListPreference) findPreference(SELECT_LOGPERSIST_KEY);
+            if (mLogpersist != null) {
+                mLogpersist.setEnabled(false);
+                if (debugDebuggingCategory != null) {
+                    debugDebuggingCategory.removePreference(mLogpersist);
+                }
+            }
+            mLogpersist = null;
+        }
         mUsbConfiguration = addListPreference(USB_CONFIGURATION_KEY);
         mWebViewProvider = addListPreference(WEBVIEW_PROVIDER_KEY);
         mWebViewMultiprocess = findAndInitSwitchPref(WEBVIEW_MULTIPROCESS_KEY);
@@ -694,6 +719,7 @@
         updateBugreportOptions();
         updateForceRtlOptions();
         updateLogdSizeValues();
+        updateLogpersistValues();
         updateWifiDisplayCertificationOptions();
         updateWifiVerboseLoggingOptions();
         updateWifiAggressiveHandoverOptions();
@@ -721,6 +747,7 @@
             }
         }
         resetDebuggerOptions();
+        writeLogpersistOption(null, true);
         writeLogdSizeOption(null);
         writeAnimationScaleOption(0, mWindowAnimationScale, null);
         writeAnimationScaleOption(1, mTransitionAnimationScale, null);
@@ -1460,6 +1487,18 @@
             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 (mLastEnabledState) {
+                    mLogpersist.setEnabled(true);
+                }
+            }
             if ((currentValue == null) || (currentValue.length() == 0)) {
                 currentValue = defaultLogdSizeValue();
             }
@@ -1527,6 +1566,131 @@
         updateLogdSizeValues();
     }
 
+    private void updateLogpersistValues() {
+        if (mLogpersist == null) {
+            return;
+        }
+        String currentValue = SystemProperties.get(ACTUAL_LOGPERSIST_PROPERTY);
+        if (currentValue == null) {
+            currentValue = "";
+        }
+        String currentBuffers = SystemProperties.get(ACTUAL_LOGPERSIST_PROPERTY_BUFFER);
+        if ((currentBuffers == null) || (currentBuffers.length() == 0)) {
+            currentBuffers = "all";
+        }
+        int index = 0;
+        if (currentValue.equals(SELECT_LOGPERSIST_PROPERTY_SERVICE)) {
+            index = 1;
+            if (currentBuffers.equals("kernel")) {
+                index = 3;
+            } else if (!currentBuffers.equals("all") &&
+                    !currentBuffers.contains("radio") &&
+                    currentBuffers.contains("security") &&
+                    currentBuffers.contains("kernel")) {
+                index = 2;
+                if (!currentBuffers.contains("default")) {
+                    String[] contains = { "main", "events", "system", "crash" };
+                    for (int i = 0; i < contains.length; i++) {
+                        if (!currentBuffers.contains(contains[i])) {
+                            index = 1;
+                            break;
+                        }
+                    }
+                }
+            }
+        }
+        mLogpersist.setValue(getResources().getStringArray(R.array.select_logpersist_values)[index]);
+        mLogpersist.setSummary(getResources().getStringArray(R.array.select_logpersist_summaries)[index]);
+        mLogpersist.setOnPreferenceChangeListener(this);
+        if (index != 0) {
+            mLogpersistCleared = false;
+        } else if (!mLogpersistCleared) {
+            // would File.delete() directly but need to switch uid/gid to access
+            SystemProperties.set(ACTUAL_LOGPERSIST_PROPERTY, SELECT_LOGPERSIST_PROPERTY_CLEAR);
+            pokeSystemProperties();
+            mLogpersistCleared = true;
+        }
+    }
+
+    private void setLogpersistOff(boolean update) {
+        SystemProperties.set(SELECT_LOGPERSIST_PROPERTY_BUFFER, "");
+        // 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) {
+                }
+            }
+        }
+    }
+
+    private void writeLogpersistOption(Object newValue, boolean skipWarning) {
+        if (mLogpersist == null) {
+            return;
+        }
+        String currentTag = SystemProperties.get(SELECT_LOGD_TAG_PROPERTY);
+        if ((currentTag != null) && currentTag.startsWith(SELECT_LOGD_TAG_SILENCE)) {
+            newValue = null;
+            skipWarning = true;
+        }
+
+        if ((newValue == null) || newValue.toString().equals("")) {
+            if (skipWarning) {
+                mLogpersistCleared = false;
+            } else if (!mLogpersistCleared) {
+                // if transitioning from on to off, pop up an are you sure?
+                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(
+                                    R.string.dev_logpersist_clear_warning_message))
+                            .setTitle(R.string.dev_logpersist_clear_warning_title)
+                            .setPositiveButton(android.R.string.yes, this)
+                            .setNegativeButton(android.R.string.no, this)
+                            .show();
+                    mLogpersistClearDialog.setOnDismissListener(this);
+                    return;
+                }
+            }
+            setLogpersistOff(true);
+            return;
+        }
+
+        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();
+    }
+
     private void updateUsbConfigurationValues() {
         if (mUsbConfiguration != null) {
             UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE);
@@ -1957,6 +2121,9 @@
         } else if (preference == mLogdSize) {
             writeLogdSizeOption(newValue);
             return true;
+        } else if (preference == mLogpersist) {
+            writeLogpersistOption(newValue, false);
+            return true;
         } else if (preference == mUsbConfiguration) {
             writeUsbConfigurationOption(newValue);
             return true;
@@ -2004,6 +2171,10 @@
             mEnableDialog.dismiss();
             mEnableDialog = null;
         }
+        if (mLogpersistClearDialog != null) {
+            mLogpersistClearDialog.dismiss();
+            mLogpersistClearDialog = null;
+        }
     }
 
     public void onClick(DialogInterface dialog, int which) {
@@ -2040,6 +2211,12 @@
                 // Reset the toggle
                 mSwitchBar.setChecked(false);
             }
+        } else if (dialog == mLogpersistClearDialog) {
+            if (which == DialogInterface.BUTTON_POSITIVE) {
+                setLogpersistOff(true);
+            } else {
+                updateLogpersistValues();
+            }
         }
     }
 
@@ -2055,6 +2232,8 @@
                 mSwitchBar.setChecked(false);
             }
             mEnableDialog = null;
+        } else if (dialog == mLogpersistClearDialog) {
+            mLogpersistClearDialog = null;
         }
     }
 
