summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/provider/Settings.java16
-rw-r--r--core/proto/android/providers/settings.proto6
-rw-r--r--core/tests/coretests/src/android/provider/SettingsBackupTest.java1
-rw-r--r--packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java6
-rw-r--r--services/core/java/com/android/server/am/AppErrors.java11
5 files changed, 37 insertions, 3 deletions
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 24e56c0598b2..396c897c7047 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -6562,6 +6562,14 @@ public final class Settings {
public static final String ANR_SHOW_BACKGROUND = "anr_show_background";
/**
+ * If nonzero, crashes in foreground processes will bring up a dialog.
+ * Otherwise, the process will be silently killed.
+ * @hide
+ */
+ public static final String SHOW_FIRST_CRASH_DIALOG_DEV_OPTION =
+ "show_first_crash_dialog_dev_option";
+
+ /**
* The {@link ComponentName} string of the service to be used as the voice recognition
* service.
*
@@ -7398,6 +7406,7 @@ public final class Settings {
SCREENSAVER_ACTIVATE_ON_DOCK,
SCREENSAVER_ACTIVATE_ON_SLEEP,
LOCKDOWN_IN_POWER_MENU,
+ SHOW_FIRST_CRASH_DIALOG_DEV_OPTION,
};
/** @hide */
@@ -11316,6 +11325,13 @@ public final class Settings {
*/
public static final String ENABLE_SMART_REPLIES_IN_NOTIFICATIONS =
"enable_smart_replies_in_notifications";
+
+ /**
+ * If nonzero, crashes in foreground processes will bring up a dialog.
+ * Otherwise, the process will be silently killed.
+ * @hide
+ */
+ public static final String SHOW_FIRST_CRASH_DIALOG = "show_first_crash_dialog";
}
/**
diff --git a/core/proto/android/providers/settings.proto b/core/proto/android/providers/settings.proto
index 3ffb254b2333..8d6df12d56dd 100644
--- a/core/proto/android/providers/settings.proto
+++ b/core/proto/android/providers/settings.proto
@@ -390,8 +390,9 @@ message GlobalSettingsProto {
optional SettingProto enable_gnss_raw_meas_full_tracking = 346;
optional SettingProto zram_enabled = 347;
optional SettingProto enable_smart_replies_in_notifications = 348;
+ optional SettingProto show_first_crash_dialog = 349;
- // Next tag = 349;
+ // Next tag = 350;
}
message SecureSettingsProto {
@@ -593,8 +594,9 @@ message SecureSettingsProto {
optional SettingProto qs_auto_added_tiles = 193;
optional SettingProto lockdown_in_power_menu = 194;
optional SettingProto backup_manager_constants = 169;
+ optional SettingProto show_first_crash_dialog_dev_option = 195;
- // Next tag = 195
+ // Next tag = 196
}
message SystemSettingsProto {
diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
index d5689c7539a1..c2ae7760c80e 100644
--- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java
+++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
@@ -331,6 +331,7 @@ public class SettingsBackupTest {
Settings.Global.SETUP_PREPAID_DETECTION_REDIR_HOST,
Settings.Global.SETUP_PREPAID_DETECTION_TARGET_URL,
Settings.Global.SHORTCUT_MANAGER_CONSTANTS,
+ Settings.Global.SHOW_FIRST_CRASH_DIALOG,
Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS,
Settings.Global.SHOW_TEMPERATURE_WARNING,
Settings.Global.SMART_SELECTION_UPDATE_CONTENT_URL,
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
index d33e0841a906..87ed7eb705e9 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
@@ -1125,6 +1125,9 @@ class SettingsProtoDumpUtil {
dumpSetting(s, p,
Settings.Global.ENABLE_SMART_REPLIES_IN_NOTIFICATIONS,
GlobalSettingsProto.ENABLE_SMART_REPLIES_IN_NOTIFICATIONS);
+ dumpSetting(s, p,
+ Settings.Global.SHOW_FIRST_CRASH_DIALOG,
+ GlobalSettingsProto.SHOW_FIRST_CRASH_DIALOG);
}
/** Dump a single {@link SettingsState.Setting} to a proto buf */
@@ -1516,6 +1519,9 @@ class SettingsProtoDumpUtil {
Settings.Secure.ANR_SHOW_BACKGROUND,
SecureSettingsProto.ANR_SHOW_BACKGROUND);
dumpSetting(s, p,
+ Settings.Secure.SHOW_FIRST_CRASH_DIALOG_DEV_OPTION,
+ SecureSettingsProto.SHOW_FIRST_CRASH_DIALOG_DEV_OPTION);
+ dumpSetting(s, p,
Settings.Secure.VOICE_RECOGNITION_SERVICE,
SecureSettingsProto.VOICE_RECOGNITION_SERVICE);
dumpSetting(s, p,
diff --git a/services/core/java/com/android/server/am/AppErrors.java b/services/core/java/com/android/server/am/AppErrors.java
index 35465a7933fc..89102748796a 100644
--- a/services/core/java/com/android/server/am/AppErrors.java
+++ b/services/core/java/com/android/server/am/AppErrors.java
@@ -738,9 +738,18 @@ class AppErrors {
}
return;
}
+ final boolean showFirstCrash = Settings.Global.getInt(
+ mContext.getContentResolver(),
+ Settings.Global.SHOW_FIRST_CRASH_DIALOG, 0) != 0;
+ final boolean showFirstCrashDevOption = Settings.Secure.getIntForUser(
+ mContext.getContentResolver(),
+ Settings.Secure.SHOW_FIRST_CRASH_DIALOG_DEV_OPTION,
+ 0,
+ UserHandle.USER_CURRENT) != 0;
final boolean crashSilenced = mAppsNotReportingCrashes != null &&
mAppsNotReportingCrashes.contains(proc.info.packageName);
- if ((mService.canShowErrorDialogs() || showBackground) && !crashSilenced) {
+ if ((mService.canShowErrorDialogs() || showBackground) && !crashSilenced
+ && (showFirstCrash || showFirstCrashDevOption || data.repeating)) {
proc.crashDialog = new AppErrorDialog(mContext, mService, data);
} else {
// The device is asleep, so just pretend that the user