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

Commit a618dc45 authored by Beverly Tai's avatar Beverly Tai Committed by Android (Google) Code Review
Browse files

Merge "Only show udfps dwell animation for device entry" into main

parents 0e8f819f 1a52eac5
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)
    }
}