diff options
3 files changed, 29 insertions, 3 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/UdfpsKeyguardViewLegacyControllerWithCoroutinesTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/UdfpsKeyguardViewLegacyControllerWithCoroutinesTest.kt index 55cfcc2c6d5b..ab551256cfc3 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/UdfpsKeyguardViewLegacyControllerWithCoroutinesTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/UdfpsKeyguardViewLegacyControllerWithCoroutinesTest.kt @@ -210,6 +210,32 @@ class UdfpsKeyguardViewLegacyControllerWithCoroutinesTest : } @Test + fun shouldHandleTouchesOnDetach() = + testScope.runTest { + val shouldHandleTouches by collectLastValue(mUdfpsOverlayInteractor.shouldHandleTouches) + + // GIVEN view is attached + on the keyguard + mController.onViewAttached() + captureStatusBarStateListeners() + sendStatusBarStateChanged(StatusBarState.KEYGUARD) + whenever(mView.setPauseAuth(true)).thenReturn(true) + whenever(mView.unpausedAlpha).thenReturn(0) + + // WHEN panelViewExpansion changes to expanded + val job = mController.listenForBouncerExpansion(this) + keyguardBouncerRepository.setPrimaryShow(true) + keyguardBouncerRepository.setPanelExpansion(KeyguardBouncerConstants.EXPANSION_VISIBLE) + runCurrent() + + mController.onViewDetached() + + // THEN UDFPS auth is paused and should not handle touches + assertThat(mController.shouldPauseAuth()).isTrue() + assertThat(shouldHandleTouches!!).isFalse() + + job.cancel() + } + @Test fun fadeFromDialogSuggestedAlpha() = testScope.runTest { // GIVEN view is attached and status bar expansion is 1f diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationViewController.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationViewController.kt index f5603ed732a5..c3e781800f9f 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationViewController.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationViewController.kt @@ -132,13 +132,13 @@ abstract class UdfpsAnimationViewController<T : UdfpsAnimationView>( override fun onViewAttached() { dialogManager.registerListener(dialogListener) dumpManager.registerDumpable(dumpTag, this) - udfpsOverlayInteractor.setHandleTouches(shouldHandle = true) + udfpsOverlayInteractor.setHandleTouches(shouldHandle = !shouldPauseAuth()) } override fun onViewDetached() { dialogManager.unregisterListener(dialogListener) dumpManager.unregisterDumpable(dumpTag) - udfpsOverlayInteractor.setHandleTouches(shouldHandle = true) + udfpsOverlayInteractor.setHandleTouches(shouldHandle = !shouldPauseAuth()) } /** diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerLegacy.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerLegacy.kt index 018d92e4e932..ec54e4ce5e86 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerLegacy.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerLegacy.kt @@ -378,7 +378,7 @@ open class UdfpsKeyguardViewControllerLegacy( } } - override fun onViewDetached() { + public override fun onViewDetached() { super.onViewDetached() alternateBouncerInteractor.setAlternateBouncerUIAvailable(false, uniqueIdentifier) faceDetectRunning = false |