Replace only matching records when enqueuing a broadcast.
Unless we are inserting the new receivers (that are replacing the
existing ones in the queue) based on their new timestamps, it is
possible for priority inversion to occur. So, when enqueuing a new
broadcast, only replace the matching records to avoid potential
priority inversion issues.
Bug: 311288757
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: I9b918e5e42862064b0d5fc623f09308c3c3f2f7d
4 files changed