Add GroupCoalescer to new pipeline
Adds the GroupCoalescer, which attempts to make posting notification
groups an atomic action. Currently, notif groups are posted in pieces,
with one post per child or summary. As a result, downstream code can't
tell whether a group is currently complete or whether more stuff is
coming down the line. This complicates a lot of logic, especially to do
with heads-upping.
The GroupCoalescer sits between the NotificationListener and the
NotifCollection and controls the flow of notification events between the
two. As a result, the full pipeline is now:
NotificationListener -> GroupCoalescer -> NotifCollection ->
NotifListBuilderImpl
Most events pass through the GroupCoalescer unhindered, but any event
that involves posting a grouped notification is temporarily delayed
within the coalescer to see if any other similar events occur. When the
delay times out, all delayed events for that group are posted to the
NotifCollection in a batch.
It's dangerous to reorder or delay events from the NotificationListener
for too long, so any event that would further modify the group, such as
updating or removing one of the delayed notifications, causes the batch
to be immediately emitted, followed by the modifying event.
Test: atest SystemUITests
Change-Id: I4b5dd1a6acb3a7704b2e199a5ed42fe855ab74cb
8 files changed