BroadcastQueue: remove matching broadcasts.

There are common broadcasts that should remove any still-pending
broadcasts of a particular flavor.  For example, sending SCREEN_ON
should remove any still-pending SCREEN_OFF broadcasts.

This change adds a BroadcastOption to support this use-case, along
with tests to validate, and starts wiring up the option to a handful
of straightforward broadcasts.

For this to work effectively, we need to actually remove skipped
events from our per-process queues, which means we need a more
robust way of finishing ordered broadcasts.  This change factors
out the "finishing" of each broadcast to a local setDeliveryState()
method which can then be invoked when a broadcast is removed.

Bug: 245771249
Test: atest FrameworksMockingServicesTests:BroadcastQueueTest
Change-Id: I8c81893841026074ef78d88f9ecc82518164e50e
11 files changed