Support talkback with new Udfps Overlay on keyguard

Resizes talkback bounds for new udfps overlay on keyguard. Now only
highlights the sensor area instead of taking up the whole screen.

Bug: 270437012
Test: atest SystemUITests:com.android.systemui.biometrics
Change-Id: Iaa41ef0d7afe32f48a873924f83c1f36acf77361
This commit is contained in:
Austin Delgado
2023-03-29 16:54:10 -07:00
parent 2f63277b7f
commit 1fbfaad460
4 changed files with 30 additions and 6 deletions

View File

@@ -20,7 +20,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/udfps_animation_view_internal"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:contentDescription="@string/accessibility_fingerprint_label">
<!-- Background protection -->
<ImageView

View File

@@ -823,9 +823,9 @@ public class AuthController implements CoreStartable, CommandQueue.Callbacks,
final Rect overlayBounds = new Rect(
0, /* left */
0, /* top */
mCachedDisplayInfo.getNaturalHeight() / 2, /* top */
mCachedDisplayInfo.getNaturalWidth(), /* right */
mCachedDisplayInfo.getNaturalHeight() /* botom */);
mCachedDisplayInfo.getNaturalHeight() /* bottom */);
mUdfpsOverlayParams = new UdfpsOverlayParams(
mUdfpsBounds,

View File

@@ -364,7 +364,12 @@ class UdfpsControllerOverlay @JvmOverloads constructor(
if (accessibilityManager.isTouchExplorationEnabled && isEnrollment) {
Rect(overlayParams.sensorBounds)
} else {
Rect(overlayParams.overlayBounds)
Rect(
0,
0,
overlayParams.naturalDisplayWidth,
overlayParams.naturalDisplayHeight
)
}
} else {
Rect(overlayParams.sensorBounds)

View File

@@ -25,7 +25,6 @@ import android.hardware.biometrics.BiometricOverlayConstants.REASON_ENROLL_ENROL
import android.hardware.biometrics.BiometricOverlayConstants.ShowReason
import android.hardware.fingerprint.FingerprintManager
import android.hardware.fingerprint.IUdfpsOverlayControllerCallback
import androidx.test.ext.junit.runners.AndroidJUnit4
import android.testing.TestableLooper.RunWithLooper
import android.view.LayoutInflater
import android.view.MotionEvent
@@ -35,6 +34,7 @@ import android.view.Surface.Rotation
import android.view.View
import android.view.WindowManager
import android.view.accessibility.AccessibilityManager
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.keyguard.KeyguardUpdateMonitor
import com.android.settingslib.udfps.UdfpsOverlayParams
@@ -69,8 +69,8 @@ import org.mockito.Captor
import org.mockito.Mock
import org.mockito.Mockito.mock
import org.mockito.Mockito.verify
import org.mockito.Mockito.`when` as whenever
import org.mockito.junit.MockitoJUnit
import org.mockito.Mockito.`when` as whenever
private const val REQUEST_ID = 2L
@@ -340,4 +340,22 @@ class UdfpsControllerOverlayTest : SysuiTestCase() {
assertThat(lp.height).isEqualTo(overlayParams.sensorBounds.height())
}
}
@Test
fun fullScreenOverlayWithNewTouchDetectionEnabled() = withRotation(ROTATION_0) {
withReason(REASON_AUTH_KEYGUARD) {
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 natural display width and height
val lp = layoutParamsCaptor.value
assertThat(lp.width).isEqualTo(overlayParams.naturalDisplayWidth)
assertThat(lp.height).isEqualTo(overlayParams.naturalDisplayHeight)
}
}
}