Disabled two-finger dragging on TouchpadDebugView

Bug: 366769544
Test: Presubmit
Flag: com.android.hardware.input.touchpad_visualizer
Change-Id: Icd283af7b759bc4add3ff93adf6727745b8258c8
diff --git a/services/core/java/com/android/server/input/debug/TouchpadDebugView.java b/services/core/java/com/android/server/input/debug/TouchpadDebugView.java
index 5ff8568..0e940d2 100644
--- a/services/core/java/com/android/server/input/debug/TouchpadDebugView.java
+++ b/services/core/java/com/android/server/input/debug/TouchpadDebugView.java
@@ -180,6 +180,10 @@
 
     @Override
     public boolean onTouchEvent(MotionEvent event) {
+        if (event.getClassification() == MotionEvent.CLASSIFICATION_TWO_FINGER_SWIPE) {
+            return false;
+        }
+
         float deltaX;
         float deltaY;
         switch (event.getAction()) {
diff --git a/tests/Input/src/com/android/server/input/debug/TouchpadDebugViewTest.java b/tests/Input/src/com/android/server/input/debug/TouchpadDebugViewTest.java
index eac2e92..b3a998e 100644
--- a/tests/Input/src/com/android/server/input/debug/TouchpadDebugViewTest.java
+++ b/tests/Input/src/com/android/server/input/debug/TouchpadDebugViewTest.java
@@ -16,6 +16,7 @@
 
 package com.android.server.input.debug;
 
+import static android.view.InputDevice.SOURCE_MOUSE;
 import static android.view.InputDevice.SOURCE_TOUCHSCREEN;
 
 import static org.junit.Assert.assertEquals;
@@ -92,7 +93,7 @@
 
         InputDevice inputDevice = new InputDevice.Builder()
                 .setId(TOUCHPAD_DEVICE_ID)
-                .setSources(InputDevice.SOURCE_TOUCHPAD | InputDevice.SOURCE_MOUSE)
+                .setSources(InputDevice.SOURCE_TOUCHPAD | SOURCE_MOUSE)
                 .setName("Test Device " + TOUCHPAD_DEVICE_ID)
                 .build();
 
@@ -354,4 +355,43 @@
         mTouchpadDebugView.updateGestureInfo(gestureType, TOUCHPAD_DEVICE_ID);
         assertEquals(child.getText().toString(), TouchpadDebugView.getGestureText(gestureType));
     }
-}
+
+    @Test
+    public void testTwoFingerDrag() {
+        float offsetX = ViewConfiguration.get(mTestableContext).getScaledTouchSlop() + 10;
+        float offsetY = ViewConfiguration.get(mTestableContext).getScaledTouchSlop() + 10;
+
+        // Simulate ACTION_DOWN event (gesture starts).
+        MotionEvent actionDown = new MotionEventBuilder(MotionEvent.ACTION_DOWN, SOURCE_MOUSE)
+                .pointer(new PointerBuilder(0, MotionEvent.TOOL_TYPE_FINGER)
+                        .x(40f)
+                        .y(40f)
+                )
+                .classification(MotionEvent.CLASSIFICATION_TWO_FINGER_SWIPE)
+                .build();
+        mTouchpadDebugView.dispatchTouchEvent(actionDown);
+
+        // Simulate ACTION_MOVE event (dragging with two fingers, processed as one pointer).
+        MotionEvent actionMove = new MotionEventBuilder(MotionEvent.ACTION_MOVE, SOURCE_MOUSE)
+                .pointer(new PointerBuilder(0, MotionEvent.TOOL_TYPE_FINGER)
+                        .x(40f + offsetX)
+                        .y(40f + offsetY)
+                )
+                .classification(MotionEvent.CLASSIFICATION_TWO_FINGER_SWIPE)
+                .build();
+        mTouchpadDebugView.dispatchTouchEvent(actionMove);
+
+        // Simulate ACTION_UP event (gesture ends).
+        MotionEvent actionUp = new MotionEventBuilder(MotionEvent.ACTION_UP, SOURCE_MOUSE)
+                .pointer(new PointerBuilder(0, MotionEvent.TOOL_TYPE_FINGER)
+                        .x(40f + offsetX)
+                        .y(40f + offsetY)
+                )
+                .classification(MotionEvent.CLASSIFICATION_TWO_FINGER_SWIPE)
+                .build();
+        mTouchpadDebugView.dispatchTouchEvent(actionUp);
+
+        // Verify that no updateViewLayout is called (as expected for a two-finger drag gesture).
+        verify(mWindowManager, times(0)).updateViewLayout(any(), any());
+    }
+}
\ No newline at end of file