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

Commit 580d000d authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

BroadcastQueue: fix proto dump regression.

The underlying test here is assuming that a broadcast with an empty
list of receivers is still listed in the dump output, so factor out
notifyFinishBroadcast() to call in this situation.

Also replace flaky sleep() with "wait-for-broadcast-barrier".

Bug: 256174447
Test: atest CtsIncidentHostTestCases:ActivityManagerIncidentTest#testDumpBroadcasts
Change-Id: If60bcfff3f0509e976dec2842dce77c5412d5505
parent 9bda383c
Loading
Loading
Loading
Loading
+25 −20
Original line number Diff line number Diff line
@@ -599,6 +599,7 @@ class BroadcastQueueModernImpl extends BroadcastQueue {
        // If nothing to dispatch, send any pending result immediately
        if (r.receivers.isEmpty()) {
            scheduleResultTo(r);
            notifyFinishBroadcast(r);
        }

        traceEnd(cookie);
@@ -1402,6 +1403,11 @@ class BroadcastQueueModernImpl extends BroadcastQueue {

        final boolean recordFinished = (r.terminalCount == r.receivers.size());
        if (recordFinished) {
            notifyFinishBroadcast(r);
        }
    }

    private void notifyFinishBroadcast(@NonNull BroadcastRecord r) {
        mService.notifyBroadcastFinishedLocked(r);
        mHistory.addBroadcastToHistoryLocked(r);

@@ -1427,7 +1433,6 @@ class BroadcastQueueModernImpl extends BroadcastQueue {
                    manifestCount, manifestSkipCount, dispatchTime);
        }
    }
    }

    @VisibleForTesting
    @NonNull BroadcastProcessQueue getOrCreateProcessQueue(@NonNull ProcessRecord app) {