Batch and throttle appear rate of heads up notifications
New class AvalancheController delays heads up notification
appearance during avalanche by intercepting BaseHeadsUpManager events
that handle HUN drawing and removal scheduling:
- showNotification
- updateNotification
- removeEntry
- unpinAll
- removeAutoRemovalCallbacks
- scheduleAutoRemovalCallback
AvalancheController saves these events as a list of runnables per
HeadsUpEntry that run when the HeadsUpEntry is shown.
BaseHeadsUpManager.HeadsUpEntry
- implements hashCode and equals for key-based lookup
- calculateFinishTime uses 1s removal timeout during avalanche
HeadsUpManagerPhone injects AvalancheController into BaseHeadsUpManager.
Bug: 315362456
Test: atest SystemUiRoboTests:AvalancheControllerTest
Test: adb shell device_config override systemui com.android.systemui.notification_throttle_hun true
send multiple HUNs in fast succession
=> HUNs appear 1s after each other in batches
=> Only top-priority HUN per batch is shown
Flag: ACONFIG notification_throttle_hun DEVELOPMENT
Change-Id: I7d97e137609fdee854e5b72013759773070777c8
7 files changed