Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/DeviceEntrySideFpsOverlayInteractor.kt +6 −4 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.map Loading Loading @@ -86,6 +87,7 @@ constructor( showForAlternateBouncer -> showForPrimaryBouncer || showForAlternateBouncer } .distinctUntilChanged() private fun shouldShowIndicatorForPrimaryBouncer(): Boolean { val sfpsEnabled: Boolean = Loading packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/DeviceEntrySideFpsOverlayInteractorTest.kt +27 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerInteractor import com.android.systemui.bouncer.ui.BouncerView import com.android.systemui.classifier.FalsingCollector import com.android.systemui.coroutines.collectLastValue import com.android.systemui.coroutines.collectValues import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFaceAuthInteractor import com.android.systemui.keyguard.DismissCallbackRegistry import com.android.systemui.keyguard.data.repository.FakeBiometricSettingsRepository Loading Loading @@ -69,6 +70,7 @@ class DeviceEntrySideFpsOverlayInteractorTest : SysuiTestCase() { private val bouncerRepository = FakeKeyguardBouncerRepository() private val biometricSettingsRepository = FakeBiometricSettingsRepository() private val deviceEntryFingerprintAuthRepository = FakeDeviceEntryFingerprintAuthRepository() private lateinit var primaryBouncerInteractor: PrimaryBouncerInteractor private lateinit var alternateBouncerInteractor: AlternateBouncerInteractor Loading Loading @@ -112,7 +114,7 @@ class DeviceEntrySideFpsOverlayInteractorTest : SysuiTestCase() { DeviceEntrySideFpsOverlayInteractor( testScope.backgroundScope, mContext, FakeDeviceEntryFingerprintAuthRepository(), deviceEntryFingerprintAuthRepository, primaryBouncerInteractor, alternateBouncerInteractor, keyguardUpdateMonitor Loading Loading @@ -216,6 +218,30 @@ class DeviceEntrySideFpsOverlayInteractorTest : SysuiTestCase() { assertThat(showIndicatorForDeviceEntry).isEqualTo(false) } @Test fun ignoresDuplicateRequestsToShowIndicatorForDeviceEntry() = testScope.runTest { val showIndicatorForDeviceEntry by collectValues(underTest.showIndicatorForDeviceEntry) runCurrent() // Request to show indicator for primary bouncer showing updatePrimaryBouncer( isShowing = true, isAnimatingAway = false, fpsDetectionRunning = true, isUnlockingWithFpAllowed = true ) // Another request to show indicator for deviceEntryFingerprintAuthRepository update deviceEntryFingerprintAuthRepository.setShouldUpdateIndicatorVisibility(true) // Request to show indicator for alternate bouncer showing bouncerRepository.setAlternateVisible(true) // Ensure only one show request is sent assertThat(showIndicatorForDeviceEntry).containsExactly(false, true) } private fun updatePrimaryBouncer( isShowing: Boolean, isAnimatingAway: Boolean, Loading packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeDeviceEntryFingerprintAuthRepository.kt +4 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,10 @@ class FakeDeviceEntryFingerprintAuthRepository @Inject constructor() : fun setAuthenticationStatus(status: FingerprintAuthenticationStatus) { _authenticationStatus.value = status } fun setShouldUpdateIndicatorVisibility(shouldUpdateIndicatorVisibility: Boolean) { _shouldUpdateIndicatorVisibility.value = shouldUpdateIndicatorVisibility } } @Module Loading Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/DeviceEntrySideFpsOverlayInteractor.kt +6 −4 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.map Loading Loading @@ -86,6 +87,7 @@ constructor( showForAlternateBouncer -> showForPrimaryBouncer || showForAlternateBouncer } .distinctUntilChanged() private fun shouldShowIndicatorForPrimaryBouncer(): Boolean { val sfpsEnabled: Boolean = Loading
packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/DeviceEntrySideFpsOverlayInteractorTest.kt +27 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerInteractor import com.android.systemui.bouncer.ui.BouncerView import com.android.systemui.classifier.FalsingCollector import com.android.systemui.coroutines.collectLastValue import com.android.systemui.coroutines.collectValues import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFaceAuthInteractor import com.android.systemui.keyguard.DismissCallbackRegistry import com.android.systemui.keyguard.data.repository.FakeBiometricSettingsRepository Loading Loading @@ -69,6 +70,7 @@ class DeviceEntrySideFpsOverlayInteractorTest : SysuiTestCase() { private val bouncerRepository = FakeKeyguardBouncerRepository() private val biometricSettingsRepository = FakeBiometricSettingsRepository() private val deviceEntryFingerprintAuthRepository = FakeDeviceEntryFingerprintAuthRepository() private lateinit var primaryBouncerInteractor: PrimaryBouncerInteractor private lateinit var alternateBouncerInteractor: AlternateBouncerInteractor Loading Loading @@ -112,7 +114,7 @@ class DeviceEntrySideFpsOverlayInteractorTest : SysuiTestCase() { DeviceEntrySideFpsOverlayInteractor( testScope.backgroundScope, mContext, FakeDeviceEntryFingerprintAuthRepository(), deviceEntryFingerprintAuthRepository, primaryBouncerInteractor, alternateBouncerInteractor, keyguardUpdateMonitor Loading Loading @@ -216,6 +218,30 @@ class DeviceEntrySideFpsOverlayInteractorTest : SysuiTestCase() { assertThat(showIndicatorForDeviceEntry).isEqualTo(false) } @Test fun ignoresDuplicateRequestsToShowIndicatorForDeviceEntry() = testScope.runTest { val showIndicatorForDeviceEntry by collectValues(underTest.showIndicatorForDeviceEntry) runCurrent() // Request to show indicator for primary bouncer showing updatePrimaryBouncer( isShowing = true, isAnimatingAway = false, fpsDetectionRunning = true, isUnlockingWithFpAllowed = true ) // Another request to show indicator for deviceEntryFingerprintAuthRepository update deviceEntryFingerprintAuthRepository.setShouldUpdateIndicatorVisibility(true) // Request to show indicator for alternate bouncer showing bouncerRepository.setAlternateVisible(true) // Ensure only one show request is sent assertThat(showIndicatorForDeviceEntry).containsExactly(false, true) } private fun updatePrimaryBouncer( isShowing: Boolean, isAnimatingAway: Boolean, Loading
packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeDeviceEntryFingerprintAuthRepository.kt +4 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,10 @@ class FakeDeviceEntryFingerprintAuthRepository @Inject constructor() : fun setAuthenticationStatus(status: FingerprintAuthenticationStatus) { _authenticationStatus.value = status } fun setShouldUpdateIndicatorVisibility(shouldUpdateIndicatorVisibility: Boolean) { _shouldUpdateIndicatorVisibility.value = shouldUpdateIndicatorVisibility } } @Module Loading