Loading api/current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -49124,6 +49124,7 @@ package android.view { method public float getAxisValue(int); method public float getAxisValue(int, int); method public int getButtonState(); method public int getClassification(); method public int getDeviceId(); method public long getDownTime(); method public int getEdgeFlags(); Loading Loading @@ -49275,6 +49276,9 @@ package android.view { field public static final int BUTTON_STYLUS_PRIMARY = 32; // 0x20 field public static final int BUTTON_STYLUS_SECONDARY = 64; // 0x40 field public static final int BUTTON_TERTIARY = 4; // 0x4 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 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 core/java/android/view/MotionEvent.java +86 −8 Original line number Diff line number Diff line Loading @@ -18,6 +18,9 @@ package android.view; import static android.view.Display.DEFAULT_DISPLAY; import static java.lang.annotation.RetentionPolicy.SOURCE; import android.annotation.IntDef; import android.annotation.TestApi; import android.annotation.UnsupportedAppUsage; import android.graphics.Matrix; Loading @@ -30,6 +33,7 @@ import android.util.SparseArray; import dalvik.annotation.optimization.CriticalNative; import dalvik.annotation.optimization.FastNative; import java.lang.annotation.Retention; import java.util.Objects; /** Loading Loading @@ -462,7 +466,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { /** * This flag indicates that the event has been generated by a gesture generator. It * provides a hint to the GestureDector to not apply any touch slop. * provides a hint to the GestureDetector to not apply any touch slop. * * @hide */ Loading Loading @@ -1390,6 +1394,42 @@ public final class MotionEvent extends InputEvent implements Parcelable { "0x80000000", }; /** * Classification constant: None. * * No additional information is available about the current motion event stream. * * @see #getClassification */ public static final int CLASSIFICATION_NONE = 0; /** * Classification constant: Ambiguous gesture. * * The user's intent with respect to the current event stream is not yet determined. * Gestural actions, such as scrolling, should be inhibited until the classification resolves * to another value or the event stream ends. * * @see #getClassification */ public static final int CLASSIFICATION_AMBIGUOUS_GESTURE = 1; /** * Classification constant: Deep press. * * The current event stream represents the user intentionally pressing harder on the screen. * This classification type should be used to accelerate the long press behaviour. * * @see #getClassification */ public static final int CLASSIFICATION_DEEP_PRESS = 2; /** @hide */ @Retention(SOURCE) @IntDef(prefix = { "CLASSIFICATION" }, value = { CLASSIFICATION_NONE, CLASSIFICATION_AMBIGUOUS_GESTURE, CLASSIFICATION_DEEP_PRESS}) public @interface Classification {}; /** * Tool type constant: Unknown tool type. * This constant is used when the tool type is not known or is not relevant, Loading Loading @@ -1478,7 +1518,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { private static native long nativeInitialize(long nativePtr, int deviceId, int source, int displayId, int action, int flags, int edgeFlags, int metaState, int buttonState, int metaState, int buttonState, @Classification int classification, float xOffset, float yOffset, float xPrecision, float yPrecision, long downTimeNanos, long eventTimeNanos, int pointerCount, PointerProperties[] pointerIds, PointerCoords[] pointerCoords); Loading Loading @@ -1548,6 +1588,8 @@ public final class MotionEvent extends InputEvent implements Parcelable { @CriticalNative private static native void nativeSetButtonState(long nativePtr, int buttonState); @CriticalNative private static native int nativeGetClassification(long nativePtr); @CriticalNative private static native int nativeGetActionButton(long nativePtr); @CriticalNative private static native void nativeSetActionButton(long nativePtr, int actionButton); Loading Loading @@ -1648,7 +1690,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { MotionEvent ev = obtain(); ev.mNativePtr = nativeInitialize(ev.mNativePtr, deviceId, source, displayId, action, flags, edgeFlags, metaState, buttonState, 0, 0, xPrecision, yPrecision, CLASSIFICATION_NONE, 0, 0, xPrecision, yPrecision, downTime * NS_PER_MS, eventTime * NS_PER_MS, pointerCount, pointerProperties, pointerCoords); if (ev.mNativePtr == 0) { Loading Loading @@ -1833,7 +1875,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { ev.mNativePtr = nativeInitialize(ev.mNativePtr, deviceId, source, displayId, action, 0, edgeFlags, metaState, 0, action, 0, edgeFlags, metaState, 0 /*buttonState*/, CLASSIFICATION_NONE, 0, 0, xPrecision, yPrecision, downTime * NS_PER_MS, eventTime * NS_PER_MS, 1, pp, pc); Loading Loading @@ -2538,6 +2580,18 @@ public final class MotionEvent extends InputEvent implements Parcelable { nativeSetButtonState(mNativePtr, buttonState); } /** * Returns the classification for the current gesture. * The classification may change as more events become available for the same gesture. * * @see #CLASSIFICATION_NONE * @see #CLASSIFICATION_AMBIGUOUS_GESTURE * @see #CLASSIFICATION_DEEP_PRESS */ public @Classification int getClassification() { return nativeGetClassification(mNativePtr); } /** * Gets which button has been modified during a press or release action. * Loading Loading @@ -3172,7 +3226,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { /** * Adds all of the movement samples of the specified event to this one if * it is compatible. To be compatible, the event must have the same device id, * source, display id, action, flags, pointer count, pointer properties. * source, display id, action, flags, classification, pointer count, pointer properties. * * Only applies to {@link #ACTION_MOVE} or {@link #ACTION_HOVER_MOVE} events. * Loading @@ -3194,7 +3248,9 @@ public final class MotionEvent extends InputEvent implements Parcelable { if (nativeGetDeviceId(mNativePtr) != nativeGetDeviceId(event.mNativePtr) || nativeGetSource(mNativePtr) != nativeGetSource(event.mNativePtr) || nativeGetDisplayId(mNativePtr) != nativeGetDisplayId(event.mNativePtr) || nativeGetFlags(mNativePtr) != nativeGetFlags(event.mNativePtr)) { || nativeGetFlags(mNativePtr) != nativeGetFlags(event.mNativePtr) || nativeGetClassification(mNativePtr) != nativeGetClassification(event.mNativePtr)) { return false; } Loading Loading @@ -3282,7 +3338,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { nativeGetDisplayId(mNativePtr), nativeGetAction(mNativePtr), nativeGetFlags(mNativePtr), nativeGetEdgeFlags(mNativePtr), nativeGetMetaState(mNativePtr), nativeGetButtonState(mNativePtr), nativeGetButtonState(mNativePtr), nativeGetClassification(mNativePtr), nativeGetXOffset(mNativePtr), nativeGetYOffset(mNativePtr), nativeGetXPrecision(mNativePtr), nativeGetYPrecision(mNativePtr), nativeGetDownTimeNanos(mNativePtr), Loading Loading @@ -3376,7 +3432,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { nativeGetDisplayId(mNativePtr), newAction, nativeGetFlags(mNativePtr), nativeGetEdgeFlags(mNativePtr), nativeGetMetaState(mNativePtr), nativeGetButtonState(mNativePtr), nativeGetButtonState(mNativePtr), nativeGetClassification(mNativePtr), nativeGetXOffset(mNativePtr), nativeGetYOffset(mNativePtr), nativeGetXPrecision(mNativePtr), nativeGetYPrecision(mNativePtr), nativeGetDownTimeNanos(mNativePtr), eventTimeNanos, Loading Loading @@ -3409,6 +3465,8 @@ public final class MotionEvent extends InputEvent implements Parcelable { } appendUnless("0", msg, ", buttonState=", MotionEvent.buttonStateToString(getButtonState())); appendUnless(classificationToString(CLASSIFICATION_NONE), msg, ", classification=", classificationToString(getClassification())); appendUnless("0", msg, ", metaState=", KeyEvent.metaStateToString(getMetaState())); appendUnless("0", msg, ", flags=0x", Integer.toHexString(getFlags())); appendUnless("0", msg, ", edgeFlags=0x", Integer.toHexString(getEdgeFlags())); Loading Loading @@ -3546,6 +3604,26 @@ public final class MotionEvent extends InputEvent implements Parcelable { return result.toString(); } /** * Returns a string that represents the symbolic name of the specified classification. * * @param classification The classification type. * @return The symbolic name of this classification. * @hide */ public static String classificationToString(@Classification int classification) { switch (classification) { case CLASSIFICATION_NONE: return "NONE"; case CLASSIFICATION_AMBIGUOUS_GESTURE: return "AMBIGUOUS_GESTURE"; case CLASSIFICATION_DEEP_PRESS: return "DEEP_PRESS"; } return "NONE"; } /** * Returns a string that represents the symbolic name of the specified tool type * such as "TOOL_TYPE_FINGER" or an equivalent numeric constant such as "42" if unknown. Loading core/jni/android_view_MotionEvent.cpp +12 −3 Original line number Diff line number Diff line Loading @@ -334,7 +334,7 @@ static void pointerPropertiesFromNative(JNIEnv* env, const PointerProperties* po static jlong android_view_MotionEvent_nativeInitialize(JNIEnv* env, jclass clazz, jlong nativePtr, jint deviceId, jint source, jint displayId, jint action, jint flags, jint edgeFlags, jint metaState, jint buttonState, jint metaState, jint buttonState, jint classification, jfloat xOffset, jfloat yOffset, jfloat xPrecision, jfloat yPrecision, jlong downTimeNanos, jlong eventTimeNanos, jint pointerCount, jobjectArray pointerPropertiesObjArray, Loading Loading @@ -373,7 +373,8 @@ static jlong android_view_MotionEvent_nativeInitialize(JNIEnv* env, jclass clazz } event->initialize(deviceId, source, displayId, action, 0, flags, edgeFlags, metaState, buttonState, xOffset, yOffset, xPrecision, yPrecision, buttonState, static_cast<MotionClassification>(classification), xOffset, yOffset, xPrecision, yPrecision, downTimeNanos, eventTimeNanos, pointerCount, pointerProperties, rawPointerCoords); return reinterpret_cast<jlong>(event); Loading Loading @@ -668,6 +669,11 @@ static void android_view_MotionEvent_nativeSetButtonState(jlong nativePtr, jint event->setButtonState(buttonState); } static jint android_view_MotionEvent_nativeGetClassification(jlong nativePtr) { MotionEvent* event = reinterpret_cast<MotionEvent*>(nativePtr); return static_cast<jint>(event->getClassification()); } static void android_view_MotionEvent_nativeOffsetLocation(jlong nativePtr, jfloat deltaX, jfloat deltaY) { MotionEvent* event = reinterpret_cast<MotionEvent*>(nativePtr); Loading Loading @@ -747,7 +753,7 @@ static void android_view_MotionEvent_nativeTransform(jlong nativePtr, jlong matr static const JNINativeMethod gMotionEventMethods[] = { /* name, signature, funcPtr */ { "nativeInitialize", "(JIIIIIIIIFFFFJJI[Landroid/view/MotionEvent$PointerProperties;" "(JIIIIIIIIIFFFFJJI[Landroid/view/MotionEvent$PointerProperties;" "[Landroid/view/MotionEvent$PointerCoords;)J", (void*)android_view_MotionEvent_nativeInitialize }, { "nativeDispose", Loading Loading @@ -846,6 +852,9 @@ static const JNINativeMethod gMotionEventMethods[] = { { "nativeSetButtonState", "(JI)V", (void*)android_view_MotionEvent_nativeSetButtonState }, { "nativeGetClassification", "(J)I", (void*)android_view_MotionEvent_nativeGetClassification }, { "nativeOffsetLocation", "(JFF)V", (void*)android_view_MotionEvent_nativeOffsetLocation }, Loading Loading
api/current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -49124,6 +49124,7 @@ package android.view { method public float getAxisValue(int); method public float getAxisValue(int, int); method public int getButtonState(); method public int getClassification(); method public int getDeviceId(); method public long getDownTime(); method public int getEdgeFlags(); Loading Loading @@ -49275,6 +49276,9 @@ package android.view { field public static final int BUTTON_STYLUS_PRIMARY = 32; // 0x20 field public static final int BUTTON_STYLUS_SECONDARY = 64; // 0x40 field public static final int BUTTON_TERTIARY = 4; // 0x4 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 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
core/java/android/view/MotionEvent.java +86 −8 Original line number Diff line number Diff line Loading @@ -18,6 +18,9 @@ package android.view; import static android.view.Display.DEFAULT_DISPLAY; import static java.lang.annotation.RetentionPolicy.SOURCE; import android.annotation.IntDef; import android.annotation.TestApi; import android.annotation.UnsupportedAppUsage; import android.graphics.Matrix; Loading @@ -30,6 +33,7 @@ import android.util.SparseArray; import dalvik.annotation.optimization.CriticalNative; import dalvik.annotation.optimization.FastNative; import java.lang.annotation.Retention; import java.util.Objects; /** Loading Loading @@ -462,7 +466,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { /** * This flag indicates that the event has been generated by a gesture generator. It * provides a hint to the GestureDector to not apply any touch slop. * provides a hint to the GestureDetector to not apply any touch slop. * * @hide */ Loading Loading @@ -1390,6 +1394,42 @@ public final class MotionEvent extends InputEvent implements Parcelable { "0x80000000", }; /** * Classification constant: None. * * No additional information is available about the current motion event stream. * * @see #getClassification */ public static final int CLASSIFICATION_NONE = 0; /** * Classification constant: Ambiguous gesture. * * The user's intent with respect to the current event stream is not yet determined. * Gestural actions, such as scrolling, should be inhibited until the classification resolves * to another value or the event stream ends. * * @see #getClassification */ public static final int CLASSIFICATION_AMBIGUOUS_GESTURE = 1; /** * Classification constant: Deep press. * * The current event stream represents the user intentionally pressing harder on the screen. * This classification type should be used to accelerate the long press behaviour. * * @see #getClassification */ public static final int CLASSIFICATION_DEEP_PRESS = 2; /** @hide */ @Retention(SOURCE) @IntDef(prefix = { "CLASSIFICATION" }, value = { CLASSIFICATION_NONE, CLASSIFICATION_AMBIGUOUS_GESTURE, CLASSIFICATION_DEEP_PRESS}) public @interface Classification {}; /** * Tool type constant: Unknown tool type. * This constant is used when the tool type is not known or is not relevant, Loading Loading @@ -1478,7 +1518,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { private static native long nativeInitialize(long nativePtr, int deviceId, int source, int displayId, int action, int flags, int edgeFlags, int metaState, int buttonState, int metaState, int buttonState, @Classification int classification, float xOffset, float yOffset, float xPrecision, float yPrecision, long downTimeNanos, long eventTimeNanos, int pointerCount, PointerProperties[] pointerIds, PointerCoords[] pointerCoords); Loading Loading @@ -1548,6 +1588,8 @@ public final class MotionEvent extends InputEvent implements Parcelable { @CriticalNative private static native void nativeSetButtonState(long nativePtr, int buttonState); @CriticalNative private static native int nativeGetClassification(long nativePtr); @CriticalNative private static native int nativeGetActionButton(long nativePtr); @CriticalNative private static native void nativeSetActionButton(long nativePtr, int actionButton); Loading Loading @@ -1648,7 +1690,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { MotionEvent ev = obtain(); ev.mNativePtr = nativeInitialize(ev.mNativePtr, deviceId, source, displayId, action, flags, edgeFlags, metaState, buttonState, 0, 0, xPrecision, yPrecision, CLASSIFICATION_NONE, 0, 0, xPrecision, yPrecision, downTime * NS_PER_MS, eventTime * NS_PER_MS, pointerCount, pointerProperties, pointerCoords); if (ev.mNativePtr == 0) { Loading Loading @@ -1833,7 +1875,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { ev.mNativePtr = nativeInitialize(ev.mNativePtr, deviceId, source, displayId, action, 0, edgeFlags, metaState, 0, action, 0, edgeFlags, metaState, 0 /*buttonState*/, CLASSIFICATION_NONE, 0, 0, xPrecision, yPrecision, downTime * NS_PER_MS, eventTime * NS_PER_MS, 1, pp, pc); Loading Loading @@ -2538,6 +2580,18 @@ public final class MotionEvent extends InputEvent implements Parcelable { nativeSetButtonState(mNativePtr, buttonState); } /** * Returns the classification for the current gesture. * The classification may change as more events become available for the same gesture. * * @see #CLASSIFICATION_NONE * @see #CLASSIFICATION_AMBIGUOUS_GESTURE * @see #CLASSIFICATION_DEEP_PRESS */ public @Classification int getClassification() { return nativeGetClassification(mNativePtr); } /** * Gets which button has been modified during a press or release action. * Loading Loading @@ -3172,7 +3226,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { /** * Adds all of the movement samples of the specified event to this one if * it is compatible. To be compatible, the event must have the same device id, * source, display id, action, flags, pointer count, pointer properties. * source, display id, action, flags, classification, pointer count, pointer properties. * * Only applies to {@link #ACTION_MOVE} or {@link #ACTION_HOVER_MOVE} events. * Loading @@ -3194,7 +3248,9 @@ public final class MotionEvent extends InputEvent implements Parcelable { if (nativeGetDeviceId(mNativePtr) != nativeGetDeviceId(event.mNativePtr) || nativeGetSource(mNativePtr) != nativeGetSource(event.mNativePtr) || nativeGetDisplayId(mNativePtr) != nativeGetDisplayId(event.mNativePtr) || nativeGetFlags(mNativePtr) != nativeGetFlags(event.mNativePtr)) { || nativeGetFlags(mNativePtr) != nativeGetFlags(event.mNativePtr) || nativeGetClassification(mNativePtr) != nativeGetClassification(event.mNativePtr)) { return false; } Loading Loading @@ -3282,7 +3338,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { nativeGetDisplayId(mNativePtr), nativeGetAction(mNativePtr), nativeGetFlags(mNativePtr), nativeGetEdgeFlags(mNativePtr), nativeGetMetaState(mNativePtr), nativeGetButtonState(mNativePtr), nativeGetButtonState(mNativePtr), nativeGetClassification(mNativePtr), nativeGetXOffset(mNativePtr), nativeGetYOffset(mNativePtr), nativeGetXPrecision(mNativePtr), nativeGetYPrecision(mNativePtr), nativeGetDownTimeNanos(mNativePtr), Loading Loading @@ -3376,7 +3432,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { nativeGetDisplayId(mNativePtr), newAction, nativeGetFlags(mNativePtr), nativeGetEdgeFlags(mNativePtr), nativeGetMetaState(mNativePtr), nativeGetButtonState(mNativePtr), nativeGetButtonState(mNativePtr), nativeGetClassification(mNativePtr), nativeGetXOffset(mNativePtr), nativeGetYOffset(mNativePtr), nativeGetXPrecision(mNativePtr), nativeGetYPrecision(mNativePtr), nativeGetDownTimeNanos(mNativePtr), eventTimeNanos, Loading Loading @@ -3409,6 +3465,8 @@ public final class MotionEvent extends InputEvent implements Parcelable { } appendUnless("0", msg, ", buttonState=", MotionEvent.buttonStateToString(getButtonState())); appendUnless(classificationToString(CLASSIFICATION_NONE), msg, ", classification=", classificationToString(getClassification())); appendUnless("0", msg, ", metaState=", KeyEvent.metaStateToString(getMetaState())); appendUnless("0", msg, ", flags=0x", Integer.toHexString(getFlags())); appendUnless("0", msg, ", edgeFlags=0x", Integer.toHexString(getEdgeFlags())); Loading Loading @@ -3546,6 +3604,26 @@ public final class MotionEvent extends InputEvent implements Parcelable { return result.toString(); } /** * Returns a string that represents the symbolic name of the specified classification. * * @param classification The classification type. * @return The symbolic name of this classification. * @hide */ public static String classificationToString(@Classification int classification) { switch (classification) { case CLASSIFICATION_NONE: return "NONE"; case CLASSIFICATION_AMBIGUOUS_GESTURE: return "AMBIGUOUS_GESTURE"; case CLASSIFICATION_DEEP_PRESS: return "DEEP_PRESS"; } return "NONE"; } /** * Returns a string that represents the symbolic name of the specified tool type * such as "TOOL_TYPE_FINGER" or an equivalent numeric constant such as "42" if unknown. Loading
core/jni/android_view_MotionEvent.cpp +12 −3 Original line number Diff line number Diff line Loading @@ -334,7 +334,7 @@ static void pointerPropertiesFromNative(JNIEnv* env, const PointerProperties* po static jlong android_view_MotionEvent_nativeInitialize(JNIEnv* env, jclass clazz, jlong nativePtr, jint deviceId, jint source, jint displayId, jint action, jint flags, jint edgeFlags, jint metaState, jint buttonState, jint metaState, jint buttonState, jint classification, jfloat xOffset, jfloat yOffset, jfloat xPrecision, jfloat yPrecision, jlong downTimeNanos, jlong eventTimeNanos, jint pointerCount, jobjectArray pointerPropertiesObjArray, Loading Loading @@ -373,7 +373,8 @@ static jlong android_view_MotionEvent_nativeInitialize(JNIEnv* env, jclass clazz } event->initialize(deviceId, source, displayId, action, 0, flags, edgeFlags, metaState, buttonState, xOffset, yOffset, xPrecision, yPrecision, buttonState, static_cast<MotionClassification>(classification), xOffset, yOffset, xPrecision, yPrecision, downTimeNanos, eventTimeNanos, pointerCount, pointerProperties, rawPointerCoords); return reinterpret_cast<jlong>(event); Loading Loading @@ -668,6 +669,11 @@ static void android_view_MotionEvent_nativeSetButtonState(jlong nativePtr, jint event->setButtonState(buttonState); } static jint android_view_MotionEvent_nativeGetClassification(jlong nativePtr) { MotionEvent* event = reinterpret_cast<MotionEvent*>(nativePtr); return static_cast<jint>(event->getClassification()); } static void android_view_MotionEvent_nativeOffsetLocation(jlong nativePtr, jfloat deltaX, jfloat deltaY) { MotionEvent* event = reinterpret_cast<MotionEvent*>(nativePtr); Loading Loading @@ -747,7 +753,7 @@ static void android_view_MotionEvent_nativeTransform(jlong nativePtr, jlong matr static const JNINativeMethod gMotionEventMethods[] = { /* name, signature, funcPtr */ { "nativeInitialize", "(JIIIIIIIIFFFFJJI[Landroid/view/MotionEvent$PointerProperties;" "(JIIIIIIIIIFFFFJJI[Landroid/view/MotionEvent$PointerProperties;" "[Landroid/view/MotionEvent$PointerCoords;)J", (void*)android_view_MotionEvent_nativeInitialize }, { "nativeDispose", Loading Loading @@ -846,6 +852,9 @@ static const JNINativeMethod gMotionEventMethods[] = { { "nativeSetButtonState", "(JI)V", (void*)android_view_MotionEvent_nativeSetButtonState }, { "nativeGetClassification", "(J)I", (void*)android_view_MotionEvent_nativeGetClassification }, { "nativeOffsetLocation", "(JFF)V", (void*)android_view_MotionEvent_nativeOffsetLocation }, Loading