From 209d5a532831bb71e1c259b2b3a02bab315e5aa6 Mon Sep 17 00:00:00 2001 From: Robin Lee Date: Thu, 1 Jun 2023 21:13:49 +0000 Subject: [PATCH] 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 --- .../KeyguardUnlockAnimationController.kt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt index 28845a3bb52d3..57c7b09759a5f 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt @@ -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