Give fg services a shelf life before they go bad.

When a fg service starts (as indicated by its presence in a
NOTE_FOREGROUND_SERVICES notification), we note the service
start time (as encoded in Notification.when in ActivityMgr).

SysUI will suppress the dungeon (foreground service
disclosure) notification until 5 seconds have elapsed since
the earliest service start time. After that, if the service
is still running, the disclosure will be shown.

Bug: 67819284
Test: runtest -x frameworks/base/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java
Change-Id: I5b6df95eb673e2f551aaa3ecc5a7df617f815a90
(cherry picked from commit 9830b5a8e41c3b477064e3b378734fc129e8342f)
2 files changed