From eba02dbd467b18eabaee15c9a9780366874b7e48 Mon Sep 17 00:00:00 2001 From: Harry Cutts Date: Wed, 5 Oct 2022 15:51:35 +0000 Subject: [PATCH] Add AXIS_GESTURE_{X,Y}_OFFSET MotionEvent axes These will be used to report the movements of swipe gestures on touchpads. Bug: 246758376 Test: check axis values come through in a test app Change-Id: I056b7d1eb5dacf14bce6b32ee3fbb8a672f2d647 --- core/api/current.txt | 2 ++ core/java/android/view/MotionEvent.java | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/core/api/current.txt b/core/api/current.txt index b063746157301..1d6adfb386e79 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -49357,6 +49357,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_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 field public static final int AXIS_HAT_Y = 16; // 0x10 field public static final int AXIS_HSCROLL = 10; // 0xa diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java index b5dff5e725fbd..ceab310b64b2d 100644 --- a/core/java/android/view/MotionEvent.java +++ b/core/java/android/view/MotionEvent.java @@ -1272,6 +1272,25 @@ public final class MotionEvent extends InputEvent implements Parcelable { */ public static final int AXIS_GENERIC_16 = 47; + /** + * Axis constant: X gesture offset axis of a motion event. + *

+ *

+ */ + public static final int AXIS_GESTURE_X_OFFSET = 48; + + /** + * Axis constant: Y gesture offset axis of a motion event. + * + * The same as {@link #AXIS_GESTURE_X_OFFSET}, but for the Y axis. + */ + public static final int AXIS_GESTURE_Y_OFFSET = 49; + // 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 @@ -1325,6 +1344,8 @@ public final class MotionEvent extends InputEvent implements Parcelable { names.append(AXIS_GENERIC_14, "AXIS_GENERIC_14"); names.append(AXIS_GENERIC_15, "AXIS_GENERIC_15"); 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"); } /**