Add CLASSIFICATION_TWO_FINGER_SCROLL for touchpad scrolling

This will be used to denote the single-finger touches that
TouchInputMapper creates to simulate scrolling when the user makes
two-finger swipes on the touchpad.

Bug: 246758376
Test: check new value is sent to a test app when scrolling on a touchpad
Change-Id: Id93cba764522e36d850f7013ab8a117f64716fac
This commit is contained in:
Harry Cutts
2022-09-15 13:59:09 +00:00
parent b91f96a938
commit 7013c869e6
3 changed files with 17 additions and 2 deletions

View File

@@ -49222,6 +49222,7 @@ package android.view {
field public static final int CLASSIFICATION_AMBIGUOUS_GESTURE = 1; // 0x1
field public static final int CLASSIFICATION_DEEP_PRESS = 2; // 0x2
field public static final int CLASSIFICATION_NONE = 0; // 0x0
field public static final int CLASSIFICATION_TWO_FINGER_SWIPE = 3; // 0x3
field @NonNull public static final android.os.Parcelable.Creator<android.view.MotionEvent> CREATOR;
field public static final int EDGE_BOTTOM = 2; // 0x2
field public static final int EDGE_LEFT = 4; // 0x4

View File

@@ -1457,10 +1457,20 @@ public final class MotionEvent extends InputEvent implements Parcelable {
*/
public static final int CLASSIFICATION_DEEP_PRESS = 2;
/**
* Classification constant: touchpad scroll.
*
* The current event stream represents the user scrolling with two fingers on a touchpad.
*
* @see #getClassification
*/
public static final int CLASSIFICATION_TWO_FINGER_SWIPE = 3;
/** @hide */
@Retention(SOURCE)
@IntDef(prefix = { "CLASSIFICATION" }, value = {
CLASSIFICATION_NONE, CLASSIFICATION_AMBIGUOUS_GESTURE, CLASSIFICATION_DEEP_PRESS})
CLASSIFICATION_NONE, CLASSIFICATION_AMBIGUOUS_GESTURE, CLASSIFICATION_DEEP_PRESS,
CLASSIFICATION_TWO_FINGER_SWIPE})
public @interface Classification {};
/**
@@ -3862,9 +3872,11 @@ public final class MotionEvent extends InputEvent implements Parcelable {
return "AMBIGUOUS_GESTURE";
case CLASSIFICATION_DEEP_PRESS:
return "DEEP_PRESS";
case CLASSIFICATION_TWO_FINGER_SWIPE:
return "TWO_FINGER_SWIPE";
}
return "NONE";
return "UNKNOWN";
}
/**

View File

@@ -295,6 +295,8 @@ int32_t AMotionEvent_getClassification(const AInputEvent* motion_event) {
return AMOTION_EVENT_CLASSIFICATION_AMBIGUOUS_GESTURE;
case android::MotionClassification::DEEP_PRESS:
return AMOTION_EVENT_CLASSIFICATION_DEEP_PRESS;
case android::MotionClassification::TWO_FINGER_SWIPE:
return AMOTION_EVENT_CLASSIFICATION_TWO_FINGER_SWIPE;
}
}