Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e4615cb5 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Playing error haptics when either face or fingerprint auth fail." into main

parents 2d615974 409e6be1
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -176,14 +176,14 @@ class DeviceEntryHapticsInteractorTest : SysuiTestCase() {
        }

    @Test
    fun nonPowerButtonFPS_coExFaceFailure_doNotVibrateError() =
    fun nonPowerButtonFPS_coExFaceFailure_vibrateError() =
        testScope.runTest {
            val playErrorHaptic by collectLastValue(underTest.playErrorHaptic)
            enrollFingerprint(FingerprintSensorType.UDFPS_ULTRASONIC)
            enrollFace()
            runCurrent()
            faceFailure()
            assertThat(playErrorHaptic).isNull()
            assertThat(playErrorHaptic).isNotNull()
        }

    @Test
+9 −7
Original line number Diff line number Diff line
@@ -1149,7 +1149,7 @@ class SceneContainerStartableTest : SysuiTestCase() {

    @Test
    @DisableFlags(Flags.FLAG_MSDL_FEEDBACK)
    fun skipsFaceErrorHaptics_nonSfps_coEx() =
    fun playsFaceErrorHaptics_nonSfps_coEx() =
        testScope.runTest {
            val currentSceneKey by collectLastValue(sceneInteractor.currentScene)
            val playErrorHaptic by collectLastValue(deviceEntryHapticsInteractor.playErrorHaptic)
@@ -1161,14 +1161,15 @@ class SceneContainerStartableTest : SysuiTestCase() {
            underTest.start()
            updateFaceAuthStatus(isSuccess = false)

            assertThat(playErrorHaptic).isNull()
            verify(vibratorHelper, never()).vibrateAuthError(anyString())
            assertThat(playErrorHaptic).isNotNull()
            assertThat(currentSceneKey).isEqualTo(Scenes.Lockscreen)
            verify(vibratorHelper).vibrateAuthError(anyString())
            verify(vibratorHelper, never()).vibrateAuthSuccess(anyString())
        }

    @Test
    @EnableFlags(Flags.FLAG_MSDL_FEEDBACK)
    fun skipsMSDLFaceErrorHaptics_nonSfps_coEx() =
    fun playsMSDLFaceErrorHaptics_nonSfps_coEx() =
        testScope.runTest {
            val currentSceneKey by collectLastValue(sceneInteractor.currentScene)
            val playErrorHaptic by collectLastValue(deviceEntryHapticsInteractor.playErrorHaptic)
@@ -1180,9 +1181,10 @@ class SceneContainerStartableTest : SysuiTestCase() {
            underTest.start()
            updateFaceAuthStatus(isSuccess = false)

            assertThat(playErrorHaptic).isNull()
            assertThat(msdlPlayer.latestTokenPlayed).isNull()
            assertThat(msdlPlayer.latestPropertiesPlayed).isNull()
            assertThat(playErrorHaptic).isNotNull()
            assertThat(currentSceneKey).isEqualTo(Scenes.Lockscreen)
            assertThat(msdlPlayer.latestTokenPlayed).isEqualTo(MSDLToken.FAILURE)
            assertThat(msdlPlayer.latestPropertiesPlayed).isEqualTo(authInteractionProperties)
        }

    @Test
+6 −0
Original line number Diff line number Diff line
@@ -68,4 +68,10 @@ constructor(
                emptyFlow()
            }
        }

    /** Triggered if a face failure occurs regardless of the mode. */
    val faceFailure: Flow<FailedFaceAuthenticationStatus> =
        deviceEntryFaceAuthInteractor.authenticationStatus.filterIsInstance<
            FailedFaceAuthenticationStatus
        >()
}
+1 −1
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@ constructor(
    private val playErrorHapticForBiometricFailure: Flow<Unit> =
        merge(
                deviceEntryFingerprintAuthInteractor.fingerprintFailure,
                deviceEntryBiometricAuthInteractor.faceOnlyFaceFailure,
                deviceEntryBiometricAuthInteractor.faceFailure,
            )
            // map to Unit
            .map {}