summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Beverly Tai <beverlyt@google.com> 2024-05-03 15:55:26 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-05-03 15:55:26 +0000
commitcdb63b98b02bfb927f6964915dab58aec7df0f77 (patch)
treeebf04f5c17f12dac2615e44dfd03c9a766816c1a
parentdaad29b00f6a7813a60a8598486db16c1e963b9f (diff)
parentda73fdf9d877128026d10ae0acce42e7f39a2ca4 (diff)
Merge "Update biometricUnlockMode with biometricUnlockSource" into main
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/AuthRippleInteractorTest.kt14
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntrySourceInteractorTest.kt21
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt10
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/LightRevealScrimRepositoryTest.kt38
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromAodTransitionInteractorTest.kt9
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ActivityStarterImplTest.kt1
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImplTest.kt2
-rw-r--r--packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntrySourceInteractor.kt9
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt43
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/data/repository/LightRevealScrimRepository.kt67
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/BiometricUnlockInteractor.kt30
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromAodTransitionInteractor.kt9
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractor.kt6
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDreamingLockscreenHostedTransitionInteractor.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDreamingTransitionInteractor.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt9
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/shared/model/BiometricUnlockModel.kt21
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java48
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImpl.kt4
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryHapticsInteractorTest.kt4
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorTest.kt5
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/FromDreamingTransitionInteractorTest.kt5
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt6
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java9
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt20
26 files changed, 218 insertions, 184 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/AuthRippleInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/AuthRippleInteractorTest.kt
index 88ad3f37dacd..3005d0b0d160 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/AuthRippleInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/AuthRippleInteractorTest.kt
@@ -22,7 +22,7 @@ import com.android.systemui.SysuiTestCase
import com.android.systemui.biometrics.data.repository.fingerprintPropertyRepository
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
-import com.android.systemui.keyguard.shared.model.BiometricUnlockModel
+import com.android.systemui.keyguard.shared.model.BiometricUnlockMode
import com.android.systemui.keyguard.shared.model.BiometricUnlockSource
import com.android.systemui.kosmos.testScope
import com.android.systemui.testKosmos
@@ -70,8 +70,10 @@ class AuthRippleInteractorTest : SysuiTestCase() {
fun faceUnlocked_showsAuthRipple() =
testScope.runTest {
val showUnlockRipple by collectLastValue(underTest.showUnlockRipple)
- keyguardRepository.setBiometricUnlockSource(BiometricUnlockSource.FACE_SENSOR)
- keyguardRepository.setBiometricUnlockState(BiometricUnlockModel.WAKE_AND_UNLOCK)
+ keyguardRepository.setBiometricUnlockState(
+ BiometricUnlockMode.WAKE_AND_UNLOCK,
+ BiometricUnlockSource.FACE_SENSOR
+ )
assertThat(showUnlockRipple).isEqualTo(BiometricUnlockSource.FACE_SENSOR)
}
@@ -79,8 +81,10 @@ class AuthRippleInteractorTest : SysuiTestCase() {
fun fingerprintUnlocked_showsAuthRipple() =
testScope.runTest {
val showUnlockRippleFromBiometricUnlock by collectLastValue(underTest.showUnlockRipple)
- keyguardRepository.setBiometricUnlockSource(BiometricUnlockSource.FINGERPRINT_SENSOR)
- keyguardRepository.setBiometricUnlockState(BiometricUnlockModel.WAKE_AND_UNLOCK)
+ keyguardRepository.setBiometricUnlockState(
+ BiometricUnlockMode.WAKE_AND_UNLOCK,
+ BiometricUnlockSource.FINGERPRINT_SENSOR
+ )
assertThat(showUnlockRippleFromBiometricUnlock)
.isEqualTo(BiometricUnlockSource.FINGERPRINT_SENSOR)
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntrySourceInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntrySourceInteractorTest.kt
index d216fa0d0eff..2e4c97bc80d0 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntrySourceInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntrySourceInteractorTest.kt
@@ -21,7 +21,7 @@ import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
-import com.android.systemui.keyguard.shared.model.BiometricUnlockModel
+import com.android.systemui.keyguard.shared.model.BiometricUnlockMode
import com.android.systemui.keyguard.shared.model.BiometricUnlockSource
import com.android.systemui.kosmos.testScope
import com.android.systemui.testKosmos
@@ -46,8 +46,10 @@ class DeviceEntrySourceInteractorTest : SysuiTestCase() {
testScope.runTest {
val deviceEntryFromBiometricAuthentication by
collectLastValue(underTest.deviceEntryFromBiometricSource)
- keyguardRepository.setBiometricUnlockSource(BiometricUnlockSource.FACE_SENSOR)
- keyguardRepository.setBiometricUnlockState(BiometricUnlockModel.WAKE_AND_UNLOCK)
+ keyguardRepository.setBiometricUnlockState(
+ BiometricUnlockMode.WAKE_AND_UNLOCK,
+ BiometricUnlockSource.FACE_SENSOR,
+ )
runCurrent()
assertThat(deviceEntryFromBiometricAuthentication)
.isEqualTo(BiometricUnlockSource.FACE_SENSOR)
@@ -57,8 +59,10 @@ class DeviceEntrySourceInteractorTest : SysuiTestCase() {
fun deviceEntryFromFingerprintUnlock() = runTest {
val deviceEntryFromBiometricAuthentication by
collectLastValue(underTest.deviceEntryFromBiometricSource)
- keyguardRepository.setBiometricUnlockSource(BiometricUnlockSource.FINGERPRINT_SENSOR)
- keyguardRepository.setBiometricUnlockState(BiometricUnlockModel.WAKE_AND_UNLOCK)
+ keyguardRepository.setBiometricUnlockState(
+ BiometricUnlockMode.WAKE_AND_UNLOCK,
+ BiometricUnlockSource.FINGERPRINT_SENSOR,
+ )
runCurrent()
assertThat(deviceEntryFromBiometricAuthentication)
.isEqualTo(BiometricUnlockSource.FINGERPRINT_SENSOR)
@@ -68,9 +72,10 @@ class DeviceEntrySourceInteractorTest : SysuiTestCase() {
fun noDeviceEntry() = runTest {
val deviceEntryFromBiometricAuthentication by
collectLastValue(underTest.deviceEntryFromBiometricSource)
- keyguardRepository.setBiometricUnlockSource(BiometricUnlockSource.FINGERPRINT_SENSOR)
- // doesn't dismiss keyguard:
- keyguardRepository.setBiometricUnlockState(BiometricUnlockModel.ONLY_WAKE)
+ keyguardRepository.setBiometricUnlockState(
+ BiometricUnlockMode.ONLY_WAKE, // doesn't dismiss keyguard:
+ BiometricUnlockSource.FINGERPRINT_SENSOR,
+ )
runCurrent()
assertThat(deviceEntryFromBiometricAuthentication).isNull()
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt
index 19b80da62dc7..f375ec7b8884 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt
@@ -30,6 +30,7 @@ import com.android.systemui.doze.DozeMachine
import com.android.systemui.doze.DozeTransitionCallback
import com.android.systemui.doze.DozeTransitionListener
import com.android.systemui.dreams.DreamOverlayCallbackController
+import com.android.systemui.keyguard.shared.model.BiometricUnlockMode
import com.android.systemui.keyguard.shared.model.BiometricUnlockSource
import com.android.systemui.keyguard.shared.model.DozeStateModel
import com.android.systemui.keyguard.shared.model.DozeTransitionModel
@@ -515,11 +516,9 @@ class KeyguardRepositoryImplTest : SysuiTestCase() {
fun biometricUnlockSource() =
testScope.runTest {
val values = mutableListOf<BiometricUnlockSource?>()
- val job = underTest.biometricUnlockSource.onEach(values::add).launchIn(this)
+ val job = underTest.biometricUnlockState.onEach { values.add(it.source) }.launchIn(this)
runCurrent()
- val captor = argumentCaptor<KeyguardUpdateMonitorCallback>()
- verify(keyguardUpdateMonitor).registerCallback(captor.capture())
// An initial, null value should be initially emitted so that flows combined with this
// one
@@ -535,7 +534,10 @@ class KeyguardRepositoryImplTest : SysuiTestCase() {
BiometricSourceType.FINGERPRINT,
)
.onEach { biometricSourceType ->
- captor.value.onBiometricAuthenticated(0, biometricSourceType, false)
+ underTest.setBiometricUnlockState(
+ BiometricUnlockMode.NONE,
+ BiometricUnlockSource.Companion.fromBiometricSourceType(biometricSourceType)
+ )
runCurrent()
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/LightRevealScrimRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/LightRevealScrimRepositoryTest.kt
index 69a1a0f3196e..0bfcd548881b 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/LightRevealScrimRepositoryTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/LightRevealScrimRepositoryTest.kt
@@ -24,7 +24,7 @@ import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.animation.AnimatorTestRule
import com.android.systemui.coroutines.collectLastValue
-import com.android.systemui.keyguard.shared.model.BiometricUnlockModel
+import com.android.systemui.keyguard.shared.model.BiometricUnlockMode
import com.android.systemui.keyguard.shared.model.BiometricUnlockSource
import com.android.systemui.kosmos.testScope
import com.android.systemui.power.data.repository.powerRepository
@@ -89,7 +89,10 @@ class LightRevealScrimRepositoryTest : SysuiTestCase() {
// The source and sensor locations are still null, so we should still be using the
// default reveal despite a biometric unlock.
- fakeKeyguardRepository.setBiometricUnlockState(BiometricUnlockModel.WAKE_AND_UNLOCK)
+ fakeKeyguardRepository.setBiometricUnlockState(
+ BiometricUnlockMode.WAKE_AND_UNLOCK,
+ BiometricUnlockSource.FINGERPRINT_SENSOR
+ )
runCurrent()
values.assertEffectsMatchPredicates(
@@ -98,7 +101,10 @@ class LightRevealScrimRepositoryTest : SysuiTestCase() {
// We got a source but still have no sensor locations, so should be sticking with
// the default effect.
- fakeKeyguardRepository.setBiometricUnlockSource(BiometricUnlockSource.FINGERPRINT_SENSOR)
+ fakeKeyguardRepository.setBiometricUnlockState(
+ BiometricUnlockMode.WAKE_AND_UNLOCK,
+ BiometricUnlockSource.FINGERPRINT_SENSOR
+ )
runCurrent()
values.assertEffectsMatchPredicates(
@@ -117,8 +123,10 @@ class LightRevealScrimRepositoryTest : SysuiTestCase() {
// Now we have fingerprint sensor locations, and wake and unlock via fingerprint.
val fingerprintLocation = Point(500, 500)
fakeKeyguardRepository.setFingerprintSensorLocation(fingerprintLocation)
- fakeKeyguardRepository.setBiometricUnlockSource(BiometricUnlockSource.FINGERPRINT_SENSOR)
- fakeKeyguardRepository.setBiometricUnlockState(BiometricUnlockModel.WAKE_AND_UNLOCK_PULSING)
+ fakeKeyguardRepository.setBiometricUnlockState(
+ BiometricUnlockMode.WAKE_AND_UNLOCK_PULSING,
+ BiometricUnlockSource.FINGERPRINT_SENSOR
+ )
// We should now have switched to the circle reveal, at the fingerprint location.
runCurrent()
@@ -133,14 +141,21 @@ class LightRevealScrimRepositoryTest : SysuiTestCase() {
// Subsequent wake and unlocks should not emit duplicate, identical CircleReveals.
val valuesPrevSize = values.size
- fakeKeyguardRepository.setBiometricUnlockState(BiometricUnlockModel.WAKE_AND_UNLOCK_PULSING)
fakeKeyguardRepository.setBiometricUnlockState(
- BiometricUnlockModel.WAKE_AND_UNLOCK_FROM_DREAM
+ BiometricUnlockMode.WAKE_AND_UNLOCK_PULSING,
+ BiometricUnlockSource.FINGERPRINT_SENSOR
+ )
+ fakeKeyguardRepository.setBiometricUnlockState(
+ BiometricUnlockMode.WAKE_AND_UNLOCK_FROM_DREAM,
+ BiometricUnlockSource.FINGERPRINT_SENSOR
)
assertEquals(valuesPrevSize, values.size)
// Non-biometric unlock, we should return to the default reveal.
- fakeKeyguardRepository.setBiometricUnlockState(BiometricUnlockModel.NONE)
+ fakeKeyguardRepository.setBiometricUnlockState(
+ BiometricUnlockMode.NONE,
+ BiometricUnlockSource.FINGERPRINT_SENSOR
+ )
runCurrent()
values.assertEffectsMatchPredicates(
@@ -155,9 +170,10 @@ class LightRevealScrimRepositoryTest : SysuiTestCase() {
// We already have a face location, so switching to face source should update the
// CircleReveal.
- fakeKeyguardRepository.setBiometricUnlockSource(BiometricUnlockSource.FACE_SENSOR)
- runCurrent()
- fakeKeyguardRepository.setBiometricUnlockState(BiometricUnlockModel.WAKE_AND_UNLOCK)
+ fakeKeyguardRepository.setBiometricUnlockState(
+ BiometricUnlockMode.WAKE_AND_UNLOCK,
+ BiometricUnlockSource.FACE_SENSOR
+ )
runCurrent()
values.assertEffectsMatchPredicates(
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromAodTransitionInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromAodTransitionInteractorTest.kt
index 360f284f3072..d630a2f64c5f 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromAodTransitionInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromAodTransitionInteractorTest.kt
@@ -43,8 +43,7 @@ import com.android.systemui.keyguard.data.repository.FakeKeyguardTransitionRepos
import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository
import com.android.systemui.keyguard.data.repository.keyguardOcclusionRepository
-import com.android.systemui.keyguard.data.repository.keyguardRepository
-import com.android.systemui.keyguard.shared.model.BiometricUnlockModel
+import com.android.systemui.keyguard.shared.model.BiometricUnlockMode
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.keyguard.shared.model.TransitionState
import com.android.systemui.keyguard.shared.model.TransitionStep
@@ -99,7 +98,7 @@ class FromAodTransitionInteractorTest : SysuiTestCase() {
to = KeyguardState.AOD,
testScope
)
- kosmos.keyguardRepository.setBiometricUnlockState(BiometricUnlockModel.NONE)
+ kosmos.fakeKeyguardRepository.setBiometricUnlockState(BiometricUnlockMode.NONE)
reset(transitionRepository)
}
}
@@ -278,7 +277,9 @@ class FromAodTransitionInteractorTest : SysuiTestCase() {
@EnableFlags(Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR)
fun testWakeAndUnlock_transitionsToGone_onlyAfterDismissCallPostWakeup() =
testScope.runTest {
- kosmos.keyguardRepository.setBiometricUnlockState(BiometricUnlockModel.WAKE_AND_UNLOCK)
+ kosmos.fakeKeyguardRepository.setBiometricUnlockState(
+ BiometricUnlockMode.WAKE_AND_UNLOCK
+ )
powerInteractor.setAwakeForTest()
runCurrent()
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ActivityStarterImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ActivityStarterImplTest.kt
index 1501d9c3505a..b643968c6322 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ActivityStarterImplTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ActivityStarterImplTest.kt
@@ -30,7 +30,6 @@ import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock
import org.mockito.Mockito.mock
-import org.mockito.Mockito.times
import org.mockito.Mockito.verify
import org.mockito.MockitoAnnotations
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImplTest.kt
index b443489f98e2..0ca620751ddf 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImplTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImplTest.kt
@@ -259,7 +259,7 @@ class LegacyActivityStarterInternalImplTest : SysuiTestCase() {
underTest.dismissKeyguardThenExecute({ true }, {}, false)
verify(biometricUnlockController)
- .startWakeAndUnlock(BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING)
+ .startWakeAndUnlock(BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING, null)
}
@Test
diff --git a/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntrySourceInteractor.kt b/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntrySourceInteractor.kt
index d4f76a84c016..0b9336fec946 100644
--- a/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntrySourceInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntrySourceInteractor.kt
@@ -18,7 +18,7 @@ package com.android.systemui.deviceentry.domain.interactor
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
-import com.android.systemui.keyguard.shared.model.BiometricUnlockModel
+import com.android.systemui.keyguard.shared.model.BiometricUnlockMode
import com.android.systemui.keyguard.shared.model.BiometricUnlockSource
import com.android.systemui.util.kotlin.sample
import javax.inject.Inject
@@ -46,10 +46,9 @@ constructor(
) {
val deviceEntryFromBiometricSource: Flow<BiometricUnlockSource> =
keyguardInteractor.biometricUnlockState
- .filter { BiometricUnlockModel.dismissesKeyguard(it) }
- .sample(
- keyguardInteractor.biometricUnlockSource.filterNotNull(),
- )
+ .filter { BiometricUnlockMode.dismissesKeyguard(it.mode) }
+ .map { it.source }
+ .filterNotNull()
private val attemptEnterDeviceFromDeviceEntryIcon: MutableSharedFlow<Unit> = MutableSharedFlow()
val deviceEntryFromDeviceEntryIcon: Flow<Unit> =
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt
index 462d8373a430..8a53dd18541c 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt
@@ -17,7 +17,6 @@
package com.android.systemui.keyguard.data.repository
import android.graphics.Point
-import android.hardware.biometrics.BiometricSourceType
import com.android.keyguard.KeyguardUpdateMonitor
import com.android.keyguard.KeyguardUpdateMonitorCallback
import com.android.systemui.biometrics.AuthController
@@ -31,6 +30,7 @@ import com.android.systemui.doze.DozeMachine
import com.android.systemui.doze.DozeTransitionCallback
import com.android.systemui.doze.DozeTransitionListener
import com.android.systemui.dreams.DreamOverlayCallbackController
+import com.android.systemui.keyguard.shared.model.BiometricUnlockMode
import com.android.systemui.keyguard.shared.model.BiometricUnlockModel
import com.android.systemui.keyguard.shared.model.BiometricUnlockSource
import com.android.systemui.keyguard.shared.model.DismissAction
@@ -169,10 +169,13 @@ interface KeyguardRepository {
/** Observable for the [StatusBarState] */
val statusBarState: StateFlow<StatusBarState>
- /** Observable for biometric unlock modes */
+ /** Observable for biometric unlock state which includes the mode and unlock source */
val biometricUnlockState: Flow<BiometricUnlockModel>
- fun setBiometricUnlockState(value: BiometricUnlockModel)
+ fun setBiometricUnlockState(
+ unlockMode: BiometricUnlockMode,
+ unlockSource: BiometricUnlockSource?,
+ )
/** Approximate location on the screen of the fingerprint sensor. */
val fingerprintSensorLocation: Flow<Point?>
@@ -180,9 +183,6 @@ interface KeyguardRepository {
/** Approximate location on the screen of the face unlock sensor/front facing camera. */
val faceSensorLocation: Flow<Point?>
- /** Source of the most recent biometric unlock, such as fingerprint or face. */
- val biometricUnlockSource: Flow<BiometricUnlockSource?>
-
/** Whether quick settings or quick-quick settings is visible. */
val isQuickSettingsVisible: Flow<Boolean>
@@ -597,11 +597,15 @@ constructor(
statusBarStateIntToObject(statusBarStateController.state)
)
- private val _biometricUnlockState = MutableStateFlow(BiometricUnlockModel.NONE)
+ private val _biometricUnlockState: MutableStateFlow<BiometricUnlockModel> =
+ MutableStateFlow(BiometricUnlockModel(BiometricUnlockMode.NONE, null))
override val biometricUnlockState = _biometricUnlockState.asStateFlow()
- override fun setBiometricUnlockState(value: BiometricUnlockModel) {
- _biometricUnlockState.value = value
+ override fun setBiometricUnlockState(
+ unlockMode: BiometricUnlockMode,
+ unlockSource: BiometricUnlockSource?,
+ ) {
+ _biometricUnlockState.value = BiometricUnlockModel(unlockMode, unlockSource)
}
override val fingerprintSensorLocation: Flow<Point?> = conflatedCallbackFlow {
@@ -628,27 +632,6 @@ constructor(
override val faceSensorLocation: Flow<Point?> = facePropertyRepository.sensorLocation
- override val biometricUnlockSource: Flow<BiometricUnlockSource?> = conflatedCallbackFlow {
- val callback =
- object : KeyguardUpdateMonitorCallback() {
- override fun onBiometricAuthenticated(
- userId: Int,
- biometricSourceType: BiometricSourceType?,
- isStrongBiometric: Boolean
- ) {
- trySendWithFailureLogging(
- BiometricUnlockSource.fromBiometricSourceType(biometricSourceType),
- TAG,
- "onBiometricAuthenticated"
- )
- }
- }
-
- keyguardUpdateMonitor.registerCallback(callback)
- trySendWithFailureLogging(null, TAG, "initial value")
- awaitClose { keyguardUpdateMonitor.removeCallback(callback) }
- }
-
private val _isQuickSettingsVisible = MutableStateFlow(false)
override val isQuickSettingsVisible: Flow<Boolean> = _isQuickSettingsVisible.asStateFlow()
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/LightRevealScrimRepository.kt b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/LightRevealScrimRepository.kt
index eac476fcb368..0a15bbf18249 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/LightRevealScrimRepository.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/LightRevealScrimRepository.kt
@@ -24,7 +24,7 @@ import androidx.core.animation.Animator
import androidx.core.animation.ValueAnimator
import com.android.keyguard.logging.ScrimLogger
import com.android.systemui.dagger.SysUISingleton
-import com.android.systemui.keyguard.shared.model.BiometricUnlockModel
+import com.android.systemui.keyguard.shared.model.BiometricUnlockMode
import com.android.systemui.keyguard.shared.model.BiometricUnlockSource
import com.android.systemui.power.data.repository.PowerRepository
import com.android.systemui.power.shared.model.WakeSleepReason
@@ -40,7 +40,6 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.callbackFlow
-import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.flowOf
@@ -83,7 +82,7 @@ constructor(
}
/** The reveal effect used if the device was locked/unlocked via the power button. */
- private val powerButtonRevealEffect: Flow<LightRevealEffect?> =
+ private val powerButtonRevealEffect: Flow<LightRevealEffect> =
flowOf(
PowerButtonReveal(
context.resources
@@ -92,42 +91,31 @@ constructor(
)
)
- private val tapRevealEffect: Flow<LightRevealEffect?> =
+ private val tapRevealEffect: Flow<LightRevealEffect> =
keyguardRepository.lastDozeTapToWakePosition.map {
- it?.let { constructCircleRevealFromPoint(it) }
+ it?.let { constructCircleRevealFromPoint(it) } ?: DEFAULT_REVEAL_EFFECT
}
/**
* Reveal effect to use for a fingerprint unlock. This is reconstructed if the fingerprint
* sensor location on the screen (in pixels) changes due to configuration changes.
*/
- private val fingerprintRevealEffect: Flow<LightRevealEffect?> =
+ private val fingerprintRevealEffect: Flow<LightRevealEffect> =
keyguardRepository.fingerprintSensorLocation.map {
- it?.let { constructCircleRevealFromPoint(it) }
+ it?.let { constructCircleRevealFromPoint(it) } ?: DEFAULT_REVEAL_EFFECT
}
/**
* Reveal effect to use for a face unlock. This is reconstructed if the face sensor/front camera
* location on the screen (in pixels) changes due to configuration changes.
*/
- private val faceRevealEffect: Flow<LightRevealEffect?> =
- keyguardRepository.faceSensorLocation.map { it?.let { constructCircleRevealFromPoint(it) } }
-
- /**
- * The reveal effect we'll use for the next biometric unlock animation. We switch between the
- * fingerprint/face unlock effect flows depending on the biometric unlock source.
- */
- private val biometricRevealEffect: Flow<LightRevealEffect?> =
- keyguardRepository.biometricUnlockSource.flatMapLatest { source ->
- when (source) {
- BiometricUnlockSource.FINGERPRINT_SENSOR -> fingerprintRevealEffect
- BiometricUnlockSource.FACE_SENSOR -> faceRevealEffect
- else -> flowOf(null)
- }
+ private val faceRevealEffect: Flow<LightRevealEffect> =
+ keyguardRepository.faceSensorLocation.map {
+ it?.let { constructCircleRevealFromPoint(it) } ?: DEFAULT_REVEAL_EFFECT
}
/** The reveal effect we'll use for the next non-biometric unlock (tap, power button, etc). */
- private val nonBiometricRevealEffect: Flow<LightRevealEffect?> =
+ private val nonBiometricRevealEffect: Flow<LightRevealEffect> =
powerRepository.wakefulness.flatMapLatest { wakefulnessModel ->
when {
wakefulnessModel.isAwakeOrAsleepFrom(WakeSleepReason.POWER_BUTTON) ->
@@ -169,29 +157,22 @@ constructor(
scrimLogger.d(TAG, "startRevealAmountAnimator, reveal", reveal)
}
- override val revealEffect =
- combine(
- keyguardRepository.biometricUnlockState,
- biometricRevealEffect,
- nonBiometricRevealEffect
- ) { biometricUnlockState, biometricReveal, nonBiometricReveal ->
-
+ override val revealEffect: Flow<LightRevealEffect> =
+ keyguardRepository.biometricUnlockState
+ .flatMapLatest { biometricUnlockState ->
// Use the biometric reveal for any flavor of wake and unlocking.
- val revealEffect =
- when (biometricUnlockState) {
- BiometricUnlockModel.WAKE_AND_UNLOCK,
- BiometricUnlockModel.WAKE_AND_UNLOCK_PULSING,
- BiometricUnlockModel.WAKE_AND_UNLOCK_FROM_DREAM -> biometricReveal
- else -> nonBiometricReveal
+ when (biometricUnlockState.mode) {
+ BiometricUnlockMode.WAKE_AND_UNLOCK,
+ BiometricUnlockMode.WAKE_AND_UNLOCK_PULSING,
+ BiometricUnlockMode.WAKE_AND_UNLOCK_FROM_DREAM -> {
+ if (biometricUnlockState.source == BiometricUnlockSource.FACE_SENSOR) {
+ faceRevealEffect
+ } else {
+ fingerprintRevealEffect
+ }
}
- ?: DEFAULT_REVEAL_EFFECT
-
- scrimLogger.d(
- TAG,
- "revealEffect",
- "$revealEffect, biometricUnlockState: ${biometricUnlockState.name}"
- )
- return@combine revealEffect
+ else -> nonBiometricRevealEffect
+ }
}
.distinctUntilChanged()
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/BiometricUnlockInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/BiometricUnlockInteractor.kt
index cb003a760b26..576fafdc903e 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/BiometricUnlockInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/BiometricUnlockInteractor.kt
@@ -2,7 +2,8 @@ package com.android.systemui.keyguard.domain.interactor
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.data.repository.KeyguardRepository
-import com.android.systemui.keyguard.shared.model.BiometricUnlockModel
+import com.android.systemui.keyguard.shared.model.BiometricUnlockMode
+import com.android.systemui.keyguard.shared.model.BiometricUnlockSource
import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_DISMISS_BOUNCER
import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_NONE
import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_ONLY_WAKE
@@ -13,7 +14,9 @@ import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_
import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING
import com.android.systemui.statusbar.phone.BiometricUnlockController.WakeAndUnlockMode
import javax.inject.Inject
+import kotlinx.coroutines.ExperimentalCoroutinesApi
+@ExperimentalCoroutinesApi
@SysUISingleton
class BiometricUnlockInteractor
@Inject
@@ -21,21 +24,24 @@ constructor(
private val keyguardRepository: KeyguardRepository,
) {
- fun setBiometricUnlockState(@WakeAndUnlockMode unlockStateInt: Int) {
+ fun setBiometricUnlockState(
+ @WakeAndUnlockMode unlockStateInt: Int,
+ biometricUnlockSource: BiometricUnlockSource?,
+ ) {
val state = biometricModeIntToObject(unlockStateInt)
- keyguardRepository.setBiometricUnlockState(state)
+ keyguardRepository.setBiometricUnlockState(state, biometricUnlockSource)
}
- private fun biometricModeIntToObject(@WakeAndUnlockMode value: Int): BiometricUnlockModel {
+ private fun biometricModeIntToObject(@WakeAndUnlockMode value: Int): BiometricUnlockMode {
return when (value) {
- MODE_NONE -> BiometricUnlockModel.NONE
- MODE_WAKE_AND_UNLOCK -> BiometricUnlockModel.WAKE_AND_UNLOCK
- MODE_WAKE_AND_UNLOCK_PULSING -> BiometricUnlockModel.WAKE_AND_UNLOCK_PULSING
- MODE_SHOW_BOUNCER -> BiometricUnlockModel.SHOW_BOUNCER
- MODE_ONLY_WAKE -> BiometricUnlockModel.ONLY_WAKE
- MODE_UNLOCK_COLLAPSING -> BiometricUnlockModel.UNLOCK_COLLAPSING
- MODE_WAKE_AND_UNLOCK_FROM_DREAM -> BiometricUnlockModel.WAKE_AND_UNLOCK_FROM_DREAM
- MODE_DISMISS_BOUNCER -> BiometricUnlockModel.DISMISS_BOUNCER
+ MODE_NONE -> BiometricUnlockMode.NONE
+ MODE_WAKE_AND_UNLOCK -> BiometricUnlockMode.WAKE_AND_UNLOCK
+ MODE_WAKE_AND_UNLOCK_PULSING -> BiometricUnlockMode.WAKE_AND_UNLOCK_PULSING
+ MODE_SHOW_BOUNCER -> BiometricUnlockMode.SHOW_BOUNCER
+ MODE_ONLY_WAKE -> BiometricUnlockMode.ONLY_WAKE
+ MODE_UNLOCK_COLLAPSING -> BiometricUnlockMode.UNLOCK_COLLAPSING
+ MODE_WAKE_AND_UNLOCK_FROM_DREAM -> BiometricUnlockMode.WAKE_AND_UNLOCK_FROM_DREAM
+ MODE_DISMISS_BOUNCER -> BiometricUnlockMode.DISMISS_BOUNCER
else -> throw IllegalArgumentException("Invalid BiometricUnlockModel value: $value")
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromAodTransitionInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromAodTransitionInteractor.kt
index c2843d839d15..4d737749fbc1 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromAodTransitionInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromAodTransitionInteractor.kt
@@ -24,7 +24,7 @@ import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.keyguard.KeyguardWmStateRefactor
import com.android.systemui.keyguard.data.repository.KeyguardTransitionRepository
-import com.android.systemui.keyguard.shared.model.BiometricUnlockModel.Companion.isWakeAndUnlock
+import com.android.systemui.keyguard.shared.model.BiometricUnlockMode.Companion.isWakeAndUnlock
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.keyguard.shared.model.TransitionModeOnCanceled
import com.android.systemui.power.domain.interactor.PowerInteractor
@@ -72,7 +72,8 @@ constructor(
keyguardInteractor.isKeyguardDismissible,
keyguardInteractor.biometricUnlockState,
) { isKeyguardShowing, isKeyguardDismissible, biometricUnlockState ->
- (isWakeAndUnlock(biometricUnlockState) || (!isKeyguardShowing && isKeyguardDismissible))
+ (isWakeAndUnlock(biometricUnlockState.mode) ||
+ (!isKeyguardShowing && isKeyguardDismissible))
}
/**
@@ -110,11 +111,11 @@ constructor(
// receiving a call to #dismissAod() shortly when the authentication
// completes.
!maybeStartTransitionToOccludedOrInsecureCamera() &&
- !isWakeAndUnlock(biometricUnlockState) &&
+ !isWakeAndUnlock(biometricUnlockState.mode) &&
!primaryBouncerShowing
} else {
!isKeyguardOccludedLegacy &&
- !isWakeAndUnlock(biometricUnlockState) &&
+ !isWakeAndUnlock(biometricUnlockState.mode) &&
!primaryBouncerShowing
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractor.kt
index ca7fc669cb91..2eeb3b947a11 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractor.kt
@@ -24,7 +24,7 @@ import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.keyguard.KeyguardWmStateRefactor
import com.android.systemui.keyguard.data.repository.KeyguardTransitionRepository
-import com.android.systemui.keyguard.shared.model.BiometricUnlockModel.Companion.isWakeAndUnlock
+import com.android.systemui.keyguard.shared.model.BiometricUnlockMode.Companion.isWakeAndUnlock
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.power.domain.interactor.PowerInteractor
import com.android.systemui.util.kotlin.Utils.Companion.sample
@@ -99,7 +99,7 @@ constructor(
canDismissLockScreen,
primaryBouncerShowing) ->
startTransitionTo(
- if (isWakeAndUnlock(biometricUnlockState)) {
+ if (isWakeAndUnlock(biometricUnlockState.mode)) {
KeyguardState.GONE
} else if (canDismissLockScreen) {
KeyguardState.GONE
@@ -142,7 +142,7 @@ constructor(
if (
!maybeStartTransitionToOccludedOrInsecureCamera() &&
// Handled by dismissFromDozing().
- !isWakeAndUnlock(biometricUnlockState)
+ !isWakeAndUnlock(biometricUnlockState.mode)
) {
startTransitionTo(
if (canDismissLockscreen) {
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDreamingLockscreenHostedTransitionInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDreamingLockscreenHostedTransitionInteractor.kt
index 10d1e150e6d2..e738ea4397de 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDreamingLockscreenHostedTransitionInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDreamingLockscreenHostedTransitionInteractor.kt
@@ -22,7 +22,7 @@ import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.keyguard.data.repository.KeyguardTransitionRepository
-import com.android.systemui.keyguard.shared.model.BiometricUnlockModel
+import com.android.systemui.keyguard.shared.model.BiometricUnlockMode
import com.android.systemui.keyguard.shared.model.DozeStateModel
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.power.domain.interactor.PowerInteractor
@@ -104,7 +104,7 @@ constructor(
scope.launch {
keyguardInteractor.biometricUnlockState
.filterRelevantKeyguardStateAnd { biometricUnlockState ->
- biometricUnlockState == BiometricUnlockModel.WAKE_AND_UNLOCK_FROM_DREAM
+ biometricUnlockState.mode == BiometricUnlockMode.WAKE_AND_UNLOCK_FROM_DREAM
}
.collect { startTransitionTo(KeyguardState.GONE) }
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDreamingTransitionInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDreamingTransitionInteractor.kt
index 69c2c78db445..c952e0879d12 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDreamingTransitionInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDreamingTransitionInteractor.kt
@@ -25,7 +25,7 @@ import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.keyguard.KeyguardWmStateRefactor
import com.android.systemui.keyguard.data.repository.KeyguardTransitionRepository
-import com.android.systemui.keyguard.shared.model.BiometricUnlockModel
+import com.android.systemui.keyguard.shared.model.BiometricUnlockMode
import com.android.systemui.keyguard.shared.model.DozeStateModel
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.power.domain.interactor.PowerInteractor
@@ -193,7 +193,7 @@ constructor(
scope.launch {
keyguardInteractor.biometricUnlockState
.filterRelevantKeyguardStateAnd { biometricUnlockState ->
- biometricUnlockState == BiometricUnlockModel.WAKE_AND_UNLOCK_FROM_DREAM
+ biometricUnlockState.mode == BiometricUnlockMode.WAKE_AND_UNLOCK_FROM_DREAM
}
.collect { startTransitionTo(KeyguardState.GONE) }
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt
index 8d107abab503..88367f42abec 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt
@@ -33,7 +33,6 @@ import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.keyguard.MigrateClocksToBlueprint
import com.android.systemui.keyguard.data.repository.KeyguardRepository
import com.android.systemui.keyguard.shared.model.BiometricUnlockModel
-import com.android.systemui.keyguard.shared.model.BiometricUnlockSource
import com.android.systemui.keyguard.shared.model.CameraLaunchSourceModel
import com.android.systemui.keyguard.shared.model.DozeStateModel
import com.android.systemui.keyguard.shared.model.DozeStateModel.Companion.isDozeOff
@@ -235,13 +234,7 @@ constructor(
/** Observable for the [StatusBarState] */
val statusBarState: Flow<StatusBarState> = repository.statusBarState
- /** Source of the most recent biometric unlock, such as fingerprint or face. */
- val biometricUnlockSource: Flow<BiometricUnlockSource?> = repository.biometricUnlockSource
-
- /**
- * Observable for [BiometricUnlockModel] when biometrics like face or any fingerprint (rear,
- * side, under display) is used to unlock the device.
- */
+ /** Observable for [BiometricUnlockModel] when biometrics are used to unlock the device. */
val biometricUnlockState: Flow<BiometricUnlockModel> = repository.biometricUnlockState
/** Keyguard is present and is not occluded. */
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt
index 8d02e0efd72d..bb2eeb77969d 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt
@@ -17,7 +17,7 @@
package com.android.systemui.keyguard.domain.interactor
import com.android.systemui.dagger.SysUISingleton
-import com.android.systemui.keyguard.shared.model.BiometricUnlockModel
+import com.android.systemui.keyguard.shared.model.BiometricUnlockMode
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.keyguard.shared.model.TransitionState
import com.android.systemui.statusbar.notification.domain.interactor.NotificationLaunchAnimationInteractor
@@ -165,7 +165,7 @@ constructor(
) { isDozing, biometricUnlockState ->
// AOD is visible if we're dozing, unless we are wake and unlocking (where we go
// directly from AOD to unlocked while dozing).
- isDozing && !BiometricUnlockModel.isWakeAndUnlock(biometricUnlockState)
+ isDozing && !BiometricUnlockMode.isWakeAndUnlock(biometricUnlockState.mode)
}
.distinctUntilChanged()
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/BiometricUnlockModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/BiometricUnlockModel.kt
index 2ae5ce1ad545..4c709fbf4d9f 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/BiometricUnlockModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/BiometricUnlockModel.kt
@@ -15,8 +15,19 @@
*/
package com.android.systemui.keyguard.shared.model
+/**
+ * Model [BiometricUnlockMode] with [BiometricUnlockSource].
+ *
+ * @param source can be null as a starting state or if the unlock isn't coming from a biometric (the
+ * latter should be deprecated in the future, b/338578036)
+ */
+data class BiometricUnlockModel(
+ val mode: BiometricUnlockMode,
+ val source: BiometricUnlockSource?,
+)
+
/** Model device wakefulness states. */
-enum class BiometricUnlockModel {
+enum class BiometricUnlockMode {
/** Mode in which we don't need to wake up the device when we authenticate. */
NONE,
/**
@@ -60,12 +71,12 @@ enum class BiometricUnlockModel {
DISMISS_BOUNCER
)
- fun isWakeAndUnlock(model: BiometricUnlockModel): Boolean {
- return wakeAndUnlockModes.contains(model)
+ fun isWakeAndUnlock(mode: BiometricUnlockMode): Boolean {
+ return wakeAndUnlockModes.contains(mode)
}
- fun dismissesKeyguard(model: BiometricUnlockModel): Boolean {
- return dismissesKeyguardModes.contains(model)
+ fun dismissesKeyguard(mode: BiometricUnlockMode): Boolean {
+ return dismissesKeyguardModes.contains(mode)
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
index 79e6a0aa9c8c..f83aed8db4b5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
@@ -52,6 +52,7 @@ import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.keyguard.WakefulnessLifecycle;
import com.android.systemui.keyguard.domain.interactor.BiometricUnlockInteractor;
import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor;
+import com.android.systemui.keyguard.shared.model.BiometricUnlockSource;
import com.android.systemui.keyguard.shared.model.KeyguardState;
import com.android.systemui.keyguard.shared.model.TransitionStep;
import com.android.systemui.log.SessionTracker;
@@ -334,7 +335,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
@VisibleForTesting
protected void consumeTransitionStepOnStartedKeyguardState(TransitionStep transitionStep) {
if (transitionStep.getFrom() == KeyguardState.GONE) {
- mBiometricUnlockInteractor.setBiometricUnlockState(MODE_NONE);
+ mBiometricUnlockInteractor.setBiometricUnlockState(MODE_NONE, null);
}
}
@@ -409,7 +410,10 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
Trace.endSection();
return;
}
- startWakeAndUnlock(MODE_SHOW_BOUNCER);
+ startWakeAndUnlock(
+ MODE_SHOW_BOUNCER,
+ BiometricUnlockSource.Companion.fromBiometricSourceType(biometricSourceType)
+ );
}
@Override
@@ -456,10 +460,19 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
|| mode == MODE_WAKE_AND_UNLOCK_FROM_DREAM || mode == MODE_DISMISS_BOUNCER) {
onBiometricUnlockedWithKeyguardDismissal(biometricSourceType);
}
- startWakeAndUnlock(mode);
+ startWakeAndUnlock(
+ mode,
+ BiometricUnlockSource.Companion.fromBiometricSourceType(biometricSourceType)
+ );
}
- public void startWakeAndUnlock(@WakeAndUnlockMode int mode) {
+ /**
+ * Wake and unlock the device in response to successful authentication using biometrics.
+ */
+ public void startWakeAndUnlock(
+ @WakeAndUnlockMode int mode,
+ BiometricUnlockSource biometricUnlockSource
+ ) {
mLogger.logStartWakeAndUnlock(mode);
boolean wasDeviceInteractive = mUpdateMonitor.isDeviceInteractive();
mMode = mode;
@@ -532,15 +545,18 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
case MODE_NONE:
break;
}
- onModeChanged(mMode);
+ onModeChanged(mMode, biometricUnlockSource);
Trace.endSection();
}
- private void onModeChanged(@WakeAndUnlockMode int mode) {
+ private void onModeChanged(
+ @WakeAndUnlockMode int mode,
+ BiometricUnlockSource biometricUnlockSource
+ ) {
for (BiometricUnlockEventsListener listener : mBiometricUnlockEventsListeners) {
listener.onModeChanged(mode);
}
- mBiometricUnlockInteractor.setBiometricUnlockState(mode);
+ mBiometricUnlockInteractor.setBiometricUnlockState(mode, biometricUnlockSource);
}
private void onBiometricUnlockedWithKeyguardDismissal(BiometricSourceType biometricSourceType) {
@@ -719,7 +735,10 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
final boolean screenOff = !mUpdateMonitor.isDeviceInteractive();
if (!mVibratorHelper.hasVibrator() && screenOff) {
mLogger.d("wakeup device on authentication failure (device doesn't have a vibrator)");
- startWakeAndUnlock(MODE_ONLY_WAKE);
+ startWakeAndUnlock(
+ MODE_ONLY_WAKE,
+ BiometricUnlockSource.Companion.fromBiometricSourceType(biometricSourceType)
+ );
} else if (biometricSourceType == BiometricSourceType.FINGERPRINT
&& mUpdateMonitor.isUdfpsSupported()) {
long currUptimeMillis = mSystemClock.uptimeMillis();
@@ -732,7 +751,10 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
if (mNumConsecutiveFpFailures >= UDFPS_ATTEMPTS_BEFORE_SHOW_BOUNCER) {
mLogger.logUdfpsAttemptThresholdMet(mNumConsecutiveFpFailures);
- startWakeAndUnlock(MODE_SHOW_BOUNCER);
+ startWakeAndUnlock(
+ MODE_SHOW_BOUNCER,
+ BiometricUnlockSource.Companion.fromBiometricSourceType(biometricSourceType)
+ );
UI_EVENT_LOGGER.log(BiometricUiEvent.BIOMETRIC_BOUNCER_SHOWN, getSessionId());
mNumConsecutiveFpFailures = 0;
}
@@ -755,7 +777,10 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
|| msgId == FingerprintManager.FINGERPRINT_ERROR_LOCKOUT_PERMANENT);
if (fingerprintLockout) {
mLogger.d("fingerprint locked out");
- startWakeAndUnlock(MODE_SHOW_BOUNCER);
+ startWakeAndUnlock(
+ MODE_SHOW_BOUNCER,
+ BiometricUnlockSource.Companion.fromBiometricSourceType(biometricSourceType)
+ );
UI_EVENT_LOGGER.log(BiometricUiEvent.BIOMETRIC_BOUNCER_SHOWN, getSessionId());
}
@@ -897,7 +922,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
public interface BiometricUnlockEventsListener {
/** Called when {@code mMode} is reset to {@link #MODE_NONE}. */
default void onResetMode() {}
- /** Called when {@code mMode} has changed in {@link #startWakeAndUnlock(int)}. */
+ /** Called when {@code mMode} has changed in
+ * {@link #startWakeAndUnlock(int, BiometricUnlockSource)}. */
default void onModeChanged(@WakeAndUnlockMode int mode) {}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImpl.kt
index 6b685118a462..bcc7db162ddd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImpl.kt
@@ -417,10 +417,10 @@ constructor(
) {
// Reuse the biometric wake-and-unlock transition if we dismiss keyguard from a
// pulse.
- // TODO: Factor this transition out of BiometricUnlockController.
+ // TODO (b/338578036): Factor this transition out of BiometricUnlockController.
biometricUnlockControllerLazy
.get()
- .startWakeAndUnlock(BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING)
+ .startWakeAndUnlock(BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING, null)
}
if (keyguardStateController.isShowing) {
statusBarKeyguardViewManagerLazy
diff --git a/packages/SystemUI/tests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryHapticsInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryHapticsInteractorTest.kt
index 43c860cd302f..2b7e7adbe022 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryHapticsInteractorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryHapticsInteractorTest.kt
@@ -29,7 +29,7 @@ import com.android.systemui.keyguard.data.repository.biometricSettingsRepository
import com.android.systemui.keyguard.data.repository.deviceEntryFingerprintAuthRepository
import com.android.systemui.keyguard.data.repository.fakeDeviceEntryFaceAuthRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
-import com.android.systemui.keyguard.shared.model.BiometricUnlockModel
+import com.android.systemui.keyguard.shared.model.BiometricUnlockMode
import com.android.systemui.keyguard.shared.model.BiometricUnlockSource
import com.android.systemui.keyguard.shared.model.FailFingerprintAuthenticationStatus
import com.android.systemui.kosmos.testScope
@@ -162,7 +162,7 @@ class DeviceEntryHapticsInteractorTest : SysuiTestCase() {
kosmos.fakeKeyguardRepository.setBiometricUnlockSource(
BiometricUnlockSource.FINGERPRINT_SENSOR
)
- kosmos.fakeKeyguardRepository.setBiometricUnlockState(BiometricUnlockModel.WAKE_AND_UNLOCK)
+ kosmos.fakeKeyguardRepository.setBiometricUnlockState(BiometricUnlockMode.WAKE_AND_UNLOCK)
}
private fun fingerprintFailure() {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorTest.kt
index cded2a4ec27c..593cfde2a503 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorTest.kt
@@ -45,8 +45,7 @@ import com.android.systemui.keyguard.data.repository.FakeKeyguardTransitionRepos
import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository
import com.android.systemui.keyguard.data.repository.keyguardOcclusionRepository
-import com.android.systemui.keyguard.data.repository.keyguardRepository
-import com.android.systemui.keyguard.shared.model.BiometricUnlockModel
+import com.android.systemui.keyguard.shared.model.BiometricUnlockMode
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.keyguard.shared.model.TransitionState
import com.android.systemui.keyguard.util.KeyguardTransitionRepositorySpySubject.Companion.assertThat
@@ -99,7 +98,7 @@ class FromDozingTransitionInteractorTest : SysuiTestCase() {
to = KeyguardState.DOZING,
testScope
)
- kosmos.keyguardRepository.setBiometricUnlockState(BiometricUnlockModel.NONE)
+ kosmos.fakeKeyguardRepository.setBiometricUnlockState(BiometricUnlockMode.NONE)
reset(transitionRepository)
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/FromDreamingTransitionInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/FromDreamingTransitionInteractorTest.kt
index 8435a03fae9a..7c92ede89541 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/FromDreamingTransitionInteractorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/FromDreamingTransitionInteractorTest.kt
@@ -42,8 +42,7 @@ import com.android.systemui.keyguard.data.repository.FakeKeyguardTransitionRepos
import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository
import com.android.systemui.keyguard.data.repository.keyguardOcclusionRepository
-import com.android.systemui.keyguard.data.repository.keyguardRepository
-import com.android.systemui.keyguard.shared.model.BiometricUnlockModel
+import com.android.systemui.keyguard.shared.model.BiometricUnlockMode
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.keyguard.util.KeyguardTransitionRepositorySpySubject.Companion.assertThat
import com.android.systemui.kosmos.testScope
@@ -87,7 +86,7 @@ class FromDreamingTransitionInteractorTest : SysuiTestCase() {
to = KeyguardState.DREAMING,
testScope
)
- kosmos.keyguardRepository.setBiometricUnlockState(BiometricUnlockModel.NONE)
+ kosmos.fakeKeyguardRepository.setBiometricUnlockState(BiometricUnlockMode.NONE)
reset(transitionRepository)
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt
index 3827046e206d..e94efd696ee1 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt
@@ -34,7 +34,7 @@ import com.android.systemui.keyguard.data.repository.FakeKeyguardTransitionRepos
import com.android.systemui.keyguard.data.repository.fakeCommandQueue
import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository
-import com.android.systemui.keyguard.shared.model.BiometricUnlockModel
+import com.android.systemui.keyguard.shared.model.BiometricUnlockMode
import com.android.systemui.keyguard.shared.model.DozeStateModel
import com.android.systemui.keyguard.shared.model.DozeTransitionModel
import com.android.systemui.keyguard.shared.model.KeyguardState
@@ -358,7 +358,7 @@ class KeyguardTransitionScenariosTest : SysuiTestCase() {
// WHEN biometrics succeeds with wake and unlock from dream mode
keyguardRepository.setBiometricUnlockState(
- BiometricUnlockModel.WAKE_AND_UNLOCK_FROM_DREAM
+ BiometricUnlockMode.WAKE_AND_UNLOCK_FROM_DREAM
)
runCurrent()
@@ -535,7 +535,7 @@ class KeyguardTransitionScenariosTest : SysuiTestCase() {
// WHEN biometrics succeeds with wake and unlock mode
powerInteractor.setAwakeForTest()
- keyguardRepository.setBiometricUnlockState(BiometricUnlockModel.WAKE_AND_UNLOCK)
+ keyguardRepository.setBiometricUnlockState(BiometricUnlockMode.WAKE_AND_UNLOCK)
advanceTimeBy(60L)
assertThat(transitionRepository)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java
index f49dc9895da5..dc7525c8e256 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java
@@ -55,6 +55,7 @@ import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.keyguard.WakefulnessLifecycle;
import com.android.systemui.keyguard.domain.interactor.BiometricUnlockInteractor;
import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor;
+import com.android.systemui.keyguard.shared.model.BiometricUnlockSource;
import com.android.systemui.keyguard.shared.model.KeyguardState;
import com.android.systemui.keyguard.shared.model.TransitionState;
import com.android.systemui.keyguard.shared.model.TransitionStep;
@@ -337,7 +338,9 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
// WHEN we want to unlock collapse
mBiometricUnlockController.startWakeAndUnlock(
- BiometricUnlockController.MODE_UNLOCK_COLLAPSING);
+ BiometricUnlockController.MODE_UNLOCK_COLLAPSING,
+ BiometricUnlockSource.FINGERPRINT_SENSOR
+ );
verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(
/* strongAuth */ eq(false));
@@ -501,7 +504,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
TransitionState.STARTED
)
);
- verify(mBiometricUnlockInteractor, never()).setBiometricUnlockState(anyInt());
+ verify(mBiometricUnlockInteractor, never()).setBiometricUnlockState(anyInt(), any());
mBiometricUnlockController.consumeTransitionStepOnStartedKeyguardState(
new TransitionStep(
@@ -511,7 +514,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
TransitionState.STARTED
)
);
- verify(mBiometricUnlockInteractor).setBiometricUnlockState(eq(MODE_NONE));
+ verify(mBiometricUnlockInteractor).setBiometricUnlockState(eq(MODE_NONE), eq(null));
}
@Test
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt
index 1e305d67d40d..96a40494b11a 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt
@@ -19,6 +19,7 @@ package com.android.systemui.keyguard.data.repository
import android.graphics.Point
import com.android.systemui.dagger.SysUISingleton
+import com.android.systemui.keyguard.shared.model.BiometricUnlockMode
import com.android.systemui.keyguard.shared.model.BiometricUnlockModel
import com.android.systemui.keyguard.shared.model.BiometricUnlockSource
import com.android.systemui.keyguard.shared.model.DismissAction
@@ -101,7 +102,8 @@ class FakeKeyguardRepository @Inject constructor() : KeyguardRepository {
private val _isKeyguardGoingAway = MutableStateFlow(false)
override val isKeyguardGoingAway: Flow<Boolean> = _isKeyguardGoingAway
- private val _biometricUnlockState = MutableStateFlow(BiometricUnlockModel.NONE)
+ private val _biometricUnlockState =
+ MutableStateFlow(BiometricUnlockModel(BiometricUnlockMode.NONE, null))
override val biometricUnlockState: Flow<BiometricUnlockModel> = _biometricUnlockState
private val _fingerprintSensorLocation = MutableStateFlow<Point?>(null)
@@ -110,9 +112,6 @@ class FakeKeyguardRepository @Inject constructor() : KeyguardRepository {
private val _faceSensorLocation = MutableStateFlow<Point?>(null)
override val faceSensorLocation: Flow<Point?> = _faceSensorLocation
- private val _biometricUnlockSource = MutableStateFlow<BiometricUnlockSource?>(null)
- override val biometricUnlockSource: Flow<BiometricUnlockSource?> = _biometricUnlockSource
-
private val _isQuickSettingsVisible = MutableStateFlow(false)
override val isQuickSettingsVisible: Flow<Boolean> = _isQuickSettingsVisible.asStateFlow()
@@ -213,12 +212,19 @@ class FakeKeyguardRepository @Inject constructor() : KeyguardRepository {
_dozeAmount.value = dozeAmount
}
- override fun setBiometricUnlockState(value: BiometricUnlockModel) {
- _biometricUnlockState.tryEmit(value)
+ override fun setBiometricUnlockState(
+ mode: BiometricUnlockMode,
+ source: BiometricUnlockSource?
+ ) {
+ _biometricUnlockState.tryEmit(BiometricUnlockModel(mode, source))
+ }
+
+ fun setBiometricUnlockState(mode: BiometricUnlockMode) {
+ setBiometricUnlockState(mode, BiometricUnlockSource.FINGERPRINT_SENSOR)
}
fun setBiometricUnlockSource(source: BiometricUnlockSource?) {
- _biometricUnlockSource.tryEmit(source)
+ setBiometricUnlockState(BiometricUnlockMode.NONE, source)
}
fun setFaceSensorLocation(location: Point?) {