Add killing subreason for undelivered broadcast
Bug: 239419108 Test: atest ApplicationExitInfoTest Test: atest BroadcastQueueTest Test: use up async buffer, broadcast & dumpsys activity exit-info Change-Id: I6a1b8c5a96963af624b8254753c8d8c364d0bc78
This commit is contained in:
@@ -407,6 +407,15 @@ public final class ApplicationExitInfo implements Parcelable {
|
||||
*/
|
||||
public static final int SUBREASON_PACKAGE_UPDATE = 25;
|
||||
|
||||
/**
|
||||
* The process was killed because of undelivered broadcasts; this would be set only when the
|
||||
* reason is {@link #REASON_OTHER}.
|
||||
*
|
||||
* For internal use only.
|
||||
* @hide
|
||||
*/
|
||||
public static final int SUBREASON_UNDELIVERED_BROADCAST = 26;
|
||||
|
||||
// If there is any OEM code which involves additional app kill reasons, it should
|
||||
// be categorized in {@link #REASON_OTHER}, with subreason code starting from 1000.
|
||||
|
||||
@@ -579,6 +588,7 @@ public final class ApplicationExitInfo implements Parcelable {
|
||||
SUBREASON_STOP_APP,
|
||||
SUBREASON_KILL_BACKGROUND,
|
||||
SUBREASON_PACKAGE_UPDATE,
|
||||
SUBREASON_UNDELIVERED_BROADCAST,
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface SubReason {}
|
||||
@@ -1283,6 +1293,8 @@ public final class ApplicationExitInfo implements Parcelable {
|
||||
return "KILL BACKGROUND";
|
||||
case SUBREASON_PACKAGE_UPDATE:
|
||||
return "PACKAGE UPDATE";
|
||||
case SUBREASON_UNDELIVERED_BROADCAST:
|
||||
return "UNDELIVERED BROADCAST";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
@@ -735,7 +735,7 @@ public class BroadcastQueueImpl extends BroadcastQueue {
|
||||
+ " via " + app + ": " + ex;
|
||||
Slog.w(TAG, msg);
|
||||
app.killLocked("Can't deliver broadcast", ApplicationExitInfo.REASON_OTHER,
|
||||
true);
|
||||
ApplicationExitInfo.SUBREASON_UNDELIVERED_BROADCAST, true);
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
@@ -1388,7 +1388,8 @@ public class BroadcastQueueImpl extends BroadcastQueue {
|
||||
final String msg = "Failed to schedule " + r.intent + " to " + info
|
||||
+ " via " + app + ": " + e;
|
||||
Slog.w(TAG, msg);
|
||||
app.killLocked("Can't deliver broadcast", ApplicationExitInfo.REASON_OTHER, true);
|
||||
app.killLocked("Can't deliver broadcast", ApplicationExitInfo.REASON_OTHER,
|
||||
ApplicationExitInfo.SUBREASON_UNDELIVERED_BROADCAST, true);
|
||||
} catch (RuntimeException e) {
|
||||
Slog.wtf(TAG, "Failed sending broadcast to "
|
||||
+ r.curComponent + " with " + r.intent, e);
|
||||
|
||||
@@ -831,7 +831,8 @@ class BroadcastQueueModernImpl extends BroadcastQueue {
|
||||
final String msg = "Failed to schedule " + r + " to " + receiver
|
||||
+ " via " + app + ": " + e;
|
||||
logw(msg);
|
||||
app.killLocked("Can't deliver broadcast", ApplicationExitInfo.REASON_OTHER, true);
|
||||
app.killLocked("Can't deliver broadcast", ApplicationExitInfo.REASON_OTHER,
|
||||
ApplicationExitInfo.SUBREASON_UNDELIVERED_BROADCAST, true);
|
||||
enqueueFinishReceiver(queue, BroadcastRecord.DELIVERY_FAILURE, "remote app");
|
||||
}
|
||||
} else {
|
||||
@@ -858,7 +859,8 @@ class BroadcastQueueModernImpl extends BroadcastQueue {
|
||||
} catch (RemoteException e) {
|
||||
final String msg = "Failed to schedule result of " + r + " via " + app + ": " + e;
|
||||
logw(msg);
|
||||
app.killLocked("Can't deliver broadcast", ApplicationExitInfo.REASON_OTHER, true);
|
||||
app.killLocked("Can't deliver broadcast", ApplicationExitInfo.REASON_OTHER,
|
||||
ApplicationExitInfo.SUBREASON_UNDELIVERED_BROADCAST, true);
|
||||
}
|
||||
}
|
||||
// Clear so both local and remote references can be GC'ed
|
||||
|
||||
Reference in New Issue
Block a user