Loading core/java/android/view/GestureDetector.java +11 −0 Original line number Diff line number Diff line Loading @@ -245,6 +245,13 @@ public class GestureDetector { */ private VelocityTracker mVelocityTracker; /** * Consistency verifier for debugging purposes. */ private final InputEventConsistencyVerifier mInputEventConsistencyVerifier = InputEventConsistencyVerifier.isInstrumentationEnabled() ? new InputEventConsistencyVerifier(this, 0) : null; private class GestureHandler extends Handler { GestureHandler() { super(); Loading Loading @@ -443,6 +450,10 @@ public class GestureDetector { * else false. */ public boolean onTouchEvent(MotionEvent ev) { if (mInputEventConsistencyVerifier != null) { mInputEventConsistencyVerifier.onTouchEvent(ev, 0); } final int action = ev.getAction(); final float y = ev.getY(); final float x = ev.getX(); Loading core/java/android/view/InputEvent.java +30 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,14 @@ public abstract class InputEvent implements Parcelable { */ public abstract void setSource(int source); /** * Copies the event. * * @return A deep copy of the event. * @hide */ public abstract InputEvent copy(); /** * Recycles the event. * This method should only be used by the system since applications do not Loading @@ -76,6 +84,28 @@ public abstract class InputEvent implements Parcelable { */ public abstract void recycle(); /** * Gets a private flag that indicates when the system has detected that this input event * may be inconsistent with respect to the sequence of previously delivered input events, * such as when a key up event is sent but the key was not down or when a pointer * move event is sent but the pointer is not down. * * @return True if this event is tainted. * @hide */ public abstract boolean isTainted(); /** * Sets a private flag that indicates when the system has detected that this input event * may be inconsistent with respect to the sequence of previously delivered input events, * such as when a key up event is sent but the key was not down or when a pointer * move event is sent but the pointer is not down. * * @param tainted True if this event is tainted. * @hide */ public abstract void setTainted(boolean tainted); public int describeContents() { return 0; } Loading core/java/android/view/InputEventConsistencyVerifier.java 0 → 100644 +638 −0 File added.Preview size limit exceeded, changes collapsed. Show changes core/java/android/view/KeyEvent.java +52 −2 Original line number Diff line number Diff line Loading @@ -1171,6 +1171,17 @@ public class KeyEvent extends InputEvent implements Parcelable { */ public static final int FLAG_START_TRACKING = 0x40000000; /** * Private flag that indicates when the system has detected that this key event * may be inconsistent with respect to the sequence of previously delivered key events, * such as when a key up event is sent but the key was not down. * * @hide * @see #isTainted * @see #setTainted */ public static final int FLAG_TAINTED = 0x80000000; /** * Returns the maximum keycode. */ Loading Loading @@ -1534,6 +1545,33 @@ public class KeyEvent extends InputEvent implements Parcelable { return ev; } /** * Obtains a (potentially recycled) copy of another key event. * * @hide */ public static KeyEvent obtain(KeyEvent other) { KeyEvent ev = obtain(); ev.mDownTime = other.mDownTime; ev.mEventTime = other.mEventTime; ev.mAction = other.mAction; ev.mKeyCode = other.mKeyCode; ev.mRepeatCount = other.mRepeatCount; ev.mMetaState = other.mMetaState; ev.mDeviceId = other.mDeviceId; ev.mScanCode = other.mScanCode; ev.mFlags = other.mFlags; ev.mSource = other.mSource; ev.mCharacters = other.mCharacters; return ev; } /** @hide */ @Override public KeyEvent copy() { return obtain(this); } /** * Recycles a key event. * Key events should only be recycled if they are owned by the system since user Loading Loading @@ -1636,6 +1674,18 @@ public class KeyEvent extends InputEvent implements Parcelable { return event; } /** @hide */ @Override public final boolean isTainted() { return (mFlags & FLAG_TAINTED) != 0; } /** @hide */ @Override public final void setTainted(boolean tainted) { mFlags = tainted ? mFlags | FLAG_TAINTED : mFlags & ~FLAG_TAINTED; } /** * Don't use in new code, instead explicitly check * {@link #getAction()}. Loading core/java/android/view/MotionEvent.java +32 −0 Original line number Diff line number Diff line Loading @@ -307,6 +307,17 @@ public final class MotionEvent extends InputEvent implements Parcelable { */ public static final int FLAG_WINDOW_IS_OBSCURED = 0x1; /** * Private flag that indicates when the system has detected that this motion event * may be inconsistent with respect to the sequence of previously delivered motion events, * such as when a pointer move event is sent but the pointer is not down. * * @hide * @see #isTainted * @see #setTainted */ public static final int FLAG_TAINTED = 0x80000000; /** * Flag indicating the motion event intersected the top edge of the screen. */ Loading Loading @@ -1054,6 +1065,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { private static native void nativeSetAction(int nativePtr, int action); private static native boolean nativeIsTouchEvent(int nativePtr); private static native int nativeGetFlags(int nativePtr); private static native void nativeSetFlags(int nativePtr, int flags); private static native int nativeGetEdgeFlags(int nativePtr); private static native void nativeSetEdgeFlags(int nativePtr, int action); private static native int nativeGetMetaState(int nativePtr); Loading Loading @@ -1290,6 +1302,12 @@ public final class MotionEvent extends InputEvent implements Parcelable { return ev; } /** @hide */ @Override public MotionEvent copy() { return obtain(this); } /** * Recycle the MotionEvent, to be re-used by a later caller. After calling * this function you must not ever touch the event again. Loading Loading @@ -1403,6 +1421,20 @@ public final class MotionEvent extends InputEvent implements Parcelable { return nativeGetFlags(mNativePtr); } /** @hide */ @Override public final boolean isTainted() { final int flags = getFlags(); return (flags & FLAG_TAINTED) != 0; } /** @hide */ @Override public final void setTainted(boolean tainted) { final int flags = getFlags(); nativeSetFlags(mNativePtr, tainted ? flags | FLAG_TAINTED : flags & ~FLAG_TAINTED); } /** * Returns the time (in ms) when the user originally pressed down to start * a stream of position events. Loading Loading
core/java/android/view/GestureDetector.java +11 −0 Original line number Diff line number Diff line Loading @@ -245,6 +245,13 @@ public class GestureDetector { */ private VelocityTracker mVelocityTracker; /** * Consistency verifier for debugging purposes. */ private final InputEventConsistencyVerifier mInputEventConsistencyVerifier = InputEventConsistencyVerifier.isInstrumentationEnabled() ? new InputEventConsistencyVerifier(this, 0) : null; private class GestureHandler extends Handler { GestureHandler() { super(); Loading Loading @@ -443,6 +450,10 @@ public class GestureDetector { * else false. */ public boolean onTouchEvent(MotionEvent ev) { if (mInputEventConsistencyVerifier != null) { mInputEventConsistencyVerifier.onTouchEvent(ev, 0); } final int action = ev.getAction(); final float y = ev.getY(); final float x = ev.getX(); Loading
core/java/android/view/InputEvent.java +30 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,14 @@ public abstract class InputEvent implements Parcelable { */ public abstract void setSource(int source); /** * Copies the event. * * @return A deep copy of the event. * @hide */ public abstract InputEvent copy(); /** * Recycles the event. * This method should only be used by the system since applications do not Loading @@ -76,6 +84,28 @@ public abstract class InputEvent implements Parcelable { */ public abstract void recycle(); /** * Gets a private flag that indicates when the system has detected that this input event * may be inconsistent with respect to the sequence of previously delivered input events, * such as when a key up event is sent but the key was not down or when a pointer * move event is sent but the pointer is not down. * * @return True if this event is tainted. * @hide */ public abstract boolean isTainted(); /** * Sets a private flag that indicates when the system has detected that this input event * may be inconsistent with respect to the sequence of previously delivered input events, * such as when a key up event is sent but the key was not down or when a pointer * move event is sent but the pointer is not down. * * @param tainted True if this event is tainted. * @hide */ public abstract void setTainted(boolean tainted); public int describeContents() { return 0; } Loading
core/java/android/view/InputEventConsistencyVerifier.java 0 → 100644 +638 −0 File added.Preview size limit exceeded, changes collapsed. Show changes
core/java/android/view/KeyEvent.java +52 −2 Original line number Diff line number Diff line Loading @@ -1171,6 +1171,17 @@ public class KeyEvent extends InputEvent implements Parcelable { */ public static final int FLAG_START_TRACKING = 0x40000000; /** * Private flag that indicates when the system has detected that this key event * may be inconsistent with respect to the sequence of previously delivered key events, * such as when a key up event is sent but the key was not down. * * @hide * @see #isTainted * @see #setTainted */ public static final int FLAG_TAINTED = 0x80000000; /** * Returns the maximum keycode. */ Loading Loading @@ -1534,6 +1545,33 @@ public class KeyEvent extends InputEvent implements Parcelable { return ev; } /** * Obtains a (potentially recycled) copy of another key event. * * @hide */ public static KeyEvent obtain(KeyEvent other) { KeyEvent ev = obtain(); ev.mDownTime = other.mDownTime; ev.mEventTime = other.mEventTime; ev.mAction = other.mAction; ev.mKeyCode = other.mKeyCode; ev.mRepeatCount = other.mRepeatCount; ev.mMetaState = other.mMetaState; ev.mDeviceId = other.mDeviceId; ev.mScanCode = other.mScanCode; ev.mFlags = other.mFlags; ev.mSource = other.mSource; ev.mCharacters = other.mCharacters; return ev; } /** @hide */ @Override public KeyEvent copy() { return obtain(this); } /** * Recycles a key event. * Key events should only be recycled if they are owned by the system since user Loading Loading @@ -1636,6 +1674,18 @@ public class KeyEvent extends InputEvent implements Parcelable { return event; } /** @hide */ @Override public final boolean isTainted() { return (mFlags & FLAG_TAINTED) != 0; } /** @hide */ @Override public final void setTainted(boolean tainted) { mFlags = tainted ? mFlags | FLAG_TAINTED : mFlags & ~FLAG_TAINTED; } /** * Don't use in new code, instead explicitly check * {@link #getAction()}. Loading
core/java/android/view/MotionEvent.java +32 −0 Original line number Diff line number Diff line Loading @@ -307,6 +307,17 @@ public final class MotionEvent extends InputEvent implements Parcelable { */ public static final int FLAG_WINDOW_IS_OBSCURED = 0x1; /** * Private flag that indicates when the system has detected that this motion event * may be inconsistent with respect to the sequence of previously delivered motion events, * such as when a pointer move event is sent but the pointer is not down. * * @hide * @see #isTainted * @see #setTainted */ public static final int FLAG_TAINTED = 0x80000000; /** * Flag indicating the motion event intersected the top edge of the screen. */ Loading Loading @@ -1054,6 +1065,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { private static native void nativeSetAction(int nativePtr, int action); private static native boolean nativeIsTouchEvent(int nativePtr); private static native int nativeGetFlags(int nativePtr); private static native void nativeSetFlags(int nativePtr, int flags); private static native int nativeGetEdgeFlags(int nativePtr); private static native void nativeSetEdgeFlags(int nativePtr, int action); private static native int nativeGetMetaState(int nativePtr); Loading Loading @@ -1290,6 +1302,12 @@ public final class MotionEvent extends InputEvent implements Parcelable { return ev; } /** @hide */ @Override public MotionEvent copy() { return obtain(this); } /** * Recycle the MotionEvent, to be re-used by a later caller. After calling * this function you must not ever touch the event again. Loading Loading @@ -1403,6 +1421,20 @@ public final class MotionEvent extends InputEvent implements Parcelable { return nativeGetFlags(mNativePtr); } /** @hide */ @Override public final boolean isTainted() { final int flags = getFlags(); return (flags & FLAG_TAINTED) != 0; } /** @hide */ @Override public final void setTainted(boolean tainted) { final int flags = getFlags(); nativeSetFlags(mNativePtr, tainted ? flags | FLAG_TAINTED : flags & ~FLAG_TAINTED); } /** * Returns the time (in ms) when the user originally pressed down to start * a stream of position events. Loading