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

Commit 92947ea1 authored by Juan Sebastian Martinez's avatar Juan Sebastian Martinez Committed by Android (Google) Code Review
Browse files

Merge "Using newest biometric-specific HapticFeedbackConstants for biometric...

Merge "Using newest biometric-specific HapticFeedbackConstants for biometric authentication." into main
parents 54d3e0ac 33918985
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
    <uses-permission android:name="android.permission.MASTER_CLEAR" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.VIBRATE_SYSTEM_CONSTANTS" />
    <uses-permission android:name="android.permission.MANAGE_SENSOR_PRIVACY" />
    <uses-permission android:name="android.permission.OBSERVE_SENSOR_PRIVACY" />
    <uses-permission android:name="android.permission.ACCESS_AMBIENT_CONTEXT_EVENT" />
+4 −4
Original line number Diff line number Diff line
@@ -941,16 +941,16 @@ constructor(
    private fun vibrateOnSuccess() {
        _hapticsToPlay.value =
            HapticsToPlay(
                HapticFeedbackConstants.CONFIRM,
                HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING,
                HapticFeedbackConstants.BIOMETRIC_CONFIRM,
                null,
            )
    }

    private fun vibrateOnError() {
        _hapticsToPlay.value =
            HapticsToPlay(
                HapticFeedbackConstants.REJECT,
                HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING,
                HapticFeedbackConstants.BIOMETRIC_REJECT,
                null,
            )
    }

+2 −4
Original line number Diff line number Diff line
@@ -369,8 +369,7 @@ object KeyguardRootViewBinder {
                                } else {
                                    vibratorHelper.performHapticFeedback(
                                        view,
                                        HapticFeedbackConstants.CONFIRM,
                                        HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING,
                                        HapticFeedbackConstants.BIOMETRIC_CONFIRM,
                                    )
                                }
                            }
@@ -390,8 +389,7 @@ object KeyguardRootViewBinder {
                                } else {
                                    vibratorHelper.performHapticFeedback(
                                        view,
                                        HapticFeedbackConstants.REJECT,
                                        HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING,
                                        HapticFeedbackConstants.BIOMETRIC_REJECT,
                                    )
                                }
                            }
+17 −20
Original line number Diff line number Diff line
@@ -717,13 +717,9 @@ internal class PromptViewModelTest(private val testCase: TestCase) : SysuiTestCa
            assertThat(confirmHaptics?.hapticFeedbackConstant)
                .isEqualTo(
                    if (expectConfirmation) HapticFeedbackConstants.NO_HAPTICS
                    else HapticFeedbackConstants.CONFIRM
                )
            assertThat(confirmHaptics?.flag)
                .isEqualTo(
                    if (expectConfirmation) null
                    else HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING
                    else HapticFeedbackConstants.BIOMETRIC_CONFIRM
                )
            assertThat(confirmHaptics?.flag).isNull()

            if (expectConfirmation) {
                kosmos.promptViewModel.confirmAuthenticated()
@@ -731,9 +727,8 @@ internal class PromptViewModelTest(private val testCase: TestCase) : SysuiTestCa

            val confirmedHaptics by collectLastValue(kosmos.promptViewModel.hapticsToPlay)
            assertThat(confirmedHaptics?.hapticFeedbackConstant)
                .isEqualTo(HapticFeedbackConstants.CONFIRM)
            assertThat(confirmedHaptics?.flag)
                .isEqualTo(HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING)
                .isEqualTo(HapticFeedbackConstants.BIOMETRIC_CONFIRM)
            assertThat(confirmedHaptics?.flag).isNull()
        }

    @Test
@@ -747,9 +742,8 @@ internal class PromptViewModelTest(private val testCase: TestCase) : SysuiTestCa

        val currentHaptics by collectLastValue(kosmos.promptViewModel.hapticsToPlay)
        assertThat(currentHaptics?.hapticFeedbackConstant)
            .isEqualTo(HapticFeedbackConstants.CONFIRM)
        assertThat(currentHaptics?.flag)
            .isEqualTo(HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING)
            .isEqualTo(HapticFeedbackConstants.BIOMETRIC_CONFIRM)
        assertThat(currentHaptics?.flag).isNull()
    }

    @Test
@@ -757,9 +751,9 @@ internal class PromptViewModelTest(private val testCase: TestCase) : SysuiTestCa
        kosmos.promptViewModel.showTemporaryError("test", "messageAfterError", false)

        val currentHaptics by collectLastValue(kosmos.promptViewModel.hapticsToPlay)
        assertThat(currentHaptics?.hapticFeedbackConstant).isEqualTo(HapticFeedbackConstants.REJECT)
        assertThat(currentHaptics?.flag)
            .isEqualTo(HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING)
        assertThat(currentHaptics?.hapticFeedbackConstant)
            .isEqualTo(HapticFeedbackConstants.BIOMETRIC_REJECT)
        assertThat(currentHaptics?.flag).isNull()
    }

    // biometricprompt_sfps_fingerprint_authenticating reused across rotations
@@ -870,8 +864,9 @@ internal class PromptViewModelTest(private val testCase: TestCase) : SysuiTestCa
        )

        val haptics by collectLastValue(kosmos.promptViewModel.hapticsToPlay)
        assertThat(haptics?.hapticFeedbackConstant).isEqualTo(HapticFeedbackConstants.REJECT)
        assertThat(haptics?.flag).isEqualTo(HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING)
        assertThat(haptics?.hapticFeedbackConstant)
            .isEqualTo(HapticFeedbackConstants.BIOMETRIC_REJECT)
        assertThat(haptics?.flag).isNull()
    }

    @Test
@@ -901,10 +896,12 @@ internal class PromptViewModelTest(private val testCase: TestCase) : SysuiTestCa

        val haptics by collectLastValue(kosmos.promptViewModel.hapticsToPlay)
        if (expectConfirmation) {
            assertThat(haptics?.hapticFeedbackConstant).isEqualTo(HapticFeedbackConstants.REJECT)
            assertThat(haptics?.flag).isEqualTo(HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING)
            assertThat(haptics?.hapticFeedbackConstant)
                .isEqualTo(HapticFeedbackConstants.BIOMETRIC_REJECT)
            assertThat(haptics?.flag).isNull()
        } else {
            assertThat(haptics?.hapticFeedbackConstant).isEqualTo(HapticFeedbackConstants.CONFIRM)
            assertThat(haptics?.hapticFeedbackConstant)
                .isEqualTo(HapticFeedbackConstants.BIOMETRIC_CONFIRM)
        }
    }