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

Commit 409e6be1 authored by Juan Sebastian Martinez's avatar Juan Sebastian Martinez
Browse files

Playing error haptics when either face or fingerprint auth fail.

Test: DeviceEntryHapticsInteractorTest
Flag: com.android.systemui.msdl_feedback
Bug: 391384642
Change-Id: I81885bf25420076fb053801707f533d17930de08
parent 045ed26a
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
@@ -1148,7 +1148,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)
@@ -1160,14 +1160,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)
@@ -1179,9 +1180,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
@@ -70,4 +70,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
@@ -125,7 +125,7 @@ constructor(
    private val playErrorHapticForBiometricFailure: Flow<Unit> =
        merge(
                deviceEntryFingerprintAuthInteractor.fingerprintFailure,
                deviceEntryBiometricAuthInteractor.faceOnlyFaceFailure,
                deviceEntryBiometricAuthInteractor.faceFailure,
            )
            // map to Unit
            .map {}