summaryrefslogtreecommitdiff
path: root/core/java/android/app/RemoteServiceException.java
diff options
context:
space:
mode:
authorLi Li <dualli@google.com>2022-11-18 13:30:36 -0800
committerLi Li <dualli@google.com>2022-11-19 03:25:28 +0000
commitc7ece382b79d3eb54029ff7fde7adadab5348e6c (patch)
treef03d8b4328546250908cd76101676148f4992ffe /core/java/android/app/RemoteServiceException.java
parent31944123ba298d761532b3e339a1400b495693f1 (diff)
Stop using CannotDeliverBroadcastException
This is a squashed CL. Due to significant BroadcastQueue rearchitecture in master branch, the original CL can't be directly cherry-picked here. This CL combines code from the following CLs: ag/20498660 Stop using CannotDeliverBroadcastException ag/20516440 Add killing subreason for undelivered broadcast === Original commit message === This crash behavior was introduced a long time ago to show a crash dialog if the broadcast couldn't be delivered (b/28196243). Android has changed a lot since then. The crash dialog won't be shown to the user as it impacts user experience, especially when the app is in the background. Furthermore, this CannotDeliverBroadcastException crashes the app with the same callstack, without any useful information for app developers to debug the issue. And it pollutes the app crashlytics stats in a negative way so app developers choose to suppress it (b/245258072). This exception is hidden and not documented at developers.android.com. Let's stop sending it to apps. Kill the app gently instead (as what's already mentioned in the comments). Bug: 239419108 Test: atest ApplicationExitInfoTest Test: atest BroadcastQueueTest Test: observe app is killed gently on failed broadcast (instead of crash) Test: use up async buffer, broadcast & dumpsys activity exit-info Change-Id: I93aabe99167105111f9f3bd945cf4977cfb8cdb1 Merged-In: I93aabe99167105111f9f3bd945cf4977cfb8cdb1
Diffstat (limited to 'core/java/android/app/RemoteServiceException.java')
-rw-r--r--core/java/android/app/RemoteServiceException.java23
1 files changed, 4 insertions, 19 deletions
diff --git a/core/java/android/app/RemoteServiceException.java b/core/java/android/app/RemoteServiceException.java
index e220627706f9..620adbedc903 100644
--- a/core/java/android/app/RemoteServiceException.java
+++ b/core/java/android/app/RemoteServiceException.java
@@ -72,21 +72,6 @@ public class RemoteServiceException extends AndroidRuntimeException {
/**
* Exception used to crash an app process when the system received a RemoteException
- * while delivering a broadcast to an app process.
- *
- * @hide
- */
- public static class CannotDeliverBroadcastException extends RemoteServiceException {
- /** The type ID passed to {@link IApplicationThread#scheduleCrash}. */
- public static final int TYPE_ID = 2;
-
- public CannotDeliverBroadcastException(String msg) {
- super(msg);
- }
- }
-
- /**
- * Exception used to crash an app process when the system received a RemoteException
* while posting a notification of a foreground service.
*
* @hide
@@ -94,7 +79,7 @@ public class RemoteServiceException extends AndroidRuntimeException {
public static class CannotPostForegroundServiceNotificationException
extends RemoteServiceException {
/** The type ID passed to {@link IApplicationThread#scheduleCrash}. */
- public static final int TYPE_ID = 3;
+ public static final int TYPE_ID = 2;
public CannotPostForegroundServiceNotificationException(String msg) {
super(msg);
@@ -109,7 +94,7 @@ public class RemoteServiceException extends AndroidRuntimeException {
*/
public static class BadForegroundServiceNotificationException extends RemoteServiceException {
/** The type ID passed to {@link IApplicationThread#scheduleCrash}. */
- public static final int TYPE_ID = 4;
+ public static final int TYPE_ID = 3;
public BadForegroundServiceNotificationException(String msg) {
super(msg);
@@ -125,7 +110,7 @@ public class RemoteServiceException extends AndroidRuntimeException {
public static class MissingRequestPasswordComplexityPermissionException
extends RemoteServiceException {
/** The type ID passed to {@link IApplicationThread#scheduleCrash}. */
- public static final int TYPE_ID = 5;
+ public static final int TYPE_ID = 4;
public MissingRequestPasswordComplexityPermissionException(String msg) {
super(msg);
@@ -139,7 +124,7 @@ public class RemoteServiceException extends AndroidRuntimeException {
*/
public static class CrashedByAdbException extends RemoteServiceException {
/** The type ID passed to {@link IApplicationThread#scheduleCrash}. */
- public static final int TYPE_ID = 6;
+ public static final int TYPE_ID = 5;
public CrashedByAdbException(String msg) {
super(msg);