Fix bug around deferred prioritized broadcasts.

When deciding if a particular "tranche" of prioritized broadcasts has
been finished, we should consider both the terminal and deferred
states of members of that tranche.  Previous attempts to do this used
a pure counting-based mechanism, which can risk opening up future
tranches too early when many receivers have been deferred.

This fix pivots to a new "beyond" concept that tracks the highest
receiver that a broadcast has "moved beyond".  This can be either a
terminal state, or deferred states within the currently active
tranche.  Once we've moved "beyond" particular receiver, we treat
it as a high-water mark, even when previously deferred broadcasts
that we've moved beyond pivot back to a pending state.

Bug: 272147987
Test: atest FrameworksMockingServicesTests:BroadcastQueueTest
Test: atest FrameworksMockingServicesTests:BroadcastQueueModernImplTest
Test: atest FrameworksMockingServicesTests:BroadcastRecordTest
Change-Id: Iac4c5c7e92a7e009acbe1c248f6f56106152f032
6 files changed