From e4df12d23490bf8cbaebb18186153f8dce7a5144 Mon Sep 17 00:00:00 2001 From: Harry Cutts Date: Fri, 16 Dec 2022 17:33:45 +0000 Subject: [PATCH] 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 --- core/api/current.txt | 2 ++ core/java/android/view/MotionEvent.java | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/core/api/current.txt b/core/api/current.txt index 5dd1b3938f40b..3d8491854c33a 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -50482,6 +50482,8 @@ package android.view { 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 1ff7ae662da00..a36fd8d99e3ce 100644 --- a/core/java/android/view/MotionEvent.java +++ b/core/java/android/view/MotionEvent.java @@ -1293,6 +1293,23 @@ public final class MotionEvent extends InputEvent implements Parcelable { */ public static final int AXIS_GESTURE_Y_OFFSET = 49; + /** + * Axis constant: X scroll distance axis of a motion event. + *

+ *

+ */ + 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 @@ public final class MotionEvent extends InputEvent implements Parcelable { 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"); } /**