Fix stuck screen from display change timeout
Occasionally, a remote display change is not processed within the
timeout period. One prominent example is when a device is not able
to complete its rotation from landscape back to portrait in time after
the display is turned off. When this happens, and the callback is
called after the timeout instead, DisplayContent#sendNewConfiguration
abandons its effort when it sees there are pending display changes, but
this callback itself might be the pending display change, and it does
not expect itself to be included as part of this decision. Remove all
callbacks before calling the last one to prevent this.
Test: Manual: Build and run with REMOTE_DISPLAY_CHANGE_TIMEOUT_MS = 50,
or some other low value. Enter landscape mode, e.g. by playing a video.
Turn off the screen. Wait 3 seconds. Turn the screen back on. The lock
screen will appear as normal. Previously, the screen would remain
black until a restart or `adb shell wm` change interaction.
Bug: 266535056
Change-Id: I53659d5580cdd70b4c7138dcca770b11f5397194
1 file changed