Loading packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt +11 −2 Original line number Diff line number Diff line Loading @@ -353,10 +353,19 @@ class UdfpsControllerOverlay @JvmOverloads constructor( flags = flags or WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH } // Original sensorBounds assume portrait mode. val isEnrollment = when (requestReason) { REASON_ENROLL_FIND_SENSOR, REASON_ENROLL_ENROLLING -> true else -> false } // Use expanded overlay unless touchExploration enabled var rotatedBounds = if (featureFlags.isEnabled(Flags.UDFPS_NEW_TOUCH_DETECTION)) { if (accessibilityManager.isTouchExplorationEnabled && isEnrollment) { Rect(overlayParams.sensorBounds) } else { Rect(overlayParams.overlayBounds) } } else { Rect(overlayParams.sensorBounds) } Loading packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerOverlayTest.kt +25 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.hardware.biometrics.BiometricOverlayConstants.REASON_AUTH_BP import android.hardware.biometrics.BiometricOverlayConstants.REASON_AUTH_KEYGUARD import android.hardware.biometrics.BiometricOverlayConstants.REASON_AUTH_OTHER import android.hardware.biometrics.BiometricOverlayConstants.REASON_AUTH_SETTINGS import android.hardware.biometrics.BiometricOverlayConstants.REASON_ENROLL_ENROLLING import android.hardware.biometrics.BiometricOverlayConstants.ShowReason import android.hardware.fingerprint.FingerprintManager import android.hardware.fingerprint.IUdfpsOverlayControllerCallback Loading @@ -29,6 +30,7 @@ import android.testing.TestableLooper.RunWithLooper import android.view.LayoutInflater import android.view.MotionEvent import android.view.Surface import android.view.Surface.ROTATION_0 import android.view.Surface.Rotation import android.view.View import android.view.WindowManager Loading @@ -42,6 +44,7 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.animation.ActivityLaunchAnimator import com.android.systemui.dump.DumpManager import com.android.systemui.flags.FeatureFlags import com.android.systemui.flags.Flags import com.android.systemui.keyguard.domain.interactor.AlternateBouncerInteractor import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerInteractor import com.android.systemui.plugins.statusbar.StatusBarStateController Loading Loading @@ -159,9 +162,10 @@ class UdfpsControllerOverlayTest : SysuiTestCase() { private fun withRotation(@Rotation rotation: Int, block: () -> Unit) { // Sensor that's in the top left corner of the display in natural orientation. val sensorBounds = Rect(0, 0, SENSOR_WIDTH, SENSOR_HEIGHT) val overlayBounds = Rect(0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT) overlayParams = UdfpsOverlayParams( sensorBounds, sensorBounds, overlayBounds, DISPLAY_WIDTH, DISPLAY_HEIGHT, scaleFactor = 1f, Loading Loading @@ -314,4 +318,24 @@ class UdfpsControllerOverlayTest : SysuiTestCase() { assertThat(controllerOverlay.matchesRequestId(REQUEST_ID)).isTrue() assertThat(controllerOverlay.matchesRequestId(REQUEST_ID + 1)).isFalse() } @Test fun smallOverlayOnEnrollmentWithA11y() = withRotation(ROTATION_0) { withReason(REASON_ENROLL_ENROLLING) { // When a11y enabled during enrollment whenever(accessibilityManager.isTouchExplorationEnabled).thenReturn(true) whenever(featureFlags.isEnabled(Flags.UDFPS_NEW_TOUCH_DETECTION)).thenReturn(true) controllerOverlay.show(udfpsController, overlayParams) verify(windowManager).addView( eq(controllerOverlay.overlayView), layoutParamsCaptor.capture() ) // Layout params should use sensor bounds val lp = layoutParamsCaptor.value assertThat(lp.width).isEqualTo(overlayParams.sensorBounds.width()) assertThat(lp.height).isEqualTo(overlayParams.sensorBounds.height()) } } } Loading
packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt +11 −2 Original line number Diff line number Diff line Loading @@ -353,10 +353,19 @@ class UdfpsControllerOverlay @JvmOverloads constructor( flags = flags or WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH } // Original sensorBounds assume portrait mode. val isEnrollment = when (requestReason) { REASON_ENROLL_FIND_SENSOR, REASON_ENROLL_ENROLLING -> true else -> false } // Use expanded overlay unless touchExploration enabled var rotatedBounds = if (featureFlags.isEnabled(Flags.UDFPS_NEW_TOUCH_DETECTION)) { if (accessibilityManager.isTouchExplorationEnabled && isEnrollment) { Rect(overlayParams.sensorBounds) } else { Rect(overlayParams.overlayBounds) } } else { Rect(overlayParams.sensorBounds) } Loading
packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerOverlayTest.kt +25 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.hardware.biometrics.BiometricOverlayConstants.REASON_AUTH_BP import android.hardware.biometrics.BiometricOverlayConstants.REASON_AUTH_KEYGUARD import android.hardware.biometrics.BiometricOverlayConstants.REASON_AUTH_OTHER import android.hardware.biometrics.BiometricOverlayConstants.REASON_AUTH_SETTINGS import android.hardware.biometrics.BiometricOverlayConstants.REASON_ENROLL_ENROLLING import android.hardware.biometrics.BiometricOverlayConstants.ShowReason import android.hardware.fingerprint.FingerprintManager import android.hardware.fingerprint.IUdfpsOverlayControllerCallback Loading @@ -29,6 +30,7 @@ import android.testing.TestableLooper.RunWithLooper import android.view.LayoutInflater import android.view.MotionEvent import android.view.Surface import android.view.Surface.ROTATION_0 import android.view.Surface.Rotation import android.view.View import android.view.WindowManager Loading @@ -42,6 +44,7 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.animation.ActivityLaunchAnimator import com.android.systemui.dump.DumpManager import com.android.systemui.flags.FeatureFlags import com.android.systemui.flags.Flags import com.android.systemui.keyguard.domain.interactor.AlternateBouncerInteractor import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerInteractor import com.android.systemui.plugins.statusbar.StatusBarStateController Loading Loading @@ -159,9 +162,10 @@ class UdfpsControllerOverlayTest : SysuiTestCase() { private fun withRotation(@Rotation rotation: Int, block: () -> Unit) { // Sensor that's in the top left corner of the display in natural orientation. val sensorBounds = Rect(0, 0, SENSOR_WIDTH, SENSOR_HEIGHT) val overlayBounds = Rect(0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT) overlayParams = UdfpsOverlayParams( sensorBounds, sensorBounds, overlayBounds, DISPLAY_WIDTH, DISPLAY_HEIGHT, scaleFactor = 1f, Loading Loading @@ -314,4 +318,24 @@ class UdfpsControllerOverlayTest : SysuiTestCase() { assertThat(controllerOverlay.matchesRequestId(REQUEST_ID)).isTrue() assertThat(controllerOverlay.matchesRequestId(REQUEST_ID + 1)).isFalse() } @Test fun smallOverlayOnEnrollmentWithA11y() = withRotation(ROTATION_0) { withReason(REASON_ENROLL_ENROLLING) { // When a11y enabled during enrollment whenever(accessibilityManager.isTouchExplorationEnabled).thenReturn(true) whenever(featureFlags.isEnabled(Flags.UDFPS_NEW_TOUCH_DETECTION)).thenReturn(true) controllerOverlay.show(udfpsController, overlayParams) verify(windowManager).addView( eq(controllerOverlay.overlayView), layoutParamsCaptor.capture() ) // Layout params should use sensor bounds val lp = layoutParamsCaptor.value assertThat(lp.width).isEqualTo(overlayParams.sensorBounds.width()) assertThat(lp.height).isEqualTo(overlayParams.sensorBounds.height()) } } }