Preserve wallpaper visible state for a while when display switches
Because screen may be turned off when switching display, the wallpaper
service will be notified with invisible state. And then its rendering
thread could be stopped. If the size change is delivered when the
renderer is not active, it won't update in time. That may cause to
flicker after the display is turned on.
Note that currently RWC#createSleepToken is always called on display
switch no matter screen will turn on or keep off. So the invocation of
onSleepingWithDisplaySwitch and onSleptOrScreenTurnedOn should be
paired to consume the preserved state.
The preserved visible state will be canceled by 3 conditions:
1. The display has turned on.
2. The device goes to sleep state.
3. The 1s timeout is reached.
Bug: 301443073
Test: Set "always" to Continue to use apps on fold".
Use live wallpaper.
Fold the device while top is launcher and screen is on.
The wallpaper is not flicking with old size.
Change-Id: I09c630a94d39bb21388d6bedcdd3b423a060fda0
9 files changed