Add AXIS_GESTURE_SCROLL_{X,Y}_DISTANCE MotionEvent axes
Bug: 251196347
Test: try out two-finger scroll gestures with an Apple Magic Trackpad 2
Test: atest inputflinger_tests
Change-Id: Ib9135dc0b782f300b074b05b32383715845f94ba
diff --git a/core/api/current.txt b/core/api/current.txt
index 5dd1b39..3d84918 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -50482,6 +50482,8 @@
field public static final int AXIS_GENERIC_7 = 38; // 0x26
field public static final int AXIS_GENERIC_8 = 39; // 0x27
field public static final int AXIS_GENERIC_9 = 40; // 0x28
+ field public static final int AXIS_GESTURE_SCROLL_X_DISTANCE = 50; // 0x32
+ field public static final int AXIS_GESTURE_SCROLL_Y_DISTANCE = 51; // 0x33
field public static final int AXIS_GESTURE_X_OFFSET = 48; // 0x30
field public static final int AXIS_GESTURE_Y_OFFSET = 49; // 0x31
field public static final int AXIS_HAT_X = 15; // 0xf
diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java
index 1ff7ae6..a36fd8d 100644
--- a/core/java/android/view/MotionEvent.java
+++ b/core/java/android/view/MotionEvent.java
@@ -1293,6 +1293,23 @@
*/
public static final int AXIS_GESTURE_Y_OFFSET = 49;
+ /**
+ * Axis constant: X scroll distance axis of a motion event.
+ * <p>
+ * <ul>
+ * <li>For a touch pad, reports the distance that should be scrolled in the X axis as a result
+ * of the user's two-finger scroll gesture, in display pixels.
+ * </ul>
+ */
+ public static final int AXIS_GESTURE_SCROLL_X_DISTANCE = 50;
+
+ /**
+ * Axis constant: Y scroll distance axis of a motion event.
+ *
+ * The same as {@link #AXIS_GESTURE_SCROLL_X_DISTANCE}, but for the Y axis.
+ */
+ public static final int AXIS_GESTURE_SCROLL_Y_DISTANCE = 51;
+
// NOTE: If you add a new axis here you must also add it to:
// frameworks/native/include/android/input.h
// frameworks/native/libs/input/InputEventLabels.cpp
@@ -1350,6 +1367,8 @@
names.append(AXIS_GENERIC_16, "AXIS_GENERIC_16");
names.append(AXIS_GESTURE_X_OFFSET, "AXIS_GESTURE_X_OFFSET");
names.append(AXIS_GESTURE_Y_OFFSET, "AXIS_GESTURE_Y_OFFSET");
+ names.append(AXIS_GESTURE_SCROLL_X_DISTANCE, "AXIS_GESTURE_SCROLL_X_DISTANCE");
+ names.append(AXIS_GESTURE_SCROLL_Y_DISTANCE, "AXIS_GESTURE_SCROLL_Y_DISTANCE");
}
/**