BroadcastQueue: more exception details.

Help understand more about CannotDeliverBroadcastException.

Bug: 236556314
Test: atest FrameworksMockingServicesTests:BroadcastQueueTest
Change-Id: I0dfeea12c7da1a5a2c33400ed9016b18c313a6e2
This commit is contained in:
Jeff Sharkey
2022-09-26 15:05:47 -06:00
parent 40fe3375ff
commit e40ab122a1
2 changed files with 15 additions and 11 deletions

View File

@@ -732,9 +732,10 @@ public class BroadcastQueueImpl extends BroadcastQueue {
} catch (RemoteException ex) {
// Failed to call into the process. It's either dying or wedged. Kill it gently.
synchronized (mService) {
Slog.w(TAG, "Can't deliver broadcast to " + app.processName
+ " (pid " + app.getPid() + "). Crashing it.");
app.scheduleCrashLocked("can't deliver broadcast",
final String msg = "Failed to schedule " + intent + " to " + receiver
+ " via " + app + ": " + ex;
Slog.w(TAG, msg);
app.scheduleCrashLocked(msg,
CannotDeliverBroadcastException.TYPE_ID, /* extras=*/ null);
}
throw ex;
@@ -1379,9 +1380,10 @@ public class BroadcastQueueImpl extends BroadcastQueue {
processCurBroadcastLocked(r, app);
return;
} catch (RemoteException e) {
Slog.w(TAG, "Exception when sending broadcast to "
+ r.curComponent, e);
app.scheduleCrashLocked("can't deliver broadcast",
final String msg = "Failed to schedule " + r.intent + " to " + info
+ " via " + app + ": " + e;
Slog.w(TAG, msg);
app.scheduleCrashLocked(msg,
CannotDeliverBroadcastException.TYPE_ID, /* extras=*/ null);
} catch (RuntimeException e) {
Slog.wtf(TAG, "Failed sending broadcast to "

View File

@@ -628,9 +628,10 @@ class BroadcastQueueModernImpl extends BroadcastQueue {
app.mState.getReportedProcState());
}
} catch (RemoteException e) {
Slog.w(TAG, "Failed to schedule " + r + " to " + receiver
+ " via " + app + ": " + e);
app.scheduleCrashLocked(TAG, CannotDeliverBroadcastException.TYPE_ID, null);
final String msg = "Failed to schedule " + r + " to " + receiver
+ " via " + app + ": " + e;
Slog.w(TAG, msg);
app.scheduleCrashLocked(msg, CannotDeliverBroadcastException.TYPE_ID, null);
app.setKilled(true);
finishReceiverLocked(queue, BroadcastRecord.DELIVERY_FAILURE);
}
@@ -655,8 +656,9 @@ class BroadcastQueueModernImpl extends BroadcastQueue {
r.resultCode, r.resultData, r.resultExtras, false, r.initialSticky,
r.userId, app.mState.getReportedProcState());
} catch (RemoteException e) {
Slog.w(TAG, "Failed to schedule result of " + r + " via " + app + ": " + e);
app.scheduleCrashLocked(TAG, CannotDeliverBroadcastException.TYPE_ID, null);
final String msg = "Failed to schedule result of " + r + " via " + app + ": " + e;
Slog.w(TAG, msg);
app.scheduleCrashLocked(msg, CannotDeliverBroadcastException.TYPE_ID, null);
}
}
}