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

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

Subtle fix when queue becomes unrunnable.

When broadcasts are skipped or failed during list traversal, we might
encounter a queue that is no longer runnable; skip it.

Also add new mPendingUrgent contents to dumpsys output.

Bug: 253906105
Test: atest FrameworksMockingServicesTests:BroadcastRecordTest
Test: atest FrameworksMockingServicesTests:BroadcastQueueTest
Test: atest FrameworksMockingServicesTests:BroadcastQueueModernImplTest
Change-Id: Ib85f3f33a9475cd4cd35f04afbc548e386b75c60
parent 64379f23
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -807,7 +807,7 @@ class BroadcastProcessQueue {

    @NeverCompile
    public void dumpLocked(@UptimeMillisLong long now, @NonNull IndentingPrintWriter pw) {
        if ((mActive == null) && mPending.isEmpty()) return;
        if ((mActive == null) && isEmpty()) return;

        pw.print(toShortString());
        if (isRunnable()) {
@@ -823,6 +823,10 @@ class BroadcastProcessQueue {
        if (mActive != null) {
            dumpRecord(now, pw, mActive, mActiveIndex, mActiveBlockedUntilTerminalCount);
        }
        for (SomeArgs args : mPendingUrgent) {
            final BroadcastRecord r = (BroadcastRecord) args.arg1;
            dumpRecord(now, pw, r, args.argi1, args.argi2);
        }
        for (SomeArgs args : mPending) {
            final BroadcastRecord r = (BroadcastRecord) args.arg1;
            dumpRecord(now, pw, r, args.argi1, args.argi2);
+7 −0
Original line number Diff line number Diff line
@@ -364,6 +364,13 @@ class BroadcastQueueModernImpl extends BroadcastQueue {
            BroadcastProcessQueue nextQueue = queue.runnableAtNext;
            final long runnableAt = queue.getRunnableAt();

            // When broadcasts are skipped or failed during list traversal, we
            // might encounter a queue that is no longer runnable; skip it
            if (!queue.isRunnable()) {
                queue = nextQueue;
                continue;
            }

            // If queues beyond this point aren't ready to run yet, schedule
            // another pass when they'll be runnable
            if (runnableAt > now && !waitingFor) {