Merge "Add MULTI_FINGER_SWIPE motion classification"

This commit is contained in:
Harry Cutts
2023-01-05 18:36:02 +00:00
committed by Android (Google) Code Review
2 changed files with 17 additions and 2 deletions

View File

@@ -1491,11 +1491,23 @@ public final class MotionEvent extends InputEvent implements Parcelable {
*/
public static final int CLASSIFICATION_TWO_FINGER_SWIPE = 3;
/**
* Classification constant: multi-finger swipe.
*
* The current event stream represents the user swiping with three or more fingers on a
* touchpad. Unlike two-finger swipes, these are only to be handled by the system UI, which is
* why they have a separate constant from two-finger swipes.
*
* @see #getClassification
* @hide
*/
public static final int CLASSIFICATION_MULTI_FINGER_SWIPE = 4;
/** @hide */
@Retention(SOURCE)
@IntDef(prefix = { "CLASSIFICATION" }, value = {
CLASSIFICATION_NONE, CLASSIFICATION_AMBIGUOUS_GESTURE, CLASSIFICATION_DEEP_PRESS,
CLASSIFICATION_TWO_FINGER_SWIPE})
CLASSIFICATION_TWO_FINGER_SWIPE, CLASSIFICATION_MULTI_FINGER_SWIPE})
public @interface Classification {};
/**
@@ -3941,7 +3953,8 @@ public final class MotionEvent extends InputEvent implements Parcelable {
return "DEEP_PRESS";
case CLASSIFICATION_TWO_FINGER_SWIPE:
return "TWO_FINGER_SWIPE";
case CLASSIFICATION_MULTI_FINGER_SWIPE:
return "MULTI_FINGER_SWIPE";
}
return "UNKNOWN";
}

View File

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