Loading packages/SystemUI/src/com/android/systemui/biometrics/AuthRippleController.kt +5 −14 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import android.content.Context import android.graphics.Point import android.hardware.biometrics.BiometricFingerprintConstants import android.hardware.biometrics.BiometricSourceType import android.util.Log import androidx.annotation.VisibleForTesting import com.android.keyguard.KeyguardUpdateMonitor import com.android.keyguard.KeyguardUpdateMonitorCallback Loading Loading @@ -95,7 +94,6 @@ class AuthRippleController @Inject constructor( public override fun onViewAttached() { authController.addCallback(authControllerCallback) updateRippleColor() updateSensorLocation() updateUdfpsDependentParams() udfpsController?.addCallback(udfpsControllerCallback) configurationController.addCallback(configurationChangedListener) Loading Loading @@ -237,8 +235,12 @@ class AuthRippleController @Inject constructor( } private fun showDwellRipple() { updateSensorLocation() fingerprintSensorLocation?.let { mView.setFingerprintSensorLocation(it, udfpsRadius) mView.startDwellRipple(statusBarStateController.isDozing) } } private val keyguardUpdateMonitorCallback = object : KeyguardUpdateMonitorCallback() { Loading Loading @@ -291,13 +293,6 @@ class AuthRippleController @Inject constructor( private val udfpsControllerCallback = object : UdfpsController.Callback { override fun onFingerDown() { if (fingerprintSensorLocation == null) { Log.e("AuthRipple", "fingerprintSensorLocation=null onFingerDown. " + "Skip showing dwell ripple") return } mView.setFingerprintSensorLocation(fingerprintSensorLocation!!, udfpsRadius) showDwellRipple() } Loading @@ -310,12 +305,10 @@ class AuthRippleController @Inject constructor( object : AuthController.Callback { override fun onAllAuthenticatorsRegistered() { updateUdfpsDependentParams() updateSensorLocation() } override fun onUdfpsLocationChanged() { updateUdfpsDependentParams() updateSensorLocation() } } Loading Loading @@ -345,13 +338,11 @@ class AuthRippleController @Inject constructor( "\n\tudfpsRadius=$udfpsRadius") } "fingerprint" -> { updateSensorLocation() pw.println("fingerprint ripple sensorLocation=$fingerprintSensorLocation") showUnlockRipple(BiometricSourceType.FINGERPRINT) } "face" -> { // note: only shows when about to proceed to the home screen updateSensorLocation() pw.println("face ripple sensorLocation=$faceSensorLocation") showUnlockRipple(BiometricSourceType.FACE) } Loading packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthRippleControllerTest.kt +24 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.biometrics import android.graphics.Point import android.hardware.biometrics.BiometricSourceType import android.hardware.fingerprint.FingerprintSensorPropertiesInternal import android.testing.AndroidTestingRunner import android.testing.TestableLooper.RunWithLooper import androidx.test.filters.SmallTest Loading Loading @@ -76,6 +77,7 @@ class AuthRippleControllerTest : SysuiTestCase() { @Mock private lateinit var udfpsController: UdfpsController @Mock private lateinit var statusBarStateController: StatusBarStateController @Mock private lateinit var lightRevealScrim: LightRevealScrim @Mock private lateinit var fpSensorProp: FingerprintSensorPropertiesInternal @Before fun setUp() { Loading @@ -86,6 +88,7 @@ class AuthRippleControllerTest : SysuiTestCase() { .startMocking() `when`(RotationUtils.getRotation(context)).thenReturn(RotationUtils.ROTATION_NONE) `when`(authController.udfpsProps).thenReturn(listOf(fpSensorProp)) `when`(udfpsControllerProvider.get()).thenReturn(udfpsController) controller = AuthRippleController( Loading Loading @@ -132,7 +135,7 @@ class AuthRippleControllerTest : SysuiTestCase() { false /* isStrongBiometric */) // THEN update sensor location and show ripple verify(rippleView).setFingerprintSensorLocation(fpsLocation, -1f) verify(rippleView).setFingerprintSensorLocation(fpsLocation, 0f) verify(rippleView).startUnlockedRipple(any()) } Loading @@ -155,7 +158,7 @@ class AuthRippleControllerTest : SysuiTestCase() { false /* isStrongBiometric */) // THEN update sensor location and show ripple verify(rippleView).setFingerprintSensorLocation(fpsLocation, -1f) verify(rippleView).setFingerprintSensorLocation(fpsLocation, 0f) verify(rippleView).startUnlockedRipple(any()) } Loading Loading @@ -342,4 +345,23 @@ class AuthRippleControllerTest : SysuiTestCase() { captor.value.onUiModeChanged() verify(rippleView).setLockScreenColor(ArgumentMatchers.anyInt()) } @Test fun testUdfps_onFingerDown_showDwellRipple() { // GIVEN view is already attached controller.onViewAttached() val captor = ArgumentCaptor.forClass(UdfpsController.Callback::class.java) verify(udfpsController).addCallback(captor.capture()) // GIVEN fp is updated to Point(5, 5) val fpsLocation = Point(5, 5) `when`(authController.fingerprintSensorLocation).thenReturn(fpsLocation) // WHEN finger is down captor.value.onFingerDown() // THEN update sensor location and show ripple verify(rippleView).setFingerprintSensorLocation(fpsLocation, 0f) verify(rippleView).startDwellRipple(false) } } Loading
packages/SystemUI/src/com/android/systemui/biometrics/AuthRippleController.kt +5 −14 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import android.content.Context import android.graphics.Point import android.hardware.biometrics.BiometricFingerprintConstants import android.hardware.biometrics.BiometricSourceType import android.util.Log import androidx.annotation.VisibleForTesting import com.android.keyguard.KeyguardUpdateMonitor import com.android.keyguard.KeyguardUpdateMonitorCallback Loading Loading @@ -95,7 +94,6 @@ class AuthRippleController @Inject constructor( public override fun onViewAttached() { authController.addCallback(authControllerCallback) updateRippleColor() updateSensorLocation() updateUdfpsDependentParams() udfpsController?.addCallback(udfpsControllerCallback) configurationController.addCallback(configurationChangedListener) Loading Loading @@ -237,8 +235,12 @@ class AuthRippleController @Inject constructor( } private fun showDwellRipple() { updateSensorLocation() fingerprintSensorLocation?.let { mView.setFingerprintSensorLocation(it, udfpsRadius) mView.startDwellRipple(statusBarStateController.isDozing) } } private val keyguardUpdateMonitorCallback = object : KeyguardUpdateMonitorCallback() { Loading Loading @@ -291,13 +293,6 @@ class AuthRippleController @Inject constructor( private val udfpsControllerCallback = object : UdfpsController.Callback { override fun onFingerDown() { if (fingerprintSensorLocation == null) { Log.e("AuthRipple", "fingerprintSensorLocation=null onFingerDown. " + "Skip showing dwell ripple") return } mView.setFingerprintSensorLocation(fingerprintSensorLocation!!, udfpsRadius) showDwellRipple() } Loading @@ -310,12 +305,10 @@ class AuthRippleController @Inject constructor( object : AuthController.Callback { override fun onAllAuthenticatorsRegistered() { updateUdfpsDependentParams() updateSensorLocation() } override fun onUdfpsLocationChanged() { updateUdfpsDependentParams() updateSensorLocation() } } Loading Loading @@ -345,13 +338,11 @@ class AuthRippleController @Inject constructor( "\n\tudfpsRadius=$udfpsRadius") } "fingerprint" -> { updateSensorLocation() pw.println("fingerprint ripple sensorLocation=$fingerprintSensorLocation") showUnlockRipple(BiometricSourceType.FINGERPRINT) } "face" -> { // note: only shows when about to proceed to the home screen updateSensorLocation() pw.println("face ripple sensorLocation=$faceSensorLocation") showUnlockRipple(BiometricSourceType.FACE) } Loading
packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthRippleControllerTest.kt +24 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.biometrics import android.graphics.Point import android.hardware.biometrics.BiometricSourceType import android.hardware.fingerprint.FingerprintSensorPropertiesInternal import android.testing.AndroidTestingRunner import android.testing.TestableLooper.RunWithLooper import androidx.test.filters.SmallTest Loading Loading @@ -76,6 +77,7 @@ class AuthRippleControllerTest : SysuiTestCase() { @Mock private lateinit var udfpsController: UdfpsController @Mock private lateinit var statusBarStateController: StatusBarStateController @Mock private lateinit var lightRevealScrim: LightRevealScrim @Mock private lateinit var fpSensorProp: FingerprintSensorPropertiesInternal @Before fun setUp() { Loading @@ -86,6 +88,7 @@ class AuthRippleControllerTest : SysuiTestCase() { .startMocking() `when`(RotationUtils.getRotation(context)).thenReturn(RotationUtils.ROTATION_NONE) `when`(authController.udfpsProps).thenReturn(listOf(fpSensorProp)) `when`(udfpsControllerProvider.get()).thenReturn(udfpsController) controller = AuthRippleController( Loading Loading @@ -132,7 +135,7 @@ class AuthRippleControllerTest : SysuiTestCase() { false /* isStrongBiometric */) // THEN update sensor location and show ripple verify(rippleView).setFingerprintSensorLocation(fpsLocation, -1f) verify(rippleView).setFingerprintSensorLocation(fpsLocation, 0f) verify(rippleView).startUnlockedRipple(any()) } Loading @@ -155,7 +158,7 @@ class AuthRippleControllerTest : SysuiTestCase() { false /* isStrongBiometric */) // THEN update sensor location and show ripple verify(rippleView).setFingerprintSensorLocation(fpsLocation, -1f) verify(rippleView).setFingerprintSensorLocation(fpsLocation, 0f) verify(rippleView).startUnlockedRipple(any()) } Loading Loading @@ -342,4 +345,23 @@ class AuthRippleControllerTest : SysuiTestCase() { captor.value.onUiModeChanged() verify(rippleView).setLockScreenColor(ArgumentMatchers.anyInt()) } @Test fun testUdfps_onFingerDown_showDwellRipple() { // GIVEN view is already attached controller.onViewAttached() val captor = ArgumentCaptor.forClass(UdfpsController.Callback::class.java) verify(udfpsController).addCallback(captor.capture()) // GIVEN fp is updated to Point(5, 5) val fpsLocation = Point(5, 5) `when`(authController.fingerprintSensorLocation).thenReturn(fpsLocation) // WHEN finger is down captor.value.onFingerDown() // THEN update sensor location and show ripple verify(rippleView).setFingerprintSensorLocation(fpsLocation, 0f) verify(rippleView).startDwellRipple(false) } }