diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 920bcc77f1a7f..1d41df23dee70 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -3598,6 +3598,14 @@ public final class Settings { public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT = "search_per_source_concurrent_query_limit"; + /** + * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR intents + * on application crashes and ANRs. If this is disabled, the crash/ANR dialog + * will never display the "Report" button. + * Type: int ( 0 = disallow, 1 = allow ) + */ + public static final String SEND_ACTION_APP_ERROR = "send_action_app_error"; + /** * @deprecated * @hide diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index e3306145b6d73..e0cc07ff7a54e 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -8432,6 +8432,13 @@ public final class ActivityManagerService extends ActivityManagerNative implemen } private ComponentName getErrorReportReceiver(ProcessRecord app) { + // check if error reporting is enabled in Gservices + int enabled = Settings.Gservices.getInt(mContext.getContentResolver(), + Settings.Gservices.SEND_ACTION_APP_ERROR, 0); + if (enabled == 0) { + return null; + } + IPackageManager pm = ActivityThread.getPackageManager(); try {