summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Harry Cutts <hcutts@google.com> 2022-10-05 15:51:35 +0000
committer Harry Cutts <hcutts@google.com> 2022-10-11 11:39:00 +0000
commiteba02dbd467b18eabaee15c9a9780366874b7e48 (patch)
treef543048f777b23892c4623e6ab0f413ab01557b5
parent4d05eedd75c2528d7acbe1ef37bec7ad38add63d (diff)
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
-rw-r--r--core/api/current.txt2
-rw-r--r--core/java/android/view/MotionEvent.java21
2 files changed, 23 insertions, 0 deletions
diff --git a/core/api/current.txt b/core/api/current.txt
index b06374615730..1d6adfb386e7 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 b5dff5e725fb..ceab310b64b2 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.
+ * <p>
+ * <ul>
+ * <li>For a touch pad, reports the distance that a swipe gesture has moved in the X axis, as a
+ * proportion of the touch pad's size. For example, if a touch pad is 1000 units wide, and a
+ * swipe gesture starts at X = 500 then moves to X = 400, this axis would have a value of
+ * -0.1.
+ * </ul>
+ */
+ 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");
}
/**