Skip to content
Commit f08577b9 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

BroadcastQueue: wait for Loopers to idle.

Several components within the system send broadcasts by dispatching
through an intermediate Handler.  This can return quickly to external
callers before a broadcast has actually been enqueued, and if they
use "wait-for-broadcast-idle" or "wait-for-broadcast-barrier" they
can race with the pending Handler message to observe a false-positive
idle result, resulting in test flakiness.

This change collects all system_server Looper instances which send
broadcasts, and ensures that they've drained pending Message events
before proceeding with the BroadcastQueue idle checks.

Bug: 255761805
Test: atest FrameworksMockingServicesTests:BroadcastRecordTest
Test: atest FrameworksMockingServicesTests:BroadcastQueueTest
Test: atest FrameworksMockingServicesTests:BroadcastQueueModernImplTest
Change-Id: I5c5e27c619338712193a2f094ea540320e872148
parent 299e0e89
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment