Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/DeviceEntrySideFpsOverlayInteractorTest.kt +38 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.keyguard.domain.interactor import android.platform.test.annotations.EnableFlags import android.security.Flags.FLAG_SECURE_LOCK_DEVICE import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.keyguard.keyguardUpdateMonitor Loading @@ -23,12 +25,16 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.bouncer.data.repository.keyguardBouncerRepository import com.android.systemui.coroutines.collectLastValue import com.android.systemui.coroutines.collectValues import com.android.systemui.deviceentry.data.repository.fakeDeviceEntryRepository import com.android.systemui.deviceentry.shared.model.DeviceUnlockSource import com.android.systemui.deviceentry.shared.model.DeviceUnlockStatus import com.android.systemui.flags.EnableSceneContainer import com.android.systemui.keyguard.data.repository.deviceEntryFingerprintAuthRepository import com.android.systemui.kosmos.testScope import com.android.systemui.res.R import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.scene.shared.model.Overlays import com.android.systemui.securelockdevice.data.repository.fakeSecureLockDeviceRepository import com.android.systemui.testKosmos import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat Loading Loading @@ -125,6 +131,37 @@ class DeviceEntrySideFpsOverlayInteractorTest : SysuiTestCase() { assertThat(showIndicatorForDeviceEntry).isFalse() } @Test @EnableFlags(FLAG_SECURE_LOCK_DEVICE) fun updatesShowIndicatorForDeviceEntry_onEnteringAndExitingSecureLockDeviceBiometricAuth() = testScope.runTest { val showIndicatorForDeviceEntry by collectLastValue(underTest.showIndicatorForDeviceEntry) // Secure lock device credential auth step kosmos.fakeSecureLockDeviceRepository.onSecureLockDeviceEnabled() whenever(keyguardUpdateMonitor.isFingerprintDetectionRunning).thenReturn(false) whenever(keyguardUpdateMonitor.isUnlockingWithFingerprintAllowed).thenReturn(false) runCurrent() assertThat(showIndicatorForDeviceEntry).isFalse() // Secure lock device biometric auth step kosmos.fakeSecureLockDeviceRepository.onSuccessfulPrimaryAuth() whenever(keyguardUpdateMonitor.isFingerprintDetectionRunning).thenReturn(true) whenever(keyguardUpdateMonitor.isUnlockingWithFingerprintAllowed).thenReturn(true) runCurrent() assertThat(showIndicatorForDeviceEntry).isTrue() // Mock biometric unlock / secure lock device disabled, should hide SFPS indicator kosmos.fakeSecureLockDeviceRepository.onSecureLockDeviceDisabled() kosmos.fakeDeviceEntryRepository.deviceUnlockStatus.value = DeviceUnlockStatus(true, DeviceUnlockSource.Fingerprint) whenever(keyguardUpdateMonitor.isFingerprintDetectionRunning).thenReturn(false) whenever(keyguardUpdateMonitor.isUnlockingWithFingerprintAllowed).thenReturn(false) runCurrent() assertThat(showIndicatorForDeviceEntry).isFalse() } @Test fun updatesShowIndicatorForDeviceEntry_fromPrimaryBouncer_whenFpsDetectionNotRunning() { testScope.runTest { Loading Loading @@ -279,6 +316,7 @@ class DeviceEntrySideFpsOverlayInteractorTest : SysuiTestCase() { R.bool.config_show_sidefps_hint_on_bouncer, true, ) runCurrent() } } packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/DeviceEntrySideFpsOverlayInteractor.kt +38 −3 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.keyguard.domain.interactor import android.content.Context import android.security.Flags.secureLockDevice import android.util.Log import com.android.keyguard.KeyguardUpdateMonitor import com.android.systemui.bouncer.domain.interactor.AlternateBouncerInteractor Loading @@ -27,6 +28,7 @@ import com.android.systemui.res.R import com.android.systemui.scene.domain.interactor.SceneInteractor import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.scene.shared.model.Overlays import com.android.systemui.securelockdevice.domain.interactor.SecureLockDeviceInteractor import com.android.systemui.shade.ShadeDisplayAware import javax.inject.Inject import kotlinx.coroutines.flow.Flow Loading @@ -51,6 +53,7 @@ constructor( deviceEntryFingerprintAuthRepository: DeviceEntryFingerprintAuthRepository, private val sceneInteractor: SceneInteractor, private val primaryBouncerInteractor: PrimaryBouncerInteractor, secureLockDeviceInteractor: SecureLockDeviceInteractor, alternateBouncerInteractor: AlternateBouncerInteractor, private val keyguardUpdateMonitor: KeyguardUpdateMonitor, ) { Loading @@ -65,6 +68,31 @@ constructor( flowOf(false) } private val isBiometricAuthRequestedForSecureLockDevice: Flow<Boolean> = if (secureLockDevice()) { secureLockDeviceInteractor.requiresStrongBiometricAuthForSecureLockDevice } else { flowOf(false) } /** * Indicates when secure lock device is requesting SFPS auth and the SFPS indicator should be * shown on the UI */ val showIndicatorForSecureLockDeviceBiometricAuth: Flow<Boolean> = if (secureLockDevice()) { isBiometricAuthRequestedForSecureLockDevice .map { biometricAuthRequested -> biometricAuthRequested && keyguardUpdateMonitor.isFingerprintDetectionRunning && keyguardUpdateMonitor.isUnlockingWithFingerprintAllowed } .distinctUntilChanged() .onEach { Log.d(TAG, "showIndicatorForSecureLockDeviceBiometricAuth updated: $it") } } else { flowOf(false) } private val showIndicatorForPrimaryBouncer: Flow<Boolean> = merge( // Legacy bouncer visibility changes. Loading Loading @@ -94,10 +122,17 @@ constructor( * sensor indicator. */ val showIndicatorForDeviceEntry: Flow<Boolean> = combine(showIndicatorForPrimaryBouncer, showIndicatorForAlternateBouncer) { combine( showIndicatorForPrimaryBouncer, showIndicatorForAlternateBouncer, showIndicatorForSecureLockDeviceBiometricAuth, ) { showForPrimaryBouncer, showForAlternateBouncer -> showForPrimaryBouncer || showForAlternateBouncer showForAlternateBouncer, showIndicatorForSecureLockDeviceBiometricAuth -> showForPrimaryBouncer || showForAlternateBouncer || showIndicatorForSecureLockDeviceBiometricAuth } .distinctUntilChanged() .onEach { Log.d(TAG, "showIndicatorForDeviceEntry updated: $it") } Loading packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/DeviceEntrySideFpsOverlayInteractorKosmos.kt +2 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import com.android.systemui.bouncer.domain.interactor.primaryBouncerInteractor import com.android.systemui.keyguard.data.repository.deviceEntryFingerprintAuthRepository import com.android.systemui.kosmos.Kosmos import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.securelockdevice.domain.interactor.secureLockDeviceInteractor val Kosmos.deviceEntrySideFpsOverlayInteractor: DeviceEntrySideFpsOverlayInteractor by Kosmos.Fixture { Loading @@ -30,6 +31,7 @@ val Kosmos.deviceEntrySideFpsOverlayInteractor: DeviceEntrySideFpsOverlayInterac context = applicationContext, deviceEntryFingerprintAuthRepository = deviceEntryFingerprintAuthRepository, sceneInteractor = sceneInteractor, secureLockDeviceInteractor = secureLockDeviceInteractor, primaryBouncerInteractor = primaryBouncerInteractor, alternateBouncerInteractor = alternateBouncerInteractor, keyguardUpdateMonitor = keyguardUpdateMonitor, Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/DeviceEntrySideFpsOverlayInteractorTest.kt +38 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.keyguard.domain.interactor import android.platform.test.annotations.EnableFlags import android.security.Flags.FLAG_SECURE_LOCK_DEVICE import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.keyguard.keyguardUpdateMonitor Loading @@ -23,12 +25,16 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.bouncer.data.repository.keyguardBouncerRepository import com.android.systemui.coroutines.collectLastValue import com.android.systemui.coroutines.collectValues import com.android.systemui.deviceentry.data.repository.fakeDeviceEntryRepository import com.android.systemui.deviceentry.shared.model.DeviceUnlockSource import com.android.systemui.deviceentry.shared.model.DeviceUnlockStatus import com.android.systemui.flags.EnableSceneContainer import com.android.systemui.keyguard.data.repository.deviceEntryFingerprintAuthRepository import com.android.systemui.kosmos.testScope import com.android.systemui.res.R import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.scene.shared.model.Overlays import com.android.systemui.securelockdevice.data.repository.fakeSecureLockDeviceRepository import com.android.systemui.testKosmos import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat Loading Loading @@ -125,6 +131,37 @@ class DeviceEntrySideFpsOverlayInteractorTest : SysuiTestCase() { assertThat(showIndicatorForDeviceEntry).isFalse() } @Test @EnableFlags(FLAG_SECURE_LOCK_DEVICE) fun updatesShowIndicatorForDeviceEntry_onEnteringAndExitingSecureLockDeviceBiometricAuth() = testScope.runTest { val showIndicatorForDeviceEntry by collectLastValue(underTest.showIndicatorForDeviceEntry) // Secure lock device credential auth step kosmos.fakeSecureLockDeviceRepository.onSecureLockDeviceEnabled() whenever(keyguardUpdateMonitor.isFingerprintDetectionRunning).thenReturn(false) whenever(keyguardUpdateMonitor.isUnlockingWithFingerprintAllowed).thenReturn(false) runCurrent() assertThat(showIndicatorForDeviceEntry).isFalse() // Secure lock device biometric auth step kosmos.fakeSecureLockDeviceRepository.onSuccessfulPrimaryAuth() whenever(keyguardUpdateMonitor.isFingerprintDetectionRunning).thenReturn(true) whenever(keyguardUpdateMonitor.isUnlockingWithFingerprintAllowed).thenReturn(true) runCurrent() assertThat(showIndicatorForDeviceEntry).isTrue() // Mock biometric unlock / secure lock device disabled, should hide SFPS indicator kosmos.fakeSecureLockDeviceRepository.onSecureLockDeviceDisabled() kosmos.fakeDeviceEntryRepository.deviceUnlockStatus.value = DeviceUnlockStatus(true, DeviceUnlockSource.Fingerprint) whenever(keyguardUpdateMonitor.isFingerprintDetectionRunning).thenReturn(false) whenever(keyguardUpdateMonitor.isUnlockingWithFingerprintAllowed).thenReturn(false) runCurrent() assertThat(showIndicatorForDeviceEntry).isFalse() } @Test fun updatesShowIndicatorForDeviceEntry_fromPrimaryBouncer_whenFpsDetectionNotRunning() { testScope.runTest { Loading Loading @@ -279,6 +316,7 @@ class DeviceEntrySideFpsOverlayInteractorTest : SysuiTestCase() { R.bool.config_show_sidefps_hint_on_bouncer, true, ) runCurrent() } }
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/DeviceEntrySideFpsOverlayInteractor.kt +38 −3 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.keyguard.domain.interactor import android.content.Context import android.security.Flags.secureLockDevice import android.util.Log import com.android.keyguard.KeyguardUpdateMonitor import com.android.systemui.bouncer.domain.interactor.AlternateBouncerInteractor Loading @@ -27,6 +28,7 @@ import com.android.systemui.res.R import com.android.systemui.scene.domain.interactor.SceneInteractor import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.scene.shared.model.Overlays import com.android.systemui.securelockdevice.domain.interactor.SecureLockDeviceInteractor import com.android.systemui.shade.ShadeDisplayAware import javax.inject.Inject import kotlinx.coroutines.flow.Flow Loading @@ -51,6 +53,7 @@ constructor( deviceEntryFingerprintAuthRepository: DeviceEntryFingerprintAuthRepository, private val sceneInteractor: SceneInteractor, private val primaryBouncerInteractor: PrimaryBouncerInteractor, secureLockDeviceInteractor: SecureLockDeviceInteractor, alternateBouncerInteractor: AlternateBouncerInteractor, private val keyguardUpdateMonitor: KeyguardUpdateMonitor, ) { Loading @@ -65,6 +68,31 @@ constructor( flowOf(false) } private val isBiometricAuthRequestedForSecureLockDevice: Flow<Boolean> = if (secureLockDevice()) { secureLockDeviceInteractor.requiresStrongBiometricAuthForSecureLockDevice } else { flowOf(false) } /** * Indicates when secure lock device is requesting SFPS auth and the SFPS indicator should be * shown on the UI */ val showIndicatorForSecureLockDeviceBiometricAuth: Flow<Boolean> = if (secureLockDevice()) { isBiometricAuthRequestedForSecureLockDevice .map { biometricAuthRequested -> biometricAuthRequested && keyguardUpdateMonitor.isFingerprintDetectionRunning && keyguardUpdateMonitor.isUnlockingWithFingerprintAllowed } .distinctUntilChanged() .onEach { Log.d(TAG, "showIndicatorForSecureLockDeviceBiometricAuth updated: $it") } } else { flowOf(false) } private val showIndicatorForPrimaryBouncer: Flow<Boolean> = merge( // Legacy bouncer visibility changes. Loading Loading @@ -94,10 +122,17 @@ constructor( * sensor indicator. */ val showIndicatorForDeviceEntry: Flow<Boolean> = combine(showIndicatorForPrimaryBouncer, showIndicatorForAlternateBouncer) { combine( showIndicatorForPrimaryBouncer, showIndicatorForAlternateBouncer, showIndicatorForSecureLockDeviceBiometricAuth, ) { showForPrimaryBouncer, showForAlternateBouncer -> showForPrimaryBouncer || showForAlternateBouncer showForAlternateBouncer, showIndicatorForSecureLockDeviceBiometricAuth -> showForPrimaryBouncer || showForAlternateBouncer || showIndicatorForSecureLockDeviceBiometricAuth } .distinctUntilChanged() .onEach { Log.d(TAG, "showIndicatorForDeviceEntry updated: $it") } Loading
packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/DeviceEntrySideFpsOverlayInteractorKosmos.kt +2 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import com.android.systemui.bouncer.domain.interactor.primaryBouncerInteractor import com.android.systemui.keyguard.data.repository.deviceEntryFingerprintAuthRepository import com.android.systemui.kosmos.Kosmos import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.securelockdevice.domain.interactor.secureLockDeviceInteractor val Kosmos.deviceEntrySideFpsOverlayInteractor: DeviceEntrySideFpsOverlayInteractor by Kosmos.Fixture { Loading @@ -30,6 +31,7 @@ val Kosmos.deviceEntrySideFpsOverlayInteractor: DeviceEntrySideFpsOverlayInterac context = applicationContext, deviceEntryFingerprintAuthRepository = deviceEntryFingerprintAuthRepository, sceneInteractor = sceneInteractor, secureLockDeviceInteractor = secureLockDeviceInteractor, primaryBouncerInteractor = primaryBouncerInteractor, alternateBouncerInteractor = alternateBouncerInteractor, keyguardUpdateMonitor = keyguardUpdateMonitor, Loading