Loading packages/SystemUI/src/com/android/systemui/biometrics/SideFpsController.kt +1 −1 Original line number Diff line number Diff line Loading @@ -186,7 +186,7 @@ constructor( } private fun listenForAlternateBouncerVisibility() { alternateBouncerInteractor.setAlternateBouncerUIAvailable(true) alternateBouncerInteractor.setAlternateBouncerUIAvailable(true, "SideFpsController") scope.launch { alternateBouncerInteractor.isVisible.collect { isVisible: Boolean -> if (isVisible) { Loading packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerLegacy.kt +3 −2 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ constructor( dumpManager, ), UdfpsKeyguardViewControllerAdapter { private val uniqueIdentifier = this.toString() private val useExpandedOverlay: Boolean = featureFlags.isEnabled(Flags.UDFPS_NEW_TOUCH_DETECTION) private var showingUdfpsBouncer = false Loading Loading @@ -282,7 +283,7 @@ constructor( public override fun onViewAttached() { super.onViewAttached() alternateBouncerInteractor.setAlternateBouncerUIAvailable(true) alternateBouncerInteractor.setAlternateBouncerUIAvailable(true, uniqueIdentifier) val dozeAmount = statusBarStateController.dozeAmount lastDozeAmount = dozeAmount stateListener.onDozeAmountChanged(dozeAmount, dozeAmount) Loading Loading @@ -312,7 +313,7 @@ constructor( override fun onViewDetached() { super.onViewDetached() alternateBouncerInteractor.setAlternateBouncerUIAvailable(false) alternateBouncerInteractor.setAlternateBouncerUIAvailable(false, uniqueIdentifier) faceDetectRunning = false keyguardStateController.removeCallback(keyguardStateControllerCallback) statusBarStateController.removeCallback(stateListener) Loading packages/SystemUI/src/com/android/systemui/biometrics/ui/controller/UdfpsKeyguardViewController.kt +3 −2 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ open class UdfpsKeyguardViewController( dumpManager, ), UdfpsKeyguardViewControllerAdapter { private val uniqueIdentifier = this.toString() override val tag: String get() = TAG Loading @@ -55,12 +56,12 @@ open class UdfpsKeyguardViewController( public override fun onViewAttached() { super.onViewAttached() alternateBouncerInteractor.setAlternateBouncerUIAvailable(true) alternateBouncerInteractor.setAlternateBouncerUIAvailable(true, uniqueIdentifier) } public override fun onViewDetached() { super.onViewDetached() alternateBouncerInteractor.setAlternateBouncerUIAvailable(false) alternateBouncerInteractor.setAlternateBouncerUIAvailable(false, uniqueIdentifier) } override fun shouldPauseAuth(): Boolean { Loading packages/SystemUI/src/com/android/systemui/bouncer/domain/interactor/AlternateBouncerInteractor.kt +10 −2 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ constructor( ) { var receivedDownTouch = false val isVisible: Flow<Boolean> = bouncerRepository.alternateBouncerVisible private val alternateBouncerUiAvailableFromSource: HashSet<String> = HashSet() /** * Sets the correct bouncer states to show the alternate bouncer if it can show. Loading Loading @@ -69,8 +70,15 @@ constructor( return bouncerRepository.alternateBouncerVisible.value } fun setAlternateBouncerUIAvailable(isAvailable: Boolean) { bouncerRepository.setAlternateBouncerUIAvailable(isAvailable) fun setAlternateBouncerUIAvailable(isAvailable: Boolean, token: String) { if (isAvailable) { alternateBouncerUiAvailableFromSource.add(token) } else { alternateBouncerUiAvailableFromSource.remove(token) } bouncerRepository.setAlternateBouncerUIAvailable( alternateBouncerUiAvailableFromSource.isNotEmpty() ) } fun canShowAlternateBouncerForFingerprint(): Boolean { Loading packages/SystemUI/tests/src/com/android/systemui/bouncer/domain/interactor/AlternateBouncerInteractorTest.kt +22 −0 Original line number Diff line number Diff line Loading @@ -165,6 +165,28 @@ class AlternateBouncerInteractorTest : SysuiTestCase() { assertFalse(bouncerRepository.alternateBouncerVisible.value) } @Test fun alternateBouncerUiAvailable_fromMultipleSources() { assertFalse(bouncerRepository.alternateBouncerUIAvailable.value) // GIVEN there are two different sources indicating the alternate bouncer is available underTest.setAlternateBouncerUIAvailable(true, "source1") underTest.setAlternateBouncerUIAvailable(true, "source2") assertTrue(bouncerRepository.alternateBouncerUIAvailable.value) // WHEN one of the sources no longer says the UI is available underTest.setAlternateBouncerUIAvailable(false, "source1") // THEN alternate bouncer UI is still available (from the other source) assertTrue(bouncerRepository.alternateBouncerUIAvailable.value) // WHEN all sources say the UI is not available underTest.setAlternateBouncerUIAvailable(false, "source2") // THEN alternate boucer UI is not available assertFalse(bouncerRepository.alternateBouncerUIAvailable.value) } private fun givenCanShowAlternateBouncer() { bouncerRepository.setAlternateBouncerUIAvailable(true) biometricSettingsRepository.setFingerprintEnrolled(true) Loading Loading
packages/SystemUI/src/com/android/systemui/biometrics/SideFpsController.kt +1 −1 Original line number Diff line number Diff line Loading @@ -186,7 +186,7 @@ constructor( } private fun listenForAlternateBouncerVisibility() { alternateBouncerInteractor.setAlternateBouncerUIAvailable(true) alternateBouncerInteractor.setAlternateBouncerUIAvailable(true, "SideFpsController") scope.launch { alternateBouncerInteractor.isVisible.collect { isVisible: Boolean -> if (isVisible) { Loading
packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerLegacy.kt +3 −2 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ constructor( dumpManager, ), UdfpsKeyguardViewControllerAdapter { private val uniqueIdentifier = this.toString() private val useExpandedOverlay: Boolean = featureFlags.isEnabled(Flags.UDFPS_NEW_TOUCH_DETECTION) private var showingUdfpsBouncer = false Loading Loading @@ -282,7 +283,7 @@ constructor( public override fun onViewAttached() { super.onViewAttached() alternateBouncerInteractor.setAlternateBouncerUIAvailable(true) alternateBouncerInteractor.setAlternateBouncerUIAvailable(true, uniqueIdentifier) val dozeAmount = statusBarStateController.dozeAmount lastDozeAmount = dozeAmount stateListener.onDozeAmountChanged(dozeAmount, dozeAmount) Loading Loading @@ -312,7 +313,7 @@ constructor( override fun onViewDetached() { super.onViewDetached() alternateBouncerInteractor.setAlternateBouncerUIAvailable(false) alternateBouncerInteractor.setAlternateBouncerUIAvailable(false, uniqueIdentifier) faceDetectRunning = false keyguardStateController.removeCallback(keyguardStateControllerCallback) statusBarStateController.removeCallback(stateListener) Loading
packages/SystemUI/src/com/android/systemui/biometrics/ui/controller/UdfpsKeyguardViewController.kt +3 −2 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ open class UdfpsKeyguardViewController( dumpManager, ), UdfpsKeyguardViewControllerAdapter { private val uniqueIdentifier = this.toString() override val tag: String get() = TAG Loading @@ -55,12 +56,12 @@ open class UdfpsKeyguardViewController( public override fun onViewAttached() { super.onViewAttached() alternateBouncerInteractor.setAlternateBouncerUIAvailable(true) alternateBouncerInteractor.setAlternateBouncerUIAvailable(true, uniqueIdentifier) } public override fun onViewDetached() { super.onViewDetached() alternateBouncerInteractor.setAlternateBouncerUIAvailable(false) alternateBouncerInteractor.setAlternateBouncerUIAvailable(false, uniqueIdentifier) } override fun shouldPauseAuth(): Boolean { Loading
packages/SystemUI/src/com/android/systemui/bouncer/domain/interactor/AlternateBouncerInteractor.kt +10 −2 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ constructor( ) { var receivedDownTouch = false val isVisible: Flow<Boolean> = bouncerRepository.alternateBouncerVisible private val alternateBouncerUiAvailableFromSource: HashSet<String> = HashSet() /** * Sets the correct bouncer states to show the alternate bouncer if it can show. Loading Loading @@ -69,8 +70,15 @@ constructor( return bouncerRepository.alternateBouncerVisible.value } fun setAlternateBouncerUIAvailable(isAvailable: Boolean) { bouncerRepository.setAlternateBouncerUIAvailable(isAvailable) fun setAlternateBouncerUIAvailable(isAvailable: Boolean, token: String) { if (isAvailable) { alternateBouncerUiAvailableFromSource.add(token) } else { alternateBouncerUiAvailableFromSource.remove(token) } bouncerRepository.setAlternateBouncerUIAvailable( alternateBouncerUiAvailableFromSource.isNotEmpty() ) } fun canShowAlternateBouncerForFingerprint(): Boolean { Loading
packages/SystemUI/tests/src/com/android/systemui/bouncer/domain/interactor/AlternateBouncerInteractorTest.kt +22 −0 Original line number Diff line number Diff line Loading @@ -165,6 +165,28 @@ class AlternateBouncerInteractorTest : SysuiTestCase() { assertFalse(bouncerRepository.alternateBouncerVisible.value) } @Test fun alternateBouncerUiAvailable_fromMultipleSources() { assertFalse(bouncerRepository.alternateBouncerUIAvailable.value) // GIVEN there are two different sources indicating the alternate bouncer is available underTest.setAlternateBouncerUIAvailable(true, "source1") underTest.setAlternateBouncerUIAvailable(true, "source2") assertTrue(bouncerRepository.alternateBouncerUIAvailable.value) // WHEN one of the sources no longer says the UI is available underTest.setAlternateBouncerUIAvailable(false, "source1") // THEN alternate bouncer UI is still available (from the other source) assertTrue(bouncerRepository.alternateBouncerUIAvailable.value) // WHEN all sources say the UI is not available underTest.setAlternateBouncerUIAvailable(false, "source2") // THEN alternate boucer UI is not available assertFalse(bouncerRepository.alternateBouncerUIAvailable.value) } private fun givenCanShowAlternateBouncer() { bouncerRepository.setAlternateBouncerUIAvailable(true) biometricSettingsRepository.setFingerprintEnrolled(true) Loading