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

Commit 209d5a53 authored by Robin Lee's avatar Robin Lee
Browse files

Don't let expanding notification shade cancel unlock

At the end of unlock, views start resetting themselves. This
includes the notification shade which goes from 0f height
to 1f height (covering the keyguard again).

Since notification shade height is 1 minus keyguard height,
and the full unlock finalisation happens in a handler to avoid
jank, this can cause a second hit to dismissAmountThresholdsReached
which cancels the unlock.

Test: android.platform.test.scenario.sysui.foldable
Bug: 284096414
Bug: 282672298
Change-Id: Ic9469c015c47aade323710a877923e8b0c8960b9
parent ee8da1ae
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -205,6 +205,12 @@ class KeyguardUnlockAnimationController @Inject constructor(
     */
    var playingCannedUnlockAnimation = false

    /**
     * Whether we reached the swipe gesture threshold to dismiss keyguard, or restore it, once
     * and should ignore any future changes to the dismiss amount before the animation finishes.
     */
    var dismissAmountThresholdsReached = false

    /**
     * Remote callback provided by Launcher that allows us to control the Launcher's unlock
     * animation and smartspace.
@@ -763,6 +769,10 @@ class KeyguardUnlockAnimationController @Inject constructor(
            return
        }

        if (dismissAmountThresholdsReached) {
            return
        }

        if (!keyguardStateController.isShowing) {
            return
        }
@@ -794,6 +804,11 @@ class KeyguardUnlockAnimationController @Inject constructor(
            return
        }

        // no-op if we alreaddy reached a threshold.
        if (dismissAmountThresholdsReached) {
            return
        }

        // no-op if animation is not requested yet.
        if (!keyguardViewMediator.get().requestedShowSurfaceBehindKeyguard() ||
                !keyguardViewMediator.get().isAnimatingBetweenKeyguardAndSurfaceBehindOrWillBe) {
@@ -808,6 +823,7 @@ class KeyguardUnlockAnimationController @Inject constructor(
                        !keyguardStateController.isFlingingToDismissKeyguardDuringSwipeGesture &&
                        dismissAmount >= DISMISS_AMOUNT_EXIT_KEYGUARD_THRESHOLD)) {
            setSurfaceBehindAppearAmount(1f)
            dismissAmountThresholdsReached = true
            keyguardViewMediator.get().exitKeyguardAndFinishSurfaceBehindRemoteAnimation(
                    false /* cancelled */)
        }
@@ -942,6 +958,7 @@ class KeyguardUnlockAnimationController @Inject constructor(
        wallpaperTargets = null

        playingCannedUnlockAnimation = false
        dismissAmountThresholdsReached = false
        willUnlockWithInWindowLauncherAnimations = false
        willUnlockWithSmartspaceTransition = false