Loading include/android/input.h +26 −1 Original line number Diff line number Diff line Loading @@ -778,6 +778,9 @@ enum { * 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. * * 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. */ AMOTION_EVENT_AXIS_GESTURE_X_OFFSET = 48, /** Loading @@ -791,6 +794,9 @@ enum { * * - For a touch pad, reports the distance that should be scrolled in the X axis as a result of * the user's two-finger scroll gesture, in display pixels. * * 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. */ AMOTION_EVENT_AXIS_GESTURE_SCROLL_X_DISTANCE = 50, /** Loading @@ -799,6 +805,18 @@ enum { * The same as {@link AMOTION_EVENT_AXIS_GESTURE_SCROLL_X_DISTANCE}, but for the Y axis. */ AMOTION_EVENT_AXIS_GESTURE_SCROLL_Y_DISTANCE = 51, /** * Axis constant: pinch scale factor of a motion event. * * - For a touch pad, reports the change in distance between the fingers when the user is making * a pinch gesture, as a proportion of that distance when the gesture was last reported. For * example, if the fingers were 50 units apart and are now 52 units apart, the scale factor * would be 1.04. * * 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. */ AMOTION_EVENT_AXIS_GESTURE_PINCH_SCALE_FACTOR = 52, /** * Note: This is not an "Axis constant". It does not represent any axis, nor should it be used Loading @@ -806,7 +824,7 @@ enum { * 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_SCROLL_Y_DISTANCE, AMOTION_EVENT_MAXIMUM_VALID_AXIS_VALUE = AMOTION_EVENT_AXIS_GESTURE_PINCH_SCALE_FACTOR, // 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. Loading Loading @@ -891,6 +909,13 @@ enum AMotionClassification : uint32_t { * why they have a separate constant from two-finger swipes. */ AMOTION_EVENT_CLASSIFICATION_MULTI_FINGER_SWIPE = 4, /** * Classification constant: pinch. * * The current event stream represents the user pinching with two fingers on a touchpad. The * gesture is centered around the current cursor position. */ AMOTION_EVENT_CLASSIFICATION_PINCH = 5, }; /** Loading include/input/Input.h +5 −0 Original line number Diff line number Diff line Loading @@ -308,6 +308,11 @@ enum class MotionClassification : uint8_t { * have a separate constant from two-finger swipes. */ MULTI_FINGER_SWIPE = AMOTION_EVENT_CLASSIFICATION_MULTI_FINGER_SWIPE, /** * The current gesture represents the user pinching with two fingers on a touchpad. The gesture * is centered around the current cursor position. */ PINCH = AMOTION_EVENT_CLASSIFICATION_PINCH, }; /** Loading libs/input/Input.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,8 @@ const char* motionClassificationToString(MotionClassification classification) { return "TWO_FINGER_SWIPE"; case MotionClassification::MULTI_FINGER_SWIPE: return "MULTI_FINGER_SWIPE"; case MotionClassification::PINCH: return "PINCH"; } } Loading libs/input/InputEventLabels.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -396,7 +396,8 @@ namespace android { DEFINE_AXIS(GESTURE_X_OFFSET), \ DEFINE_AXIS(GESTURE_Y_OFFSET), \ DEFINE_AXIS(GESTURE_SCROLL_X_DISTANCE), \ DEFINE_AXIS(GESTURE_SCROLL_Y_DISTANCE) DEFINE_AXIS(GESTURE_SCROLL_Y_DISTANCE), \ DEFINE_AXIS(GESTURE_PINCH_SCALE_FACTOR) // NOTE: If you add new LEDs here, you must also add them to Input.h #define LEDS_SEQUENCE \ Loading services/inputflinger/InputCommonConverter.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -263,11 +263,12 @@ static_assert(static_cast<common::Axis>(AMOTION_EVENT_AXIS_GENERIC_13) == common static_assert(static_cast<common::Axis>(AMOTION_EVENT_AXIS_GENERIC_14) == common::Axis::GENERIC_14); static_assert(static_cast<common::Axis>(AMOTION_EVENT_AXIS_GENERIC_15) == common::Axis::GENERIC_15); static_assert(static_cast<common::Axis>(AMOTION_EVENT_AXIS_GENERIC_16) == common::Axis::GENERIC_16); // TODO(b/251196347): add GESTURE_{X,Y}_OFFSET and GESTURE_SCROLL_{X,Y}_DISTANCE. // TODO(b/251196347): add GESTURE_{X,Y}_OFFSET, GESTURE_SCROLL_{X,Y}_DISTANCE, and // GESTURE_PINCH_SCALE_FACTOR. // If you added a new axis, consider whether this should also be exposed as a HAL axis. Update the // static_assert below and add the new axis here, or leave a comment summarizing your decision. static_assert(static_cast<common::Axis>(AMOTION_EVENT_MAXIMUM_VALID_AXIS_VALUE) == static_cast<common::Axis>(AMOTION_EVENT_AXIS_GESTURE_SCROLL_Y_DISTANCE)); static_cast<common::Axis>(AMOTION_EVENT_AXIS_GESTURE_PINCH_SCALE_FACTOR)); static common::VideoFrame getHalVideoFrame(const TouchVideoFrame& frame) { common::VideoFrame out; Loading Loading
include/android/input.h +26 −1 Original line number Diff line number Diff line Loading @@ -778,6 +778,9 @@ enum { * 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. * * 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. */ AMOTION_EVENT_AXIS_GESTURE_X_OFFSET = 48, /** Loading @@ -791,6 +794,9 @@ enum { * * - For a touch pad, reports the distance that should be scrolled in the X axis as a result of * the user's two-finger scroll gesture, in display pixels. * * 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. */ AMOTION_EVENT_AXIS_GESTURE_SCROLL_X_DISTANCE = 50, /** Loading @@ -799,6 +805,18 @@ enum { * The same as {@link AMOTION_EVENT_AXIS_GESTURE_SCROLL_X_DISTANCE}, but for the Y axis. */ AMOTION_EVENT_AXIS_GESTURE_SCROLL_Y_DISTANCE = 51, /** * Axis constant: pinch scale factor of a motion event. * * - For a touch pad, reports the change in distance between the fingers when the user is making * a pinch gesture, as a proportion of that distance when the gesture was last reported. For * example, if the fingers were 50 units apart and are now 52 units apart, the scale factor * would be 1.04. * * 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. */ AMOTION_EVENT_AXIS_GESTURE_PINCH_SCALE_FACTOR = 52, /** * Note: This is not an "Axis constant". It does not represent any axis, nor should it be used Loading @@ -806,7 +824,7 @@ enum { * 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_SCROLL_Y_DISTANCE, AMOTION_EVENT_MAXIMUM_VALID_AXIS_VALUE = AMOTION_EVENT_AXIS_GESTURE_PINCH_SCALE_FACTOR, // 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. Loading Loading @@ -891,6 +909,13 @@ enum AMotionClassification : uint32_t { * why they have a separate constant from two-finger swipes. */ AMOTION_EVENT_CLASSIFICATION_MULTI_FINGER_SWIPE = 4, /** * Classification constant: pinch. * * The current event stream represents the user pinching with two fingers on a touchpad. The * gesture is centered around the current cursor position. */ AMOTION_EVENT_CLASSIFICATION_PINCH = 5, }; /** Loading
include/input/Input.h +5 −0 Original line number Diff line number Diff line Loading @@ -308,6 +308,11 @@ enum class MotionClassification : uint8_t { * have a separate constant from two-finger swipes. */ MULTI_FINGER_SWIPE = AMOTION_EVENT_CLASSIFICATION_MULTI_FINGER_SWIPE, /** * The current gesture represents the user pinching with two fingers on a touchpad. The gesture * is centered around the current cursor position. */ PINCH = AMOTION_EVENT_CLASSIFICATION_PINCH, }; /** Loading
libs/input/Input.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,8 @@ const char* motionClassificationToString(MotionClassification classification) { return "TWO_FINGER_SWIPE"; case MotionClassification::MULTI_FINGER_SWIPE: return "MULTI_FINGER_SWIPE"; case MotionClassification::PINCH: return "PINCH"; } } Loading
libs/input/InputEventLabels.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -396,7 +396,8 @@ namespace android { DEFINE_AXIS(GESTURE_X_OFFSET), \ DEFINE_AXIS(GESTURE_Y_OFFSET), \ DEFINE_AXIS(GESTURE_SCROLL_X_DISTANCE), \ DEFINE_AXIS(GESTURE_SCROLL_Y_DISTANCE) DEFINE_AXIS(GESTURE_SCROLL_Y_DISTANCE), \ DEFINE_AXIS(GESTURE_PINCH_SCALE_FACTOR) // NOTE: If you add new LEDs here, you must also add them to Input.h #define LEDS_SEQUENCE \ Loading
services/inputflinger/InputCommonConverter.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -263,11 +263,12 @@ static_assert(static_cast<common::Axis>(AMOTION_EVENT_AXIS_GENERIC_13) == common static_assert(static_cast<common::Axis>(AMOTION_EVENT_AXIS_GENERIC_14) == common::Axis::GENERIC_14); static_assert(static_cast<common::Axis>(AMOTION_EVENT_AXIS_GENERIC_15) == common::Axis::GENERIC_15); static_assert(static_cast<common::Axis>(AMOTION_EVENT_AXIS_GENERIC_16) == common::Axis::GENERIC_16); // TODO(b/251196347): add GESTURE_{X,Y}_OFFSET and GESTURE_SCROLL_{X,Y}_DISTANCE. // TODO(b/251196347): add GESTURE_{X,Y}_OFFSET, GESTURE_SCROLL_{X,Y}_DISTANCE, and // GESTURE_PINCH_SCALE_FACTOR. // If you added a new axis, consider whether this should also be exposed as a HAL axis. Update the // static_assert below and add the new axis here, or leave a comment summarizing your decision. static_assert(static_cast<common::Axis>(AMOTION_EVENT_MAXIMUM_VALID_AXIS_VALUE) == static_cast<common::Axis>(AMOTION_EVENT_AXIS_GESTURE_SCROLL_Y_DISTANCE)); static_cast<common::Axis>(AMOTION_EVENT_AXIS_GESTURE_PINCH_SCALE_FACTOR)); static common::VideoFrame getHalVideoFrame(const TouchVideoFrame& frame) { common::VideoFrame out; Loading