Change freeform activity occluding keyguard to fullscreen
Lets WM Shell change the windowing mode of a freeform task that is
occluding the keyguard to fullscreen.
There's two scenarios/code paths that this CL changes:
1) Unsecure keyguard: when a freeform task is on top and has the
FLAG_DISMISS_KEYGUARD flag set, RootWindowContainer#applySleepTokens
starts a transition of type TRANSIT_KEYGUARD_OCCLUDE. By setting the
occluding activity as the triggerTask, WM Shell is able to intercept
the request and change the windowing mode to fullscreen before the
transition runs/animates.
2) Secure keyguard: when a freeform task is on top and after off/on,
A) Unlocking the keyguard starts the activity. If it sets
setShowWhenLocked==true, it used to change the windowing mode to
fullscreen, which was unwanted behavior since the app will not be
shown on top of the keyguard since it was unlocked and going away.
B) If the activity starts without unlocking the keyguard (e.g. from
quick settings), and setShowWhenLocked is set to true, then the
windowing mode should change to fullscreen as it will be shown over
the keyguard.
To handle both A) and B), instead of always dismissing the freeform
mode in #handleOccludedChange, add the occluding task as the trigger
task of the TRANSIT_KEYGUARD_OCCLUDE transition that is also started
in #handleOcclusionChange, so that WM Shell can intercept it and
change the windowing mode.
Bug: 261765739
Test: (1) with unsecure keyguard, open calculator, enter freeform, turn
screen off/on, verify calculator is in fullscreen on top of keyguard;
(2A) with secure keyguard, enter freeform, off/on, unlock, verify
calculator is still in freeform mode; (2B) with secure keyguard, enter
freeform, off/on, open calculator from quick settings, verify calculator
is shown on top of the keyguard in fullscreen.
Change-Id: Idac9e012d25c50b73eba8afe9088d77043c68a85
4 files changed