summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/biometrics/udfps/SinglePointerTouchProcessor.kt3
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/biometrics/udfps/SinglePointerTouchProcessorTest.kt55
2 files changed, 28 insertions, 30 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/udfps/SinglePointerTouchProcessor.kt b/packages/SystemUI/src/com/android/systemui/biometrics/udfps/SinglePointerTouchProcessor.kt
index 83b3380ae6be..1eef91debab3 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/udfps/SinglePointerTouchProcessor.kt
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/udfps/SinglePointerTouchProcessor.kt
@@ -27,7 +27,8 @@ import com.android.systemui.biometrics.udfps.TouchProcessorResult.ProcessedTouch
import com.android.systemui.dagger.SysUISingleton
import javax.inject.Inject
-private val SUPPORTED_ROTATIONS = setOf(Surface.ROTATION_90, Surface.ROTATION_270)
+private val SUPPORTED_ROTATIONS =
+ setOf(Surface.ROTATION_90, Surface.ROTATION_270, Surface.ROTATION_180)
/**
* TODO(b/259140693): Consider using an object pool of TouchProcessorResult to avoid allocations.
diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/udfps/SinglePointerTouchProcessorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/biometrics/udfps/SinglePointerTouchProcessorTest.kt
index 99c2c4076403..aff93bd339ad 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/udfps/SinglePointerTouchProcessorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/udfps/SinglePointerTouchProcessorTest.kt
@@ -465,10 +465,34 @@ private val ROTATION_90_INPUTS =
nativeYOutsideSensor = 150f,
)
-/* ROTATION_180 is not supported. It's treated the same as ROTATION_0. */
+/*
+ * ROTATION_180 map:
+ * _ _ _ _
+ * _ _ s _
+ * _ _ s _
+ * _ _ _ _
+ * _ O _ _
+ * _ _ _ _
+ *
+ * (_) empty space
+ * (S) sensor
+ * (O) touch outside of the sensor
+ */
+private val ROTATION_180_NATIVE_SENSOR_BOUNDS =
+ Rect(
+ 200, /* left */
+ 100, /* top */
+ 300, /* right */
+ 300, /* bottom */
+ )
private val ROTATION_180_INPUTS =
- ROTATION_0_INPUTS.copy(
+ OrientationBasedInputs(
rotation = Surface.ROTATION_180,
+ nativeOrientation = (ORIENTATION - Math.PI.toFloat() / 2),
+ nativeXWithinSensor = ROTATION_180_NATIVE_SENSOR_BOUNDS.exactCenterX(),
+ nativeYWithinSensor = ROTATION_180_NATIVE_SENSOR_BOUNDS.exactCenterY(),
+ nativeXOutsideSensor = 150f,
+ nativeYOutsideSensor = 450f,
)
/*
@@ -639,33 +663,6 @@ private fun genPositiveTestCases(
}
}
-private fun genTestCasesForUnsupportedAction(
- motionEventAction: Int
-): List<SinglePointerTouchProcessorTest.TestCase> {
- val isGoodOverlap = true
- val previousPointerOnSensorIds = listOf(INVALID_POINTER_ID, POINTER_ID_1)
- return previousPointerOnSensorIds.map { previousPointerOnSensorId ->
- val overlayParams = ROTATION_0_INPUTS.toOverlayParams(scaleFactor = 1f)
- val nativeX = ROTATION_0_INPUTS.getNativeX(isGoodOverlap)
- val nativeY = ROTATION_0_INPUTS.getNativeY(isGoodOverlap)
- val event =
- MOTION_EVENT.copy(
- action = motionEventAction,
- x = nativeX,
- y = nativeY,
- minor = NATIVE_MINOR,
- major = NATIVE_MAJOR,
- )
- SinglePointerTouchProcessorTest.TestCase(
- event = event,
- currentPointers = listOf(TestPointer(id = POINTER_ID_1, onSensor = isGoodOverlap)),
- previousPointerOnSensorId = previousPointerOnSensorId,
- overlayParams = overlayParams,
- expected = TouchProcessorResult.Failure(),
- )
- }
-}
-
private fun obtainMotionEvent(
action: Int,
pointerId: Int,