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
Loading
Please register or sign in to comment