summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2019-12-16 10:44:02 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-12-16 10:44:02 +0000
commit04ecba71fa76e87fcc4aa988ee929e405f984c19 (patch)
tree05ef52ede0929def026fffdbf46a2a08be87d133
parent076fc6b9514148071d0ae6406feaf518c0990774 (diff)
parentd10fa3065828bf7aeff4f70dc41f8d6c4c2a1512 (diff)
Merge "Make maximum size of an error report configurable."
-rw-r--r--core/java/android/provider/Settings.java13
-rw-r--r--core/proto/android/providers/settings/global.proto3
-rw-r--r--packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java3
-rw-r--r--packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java1
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java11
5 files changed, 26 insertions, 5 deletions
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 165c2843301c..bd1eb21175cf 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -10312,6 +10312,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
*
diff --git a/core/proto/android/providers/settings/global.proto b/core/proto/android/providers/settings/global.proto
index 31c19ca1be70..a98d7db11913 100644
--- a/core/proto/android/providers/settings/global.proto
+++ b/core/proto/android/providers/settings/global.proto
@@ -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;
}
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
index 0a2dd3826822..80077c802def 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
@@ -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,
diff --git a/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java b/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
index c23a494d3312..d5a3254d6fc1 100644
--- a/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
+++ b/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
@@ -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,
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index a21c2d09dc9c..b55d6ada5ffb 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -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) {