Use foreground sched group for process showing UI while dozing
After device enters dozing mode, SystemUI will be
BOUND_FOREGROUND_SERVICE + GROUP_RESTRICTED. Then jank could happen
when updating the UI, e.g. add/remove notification, update clock.
If AOD is not enabled, when the screen is turned on without awake,
the priority will boost to PERSISTENT_UI + TOP_APP for 2s, and then
before screen goes off, it will keep PERSISTENT + GROUP_DEFAULT.
If AOD is enabled, the priority will also keep at least
PERSISTENT + GROUP_DEFAULT.
Bug: 308601407
Bug: 261162899
Test: atest DisplayPolicyTests#testVisibleProcessWhileDozing
Test: Disable "Always show time and info" and turn off screen.
Send a notification to turn on screen.
> adb shell dumpsys activity oom | grep systemui
It will show "T/ /PERU" in 2s, and then "F/ /PER" if screen
is still on. After screen is off automatically by timeout,
it will return to "R/ /BFGS".
Test: Enable "Always show time and info" and turn off screen.
> adb shell dumpsys activity oom | grep systemui
It will show "F/ /PER" instead of "R/ /BFGS"
Change-Id: Ic6867adc9814ea96b15074feea85b7ce1cffb9e3
5 files changed