Don't replace any broadcasts that already have been processed.
We do in-place replacement of broadcasts when enqueueing broadcasts
sent with FLAG_RECEIVER_REPLACE_PENDING and this could cause an
inversion in the broadcast queues if we replace a broadcast record
which is already delivered to some of the receivers. This is because
we will end up replacing the receivers which are still waiting and
the rest will be enqueued at the end of the broadcast queue which
changes the ordering in which these receivers should be receiving
the broadcast.
Bug: 261822892
Test: atest services/tests/mockingservicestests/src/com/android/server/am/BroadcastQueueTest.java
Test: atest services/tests/mockingservicestests/src/com/android/server/am/BroadcastQueueModernImplTest.java
Change-Id: I4c8b013a07e3b61ace32f4379cc644dbf5347371
5 files changed