Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a84ac005 authored by Jorge Gil's avatar Jorge Gil
Browse files

Add KEYGUARD_OCCLUDING flag/startTask to WAKE transition

This fixes an issue were if the device wakes and a freeform task opens
over the unlocked keyguard at the same time, the OPEN task change may be
included into the TRANSIT_WAKE transition that was not handled by the
KeyguardTransitionHandler, which prevented it from being dismissed out
of freeform mode into fullscreen mode.

This change adds the KEYGUARD_OCCLUDING flag to the wake transition, so
that the KeyguardTransitionHandler is able to handle the animation.

Bug: 329916266
Bug: 326384071
Bug: 310307979
Test: atest ActivityVisibilityTests#testFreeformWindowToTurnScreenOn
--rerun-until-failure (no failures in 200+ attempts)

Change-Id: Ia33852c77678e2596bb88fd4dcca72b451466510
parent e6cd1bb1
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import static android.view.Display.INVALID_DISPLAY;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE;
import static android.view.WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG;
import static android.view.WindowManager.LayoutParams.TYPE_NOTIFICATION_SHADE;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_OCCLUDING;
import static android.view.WindowManager.TRANSIT_NONE;
import static android.view.WindowManager.TRANSIT_PIP;
import static android.view.WindowManager.TRANSIT_SLEEP;
@@ -2496,15 +2497,17 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
                // Use NONE if keyguard is not showing.
                int transit = TRANSIT_NONE;
                Task startTask = null;
                int flags = 0;
                if (display.isKeyguardOccluded()) {
                    startTask = display.getTaskOccludingKeyguard();
                    flags = TRANSIT_FLAG_KEYGUARD_OCCLUDING;
                    transit = WindowManager.TRANSIT_KEYGUARD_OCCLUDE;
                }
                if (wasSleeping) {
                    transit = TRANSIT_WAKE;
                } else if (display.isKeyguardOccluded()) {
                    // The display was awake so this is resuming activity for occluding keyguard.
                    transit = WindowManager.TRANSIT_KEYGUARD_OCCLUDE;
                    startTask = display.getTaskOccludingKeyguard();
                }
                display.mTransitionController.requestStartTransition(
                        display.mTransitionController.createTransition(transit),
                        display.mTransitionController.createTransition(transit, flags),
                        startTask, null /* remoteTransition */, null /* displayChange */);
            }
            // Set the sleeping state of the root tasks on the display.
+1 −1
Original line number Diff line number Diff line
@@ -300,7 +300,7 @@ class TransitionController {
     * Creates a transition. It can immediately collect participants.
     */
    @NonNull
    private Transition createTransition(@WindowManager.TransitionType int type,
    Transition createTransition(@WindowManager.TransitionType int type,
            @WindowManager.TransitionFlags int flags) {
        if (mTransitionPlayer == null) {
            throw new IllegalStateException("Shell Transitions not enabled");