From 04f57197ff74461097efa3702d75a25606d89ed5 Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Mon, 27 Mar 2023 11:29:54 -0700 Subject: [PATCH] Fix dismiss callback when keyguard is dismissing. AnimatingAway is set to false before hide is called, causing the dismiss action to be cancelled. This is breaking CarSysUI. Maintain parity with the legacy bouncer by setting disppear animation to null when we hide the bouncer so we maintain the state of animating away when we check to see if we should dismiss the callback. Fixes: 271166101 Test: Atest Change-Id: Ia51ec982dd78b69db82f69ae525e402bd461f294 --- .../interactor/PrimaryBouncerInteractor.kt | 17 ++++++----------- .../interactor/PrimaryBouncerInteractorTest.kt | 1 + 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractor.kt index e65c8a16f9e9d..74bf8f60eedfd 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractor.kt @@ -21,8 +21,6 @@ import android.content.res.ColorStateList import android.hardware.biometrics.BiometricSourceType import android.os.Handler import android.os.Trace -import android.os.UserHandle -import android.os.UserManager import android.util.Log import android.view.View import com.android.keyguard.KeyguardConstants @@ -107,10 +105,9 @@ constructor( val panelExpansionAmount: Flow = repository.panelExpansionAmount /** 0f = bouncer fully hidden. 1f = bouncer fully visible. */ val bouncerExpansion: Flow = - combine( - repository.panelExpansionAmount, - repository.primaryBouncerShow - ) { panelExpansion, primaryBouncerIsShowing -> + combine(repository.panelExpansionAmount, repository.primaryBouncerShow) { + panelExpansion, + primaryBouncerIsShowing -> if (primaryBouncerIsShowing) { 1f - panelExpansion } else { @@ -196,6 +193,7 @@ constructor( dismissCallbackRegistry.notifyDismissCancelled() } + repository.setPrimaryStartDisappearAnimation(null) falsingCollector.onBouncerHidden() keyguardStateController.notifyPrimaryBouncerShowing(false /* showing */) cancelShowRunnable() @@ -307,11 +305,8 @@ constructor( runnable.run() return } - val finishRunnable = Runnable { - runnable.run() - repository.setPrimaryStartDisappearAnimation(null) - } - repository.setPrimaryStartDisappearAnimation(finishRunnable) + + repository.setPrimaryStartDisappearAnimation(runnable) } /** Determine whether to show the side fps animation. */ diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractorTest.kt index bdc33f45c7175..4c8a0a51bcdf4 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractorTest.kt @@ -131,6 +131,7 @@ class PrimaryBouncerInteractorTest : SysuiTestCase() { verify(repository).setPrimaryShowingSoon(false) verify(repository).setPrimaryShow(false) verify(mPrimaryBouncerCallbackInteractor).dispatchVisibilityChanged(View.INVISIBLE) + verify(repository).setPrimaryStartDisappearAnimation(null) } @Test