Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e40ab122 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

BroadcastQueue: more exception details.

Help understand more about CannotDeliverBroadcastException.

Bug: 236556314
Test: atest FrameworksMockingServicesTests:BroadcastQueueTest
Change-Id: I0dfeea12c7da1a5a2c33400ed9016b18c313a6e2
parent 40fe3375
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -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 "
+7 −5
Original line number Diff line number Diff line
@@ -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);
            }
        }
    }