Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 04ecba71 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Make maximum size of an error report configurable."

parents 076fc6b9 d10fa306
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -10311,6 +10311,19 @@ public final class Settings {
         */
        public static final String ERROR_LOGCAT_PREFIX = "logcat_for_";
        /**
         * Maximum number of bytes of a system crash/ANR/etc. report that
         * ActivityManagerService should send to DropBox, as a prefix of the
         * dropbox tag of the report type. For example,
         * "max_error_bytes_for_system_server_anr" controls the maximum
         * number of bytes captured with system server ANR reports.
         * <p>
         * Type: int (max size in bytes)
         *
         * @hide
         */
        public static final String MAX_ERROR_BYTES_PREFIX = "max_error_bytes_for_";
        /**
         * The interval in minutes after which the amount of free storage left
         * on the device is logged to the event log
+2 −1
Original line number Diff line number Diff line
@@ -566,6 +566,7 @@ message GlobalSettingsProto {
    optional LowPowerMode low_power_mode = 70;

    optional SettingProto lte_service_forced = 71 [ (android.privacy).dest = DEST_AUTOMATIC ];
    repeated SettingProto max_error_bytes = 151;
    optional SettingProto mdc_initial_max_retry = 72 [ (android.privacy).dest = DEST_AUTOMATIC ];

    message Mhl {
@@ -1058,5 +1059,5 @@ message GlobalSettingsProto {

    // Please insert fields in alphabetical order and group them into messages
    // if possible (to avoid reaching the method limit).
    // Next tag = 151;
    // Next tag = 152;
}
+3 −0
Original line number Diff line number Diff line
@@ -691,6 +691,9 @@ class SettingsProtoDumpUtil {
        dumpRepeatedSetting(s, p,
                Settings.Global.ERROR_LOGCAT_PREFIX,
                GlobalSettingsProto.ERROR_LOGCAT_LINES);
        dumpRepeatedSetting(s, p,
                Settings.Global.MAX_ERROR_BYTES_PREFIX,
                GlobalSettingsProto.MAX_ERROR_BYTES);

        final long euiccToken = p.start(GlobalSettingsProto.EUICC);
        dumpSetting(s, p,
+1 −0
Original line number Diff line number Diff line
@@ -324,6 +324,7 @@ public class SettingsBackupTest {
                    Settings.Global.LOW_POWER_MODE_SUGGESTION_PARAMS,
                    Settings.Global.LTE_SERVICE_FORCED,
                    Settings.Global.LID_BEHAVIOR,
                    Settings.Global.MAX_ERROR_BYTES_PREFIX,
                    Settings.Global.MAX_NOTIFICATION_ENQUEUE_RATE,
                    Settings.Global.MAX_SOUND_TRIGGER_DETECTION_SERVICE_OPS_PER_DAY,
                    Settings.Global.MDC_INITIAL_MAX_RETRY,
+7 −4
Original line number Diff line number Diff line
@@ -490,7 +490,7 @@ public class ActivityManagerService extends IActivityManager.Stub
    static final String[] EMPTY_STRING_ARRAY = new String[0];
    // How many bytes to write into the dropbox log before truncating
    static final int DROPBOX_MAX_SIZE = 192 * 1024;
    static final int DROPBOX_DEFAULT_MAX_SIZE = 192 * 1024;
    // Assumes logcat entries average around 100 bytes; that's not perfect stack traces count
    // as one line, but close enough for now.
    static final int RESERVED_BYTES_PER_LOGCAT_LINE = 100;
@@ -9770,9 +9770,12 @@ public class ActivityManagerService extends IActivityManager.Stub
                    sb.append(report);
                }
                String setting = Settings.Global.ERROR_LOGCAT_PREFIX + dropboxTag;
                int lines = Settings.Global.getInt(mContext.getContentResolver(), setting, 0);
                int maxDataFileSize = DROPBOX_MAX_SIZE - sb.length()
                String logcatSetting = Settings.Global.ERROR_LOGCAT_PREFIX + dropboxTag;
                String maxBytesSetting = Settings.Global.MAX_ERROR_BYTES_PREFIX + dropboxTag;
                int lines = Settings.Global.getInt(mContext.getContentResolver(), logcatSetting, 0);
                int dropboxMaxSize = Settings.Global.getInt(
                        mContext.getContentResolver(), maxBytesSetting, DROPBOX_DEFAULT_MAX_SIZE);
                int maxDataFileSize = dropboxMaxSize - sb.length()
                        - lines * RESERVED_BYTES_PER_LOGCAT_LINE;
                if (dataFile != null && maxDataFileSize > 0) {