summaryrefslogtreecommitdiff
path: root/core/java/android/view/MotionEvent.java
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2016-10-03 15:47:18 -0700
committerJohn Reck <jreck@google.com>2016-10-03 15:47:18 -0700
commit0970997326f7cd8d4ec9ae08835db91308591a02 (patch)
treeaa1b62b8c79b1bb3c9eee46590bfdd7a028394c0 /core/java/android/view/MotionEvent.java
parentf03f8e59b08026fe689f83638ad4175fa1ed8c64 (diff)
Update MotionEvent JNI
Switch to @CriticalNative & @FastNative Test: make & boot Change-Id: I8962663348b354d30995b397619ee101e405e57c
Diffstat (limited to 'core/java/android/view/MotionEvent.java')
-rw-r--r--core/java/android/view/MotionEvent.java85
1 files changed, 63 insertions, 22 deletions
diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java
index fab536479e3d..3e8d5777bfa6 100644
--- a/core/java/android/view/MotionEvent.java
+++ b/core/java/android/view/MotionEvent.java
@@ -23,6 +23,9 @@ import android.os.Parcelable;
import android.os.SystemClock;
import android.util.SparseArray;
+import dalvik.annotation.optimization.CriticalNative;
+import dalvik.annotation.optimization.FastNative;
+
/**
* Object used to report movement (mouse, pen, finger, trackball) events.
* Motion events may hold either absolute or relative movements and other data,
@@ -1445,59 +1448,97 @@ public final class MotionEvent extends InputEvent implements Parcelable {
float xOffset, float yOffset, float xPrecision, float yPrecision,
long downTimeNanos, long eventTimeNanos,
int pointerCount, PointerProperties[] pointerIds, PointerCoords[] pointerCoords);
- private static native long nativeCopy(long destNativePtr, long sourceNativePtr,
- boolean keepHistory);
private static native void nativeDispose(long nativePtr);
private static native void nativeAddBatch(long nativePtr, long eventTimeNanos,
PointerCoords[] pointerCoords, int metaState);
+ private static native void nativeGetPointerCoords(long nativePtr,
+ int pointerIndex, int historyPos, PointerCoords outPointerCoords);
+ private static native void nativeGetPointerProperties(long nativePtr,
+ int pointerIndex, PointerProperties outPointerProperties);
+
+ private static native long nativeReadFromParcel(long nativePtr, Parcel parcel);
+ private static native void nativeWriteToParcel(long nativePtr, Parcel parcel);
+
+ private static native String nativeAxisToString(int axis);
+ private static native int nativeAxisFromString(String label);
+
+ // -------------- @FastNative -------------------------
+
+ @FastNative
+ private static native int nativeGetPointerId(long nativePtr, int pointerIndex);
+ @FastNative
+ private static native int nativeGetToolType(long nativePtr, int pointerIndex);
+ @FastNative
+ private static native long nativeGetEventTimeNanos(long nativePtr, int historyPos);
+ @FastNative
+ private static native float nativeGetRawAxisValue(long nativePtr,
+ int axis, int pointerIndex, int historyPos);
+ @FastNative
+ private static native float nativeGetAxisValue(long nativePtr,
+ int axis, int pointerIndex, int historyPos);
+ // -------------- @CriticalNative ----------------------
+
+ @CriticalNative
+ private static native long nativeCopy(long destNativePtr, long sourceNativePtr,
+ boolean keepHistory);
+ @CriticalNative
private static native int nativeGetDeviceId(long nativePtr);
+ @CriticalNative
private static native int nativeGetSource(long nativePtr);
+ @CriticalNative
private static native int nativeSetSource(long nativePtr, int source);
+ @CriticalNative
private static native int nativeGetAction(long nativePtr);
+ @CriticalNative
private static native void nativeSetAction(long nativePtr, int action);
+ @CriticalNative
private static native boolean nativeIsTouchEvent(long nativePtr);
+ @CriticalNative
private static native int nativeGetFlags(long nativePtr);
+ @CriticalNative
private static native void nativeSetFlags(long nativePtr, int flags);
+ @CriticalNative
private static native int nativeGetEdgeFlags(long nativePtr);
+ @CriticalNative
private static native void nativeSetEdgeFlags(long nativePtr, int action);
+ @CriticalNative
private static native int nativeGetMetaState(long nativePtr);
+ @CriticalNative
private static native int nativeGetButtonState(long nativePtr);
+ @CriticalNative
private static native void nativeSetButtonState(long nativePtr, int buttonState);
+ @CriticalNative
private static native int nativeGetActionButton(long nativePtr);
+ @CriticalNative
private static native void nativeSetActionButton(long nativePtr, int actionButton);
+ @CriticalNative
private static native void nativeOffsetLocation(long nativePtr, float deltaX, float deltaY);
+ @CriticalNative
private static native float nativeGetXOffset(long nativePtr);
+ @CriticalNative
private static native float nativeGetYOffset(long nativePtr);
+ @CriticalNative
private static native float nativeGetXPrecision(long nativePtr);
+ @CriticalNative
private static native float nativeGetYPrecision(long nativePtr);
+ @CriticalNative
private static native long nativeGetDownTimeNanos(long nativePtr);
+ @CriticalNative
private static native void nativeSetDownTimeNanos(long nativePtr, long downTime);
+ @CriticalNative
private static native int nativeGetPointerCount(long nativePtr);
- private static native int nativeGetPointerId(long nativePtr, int pointerIndex);
- private static native int nativeGetToolType(long nativePtr, int pointerIndex);
+ @CriticalNative
private static native int nativeFindPointerIndex(long nativePtr, int pointerId);
+ @CriticalNative
private static native int nativeGetHistorySize(long nativePtr);
- private static native long nativeGetEventTimeNanos(long nativePtr, int historyPos);
- private static native float nativeGetRawAxisValue(long nativePtr,
- int axis, int pointerIndex, int historyPos);
- private static native float nativeGetAxisValue(long nativePtr,
- int axis, int pointerIndex, int historyPos);
- private static native void nativeGetPointerCoords(long nativePtr,
- int pointerIndex, int historyPos, PointerCoords outPointerCoords);
- private static native void nativeGetPointerProperties(long nativePtr,
- int pointerIndex, PointerProperties outPointerProperties);
+ @CriticalNative
private static native void nativeScale(long nativePtr, float scale);
- private static native void nativeTransform(long nativePtr, Matrix matrix);
-
- private static native long nativeReadFromParcel(long nativePtr, Parcel parcel);
- private static native void nativeWriteToParcel(long nativePtr, Parcel parcel);
-
- private static native String nativeAxisToString(int axis);
- private static native int nativeAxisFromString(String label);
+ @CriticalNative
+ private static native void nativeTransform(long nativePtr, long matrix);
private MotionEvent() {
}
@@ -2065,7 +2106,7 @@ public final class MotionEvent extends InputEvent implements Parcelable {
public final int getPointerCount() {
return nativeGetPointerCount(mNativePtr);
}
-
+
/**
* Return the pointer identifier associated with a particular pointer
* data index in this event. The identifier tells you the actual pointer
@@ -2891,7 +2932,7 @@ public final class MotionEvent extends InputEvent implements Parcelable {
throw new IllegalArgumentException("matrix must not be null");
}
- nativeTransform(mNativePtr, matrix);
+ nativeTransform(mNativePtr, matrix.native_instance);
}
/**