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

Commit 68fcc3a0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge changes from topic "cherrypicker-L01600000961894751:N92400001386673229"...

Merge changes from topic "cherrypicker-L01600000961894751:N92400001386673229" into udc-d1-dev am: 6ca41f39

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24025668



Change-Id: I84a885c1385c2a717745f3435765ac0254ca2f2d
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 4c8411be 6ca41f39
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -372,7 +372,9 @@ constructor(
                AuthBiometricView.STATE_AUTHENTICATED
            }

        if (!needsUserConfirmation) {
            vibrator.success(modality)
        }

        messageJob?.cancel()
        messageJob = null
@@ -418,6 +420,8 @@ constructor(
        _message.value = PromptMessage.Empty
        _legacyState.value = AuthBiometricView.STATE_AUTHENTICATED

        vibrator.success(authState.authenticatedModality)

        messageJob?.cancel()
        messageJob = null
    }
+14 −11
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ import org.junit.runner.RunWith
import org.junit.runners.Parameterized
import org.mockito.Mock
import org.mockito.Mockito.never
import org.mockito.Mockito.times
import org.mockito.Mockito.verify
import org.mockito.junit.MockitoJUnit

@@ -131,18 +132,20 @@ internal class PromptViewModelTest(private val testCase: TestCase) : SysuiTestCa
    }

    @Test
    fun plays_haptic_on_authenticated() = runGenericTest {
        viewModel.showAuthenticated(testCase.authenticatedModality, 1000L)
    fun play_haptic_on_confirm_when_confirmation_required_otherwise_on_authenticated() =
        runGenericTest {
            val expectConfirmation = testCase.expectConfirmation(atLeastOneFailure = false)

        verify(vibrator).vibrateAuthSuccess(any())
        verify(vibrator, never()).vibrateAuthError(any())
    }
            viewModel.showAuthenticated(testCase.authenticatedModality, 1_000L)

    @Test
    fun plays_no_haptic_on_confirm() = runGenericTest {
            verify(vibrator, if (expectConfirmation) never() else times(1))
                .vibrateAuthSuccess(any())

            if (expectConfirmation) {
                viewModel.confirmAuthenticated()
            }

        verify(vibrator, never()).vibrateAuthSuccess(any())
            verify(vibrator).vibrateAuthSuccess(any())
            verify(vibrator, never()).vibrateAuthError(any())
        }