From c829cd0c7132a8361dd748a4d840e3014b60eca4 Mon Sep 17 00:00:00 2001 From: Josh Tsuji Date: Wed, 4 May 2022 16:43:21 -0400 Subject: [PATCH] Don't prepare in-window animations if leaveKeyguardOpenOnHide. This resulted in a blank launcher as we prepared for, but then never started, the in-window unlock animations, since the keyguar was remaining open over the Launcher. Fixes: 231396336 Test: pull down shade with show sensitive content only enabled; using pin/pattern unlock Change-Id: I236e46e410225d47404015d08cbfd9777727a84c --- .../systemui/keyguard/KeyguardUnlockAnimationController.kt | 7 +++++-- .../keyguard/KeyguardUnlockAnimationControllerTest.kt | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt index fb09132684ebc..c527d579735e6 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt @@ -44,6 +44,7 @@ import com.android.systemui.shared.system.QuickStepContract import com.android.systemui.shared.system.smartspace.ILauncherUnlockAnimationController import com.android.systemui.shared.system.smartspace.ISysuiUnlockAnimationController import com.android.systemui.shared.system.smartspace.SmartspaceState +import com.android.systemui.statusbar.SysuiStatusBarStateController import com.android.systemui.statusbar.phone.BiometricUnlockController import com.android.systemui.statusbar.policy.KeyguardStateController import dagger.Lazy @@ -140,7 +141,8 @@ class KeyguardUnlockAnimationController @Inject constructor( keyguardViewMediator: Lazy, private val keyguardViewController: KeyguardViewController, private val featureFlags: FeatureFlags, - private val biometricUnlockControllerLazy: Lazy + private val biometricUnlockControllerLazy: Lazy, + private val statusBarStateController: SysuiStatusBarStateController ) : KeyguardStateController.Callback, ISysuiUnlockAnimationController.Stub() { interface KeyguardUnlockAnimationListener { @@ -372,7 +374,8 @@ class KeyguardUnlockAnimationController @Inject constructor( * changed. */ override fun onKeyguardGoingAwayChanged() { - if (keyguardStateController.isKeyguardGoingAway) { + if (keyguardStateController.isKeyguardGoingAway + && !statusBarStateController.leaveOpenOnKeyguardHide()) { prepareForInWindowLauncherAnimations() } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardUnlockAnimationControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardUnlockAnimationControllerTest.kt index 2d8c4d5dceb06..2abc666e87fbe 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardUnlockAnimationControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardUnlockAnimationControllerTest.kt @@ -14,6 +14,7 @@ import androidx.test.filters.SmallTest import com.android.keyguard.KeyguardViewController import com.android.systemui.SysuiTestCase import com.android.systemui.flags.FeatureFlags +import com.android.systemui.statusbar.SysuiStatusBarStateController import com.android.systemui.statusbar.phone.BiometricUnlockController import com.android.systemui.statusbar.policy.KeyguardStateController import junit.framework.Assert.assertEquals @@ -49,6 +50,8 @@ class KeyguardUnlockAnimationControllerTest : SysuiTestCase() { private lateinit var biometricUnlockController: BiometricUnlockController @Mock private lateinit var surfaceTransactionApplier: SyncRtSurfaceTransactionApplier + @Mock + private lateinit var statusBarStateController: SysuiStatusBarStateController private lateinit var remoteAnimationTarget: RemoteAnimationTarget @@ -57,7 +60,7 @@ class KeyguardUnlockAnimationControllerTest : SysuiTestCase() { MockitoAnnotations.initMocks(this) keyguardUnlockAnimationController = KeyguardUnlockAnimationController( context, keyguardStateController, { keyguardViewMediator }, keyguardViewController, - featureFlags, { biometricUnlockController } + featureFlags, { biometricUnlockController }, statusBarStateController ) `when`(keyguardViewController.viewRootImpl).thenReturn(mock(ViewRootImpl::class.java))