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

Commit 1a52eac5 authored by Beverly's avatar Beverly
Browse files

Only show udfps dwell animation for device entry

Test: atest AuthRippleControllerTest
Test: receive a HUN during enrollment and observe
fp enroll still doesn't show UDFPS dwell animation
Fixes: 301333650

Change-Id: Ibec141010c19727b9641eedb1111cad29a6e2c57
parent 7831be92
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -328,8 +328,11 @@ class AuthRippleController @Inject constructor(
    private val udfpsControllerCallback =
        object : UdfpsController.Callback {
            override fun onFingerDown() {
                // only show dwell ripple for device entry
                if (keyguardUpdateMonitor.isFingerprintDetectionRunning) {
                    showDwellRipple()
                }
            }

            override fun onFingerUp() {
                mView.retractDwellRipple()
+21 −1
Original line number Diff line number Diff line
@@ -301,7 +301,10 @@ class AuthRippleControllerTest : SysuiTestCase() {
    }

    @Test
    fun testUdfps_onFingerDown_showDwellRipple() {
    fun testUdfps_onFingerDown_runningForDeviceEntry_showDwellRipple() {
        // GIVEN fingerprint detection is running on keyguard
        `when`(keyguardUpdateMonitor.isFingerprintDetectionRunning).thenReturn(true)

        // GIVEN view is already attached
        controller.onViewAttached()
        val captor = ArgumentCaptor.forClass(UdfpsController.Callback::class.java)
@@ -318,4 +321,21 @@ class AuthRippleControllerTest : SysuiTestCase() {
        verify(rippleView).setFingerprintSensorLocation(fpsLocation, 0f)
        verify(rippleView).startDwellRipple(false)
    }

    @Test
    fun testUdfps_onFingerDown_notDeviceEntry_doesNotShowDwellRipple() {
        // GIVEN fingerprint detection is NOT running on keyguard
        `when`(keyguardUpdateMonitor.isFingerprintDetectionRunning).thenReturn(false)

        // GIVEN view is already attached
        controller.onViewAttached()
        val captor = ArgumentCaptor.forClass(UdfpsController.Callback::class.java)
        verify(udfpsController).addCallback(captor.capture())

        // WHEN finger is down
        captor.value.onFingerDown()

        // THEN doesn't show dwell ripple
        verify(rippleView, never()).startDwellRipple(false)
    }
}