summaryrefslogtreecommitdiff
path: root/include/android/input.h
diff options
context:
space:
mode:
author Harry Cutts <hcutts@google.com> 2023-05-17 12:03:49 +0000
committer Harry Cutts <hcutts@google.com> 2023-05-22 10:23:23 +0000
commit8743f18757a16e4c107d36c21b1dca3b4a844d82 (patch)
tree07d568feee0e666d185f9363f23ebd98ef063a66 /include/android/input.h
parentb2262b9dc0a3393346980a55618a8a288ff16839 (diff)
GestureConverter: add finger count axis for multi-finger swipes
Consumers of multi-finger swipes (i.e. SysUI) previously had to wait until the first MOVE event to find out how many fingers were swiping, even though in the framework we knew this when sending the DOWN event. Adding this as an axis on the DOWN event should let SysUI simplify their code. Bug: 283093437 Test: atest inputflinger_tests:GestureConverterTest Test: modify InputDispatcher to send multi-finger swipes to apps too, then check reported values in a test app Change-Id: I34d1fdf096c49d7eb9b5d8ebd64427eb4e5db1f4
Diffstat (limited to 'include/android/input.h')
-rw-r--r--include/android/input.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/include/android/input.h b/include/android/input.h
index a45f065dd0..9a0eb4d838 100644
--- a/include/android/input.h
+++ b/include/android/input.h
@@ -781,6 +781,8 @@ enum {
*
* These values are relative to the state from the last event, not accumulated, so developers
* should make sure to process this axis value for all batched historical events.
+ *
+ * This axis is only set on the first pointer in a motion event.
*/
AMOTION_EVENT_AXIS_GESTURE_X_OFFSET = 48,
/**
@@ -797,6 +799,8 @@ enum {
*
* These values are relative to the state from the last event, not accumulated, so developers
* should make sure to process this axis value for all batched historical events.
+ *
+ * This axis is only set on the first pointer in a motion event.
*/
AMOTION_EVENT_AXIS_GESTURE_SCROLL_X_DISTANCE = 50,
/**
@@ -815,16 +819,29 @@ enum {
*
* These values are relative to the state from the last event, not accumulated, so developers
* should make sure to process this axis value for all batched historical events.
+ *
+ * This axis is only set on the first pointer in a motion event.
*/
AMOTION_EVENT_AXIS_GESTURE_PINCH_SCALE_FACTOR = 52,
/**
+ * Axis constant: the number of fingers being used in a multi-finger swipe gesture.
+ *
+ * - For a touch pad, reports the number of fingers being used in a multi-finger swipe gesture
+ * (with CLASSIFICATION_MULTI_FINGER_SWIPE).
+ *
+ * Since CLASSIFICATION_MULTI_FINGER_SWIPE is a hidden API, so is this axis. It is only set on
+ * the first pointer in a motion event.
+ */
+ AMOTION_EVENT_AXIS_GESTURE_SWIPE_FINGER_COUNT = 53,
+
+ /**
* Note: This is not an "Axis constant". It does not represent any axis, nor should it be used
* to represent any axis. It is a constant holding the value of the largest defined axis value,
* to make some computations (like iterating through all possible axes) cleaner.
* Please update the value accordingly if you add a new axis.
*/
- AMOTION_EVENT_MAXIMUM_VALID_AXIS_VALUE = AMOTION_EVENT_AXIS_GESTURE_PINCH_SCALE_FACTOR,
+ AMOTION_EVENT_MAXIMUM_VALID_AXIS_VALUE = AMOTION_EVENT_AXIS_GESTURE_SWIPE_FINGER_COUNT,
// NOTE: If you add a new axis here you must also add it to several other files.
// Refer to frameworks/base/core/java/android/view/MotionEvent.java for the full list.