Loading core/java/android/view/KeyEvent.java +12 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.view; import static android.view.Display.INVALID_DISPLAY; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.TestApi; import android.compat.annotation.UnsupportedAppUsage; import android.os.Build; Loading Loading @@ -1269,6 +1270,7 @@ public class KeyEvent extends InputEvent implements Parcelable { @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) private int mSource; private int mDisplayId; private @Nullable byte[] mHmac; @UnsupportedAppUsage private int mMetaState; @UnsupportedAppUsage Loading Loading @@ -1546,6 +1548,7 @@ public class KeyEvent extends InputEvent implements Parcelable { mDeviceId = origEvent.mDeviceId; mSource = origEvent.mSource; mDisplayId = origEvent.mDisplayId; mHmac = origEvent.mHmac == null ? null : origEvent.mHmac.clone(); mScanCode = origEvent.mScanCode; mFlags = origEvent.mFlags; mCharacters = origEvent.mCharacters; Loading Loading @@ -1573,6 +1576,7 @@ public class KeyEvent extends InputEvent implements Parcelable { mDeviceId = origEvent.mDeviceId; mSource = origEvent.mSource; mDisplayId = origEvent.mDisplayId; mHmac = null; // Don't copy HMAC, it will be invalid because eventTime is changing mScanCode = origEvent.mScanCode; mFlags = origEvent.mFlags; mCharacters = origEvent.mCharacters; Loading Loading @@ -1600,7 +1604,8 @@ public class KeyEvent extends InputEvent implements Parcelable { */ public static KeyEvent obtain(long downTime, long eventTime, int action, int code, int repeat, int metaState, int deviceId, int scancode, int flags, int source, int displayId, String characters) { int deviceId, int scancode, int flags, int source, int displayId, @Nullable byte[] hmac, String characters) { KeyEvent ev = obtain(); ev.mDownTime = downTime; ev.mEventTime = eventTime; Loading @@ -1613,6 +1618,7 @@ public class KeyEvent extends InputEvent implements Parcelable { ev.mFlags = flags; ev.mSource = source; ev.mDisplayId = displayId; ev.mHmac = hmac; ev.mCharacters = characters; return ev; } Loading @@ -1627,7 +1633,7 @@ public class KeyEvent extends InputEvent implements Parcelable { int code, int repeat, int metaState, int deviceId, int scancode, int flags, int source, String characters) { return obtain(downTime, eventTime, action, code, repeat, metaState, deviceId, scancode, flags, source, INVALID_DISPLAY, characters); flags, source, INVALID_DISPLAY, null /* hmac */, characters); } /** Loading @@ -1650,6 +1656,7 @@ public class KeyEvent extends InputEvent implements Parcelable { ev.mFlags = other.mFlags; ev.mSource = other.mSource; ev.mDisplayId = other.mDisplayId; ev.mHmac = other.mHmac == null ? null : other.mHmac.clone(); ev.mCharacters = other.mCharacters; return ev; } Loading Loading @@ -1738,6 +1745,7 @@ public class KeyEvent extends InputEvent implements Parcelable { mDeviceId = origEvent.mDeviceId; mSource = origEvent.mSource; mDisplayId = origEvent.mDisplayId; mHmac = null; // Don't copy the hmac, it will be invalid since action is changing mScanCode = origEvent.mScanCode; mFlags = origEvent.mFlags; // Don't copy mCharacters, since one way or the other we'll lose it Loading Loading @@ -3091,6 +3099,7 @@ public class KeyEvent extends InputEvent implements Parcelable { mDeviceId = in.readInt(); mSource = in.readInt(); mDisplayId = in.readInt(); mHmac = in.createByteArray(); mAction = in.readInt(); mKeyCode = in.readInt(); mRepeatCount = in.readInt(); Loading @@ -3109,6 +3118,7 @@ public class KeyEvent extends InputEvent implements Parcelable { out.writeInt(mDeviceId); out.writeInt(mSource); out.writeInt(mDisplayId); out.writeByteArray(mHmac); out.writeInt(mAction); out.writeInt(mKeyCode); out.writeInt(mRepeatCount); Loading core/jni/android_view_InputEventSender.cpp +25 −15 Original line number Diff line number Diff line Loading @@ -113,10 +113,13 @@ status_t NativeInputEventSender::sendKeyEvent(uint32_t seq, const KeyEvent* even } uint32_t publishedSeq = mNextPublishedSeq++; status_t status = mInputPublisher.publishKeyEvent(publishedSeq, event->getDeviceId(), event->getSource(), event->getDisplayId(), event->getAction(), event->getFlags(), event->getKeyCode(), event->getScanCode(), event->getMetaState(), event->getRepeatCount(), event->getDownTime(), event->getEventTime()); status_t status = mInputPublisher.publishKeyEvent(publishedSeq, event->getDeviceId(), event->getSource(), event->getDisplayId(), event->getHmac(), event->getAction(), event->getFlags(), event->getKeyCode(), event->getScanCode(), event->getMetaState(), event->getRepeatCount(), event->getDownTime(), event->getEventTime()); if (status) { ALOGW("Failed to send key event on channel '%s'. status=%d", getInputChannelName().c_str(), status); Loading @@ -134,16 +137,23 @@ status_t NativeInputEventSender::sendMotionEvent(uint32_t seq, const MotionEvent uint32_t publishedSeq; for (size_t i = 0; i <= event->getHistorySize(); i++) { publishedSeq = mNextPublishedSeq++; status_t status = mInputPublisher.publishMotionEvent(publishedSeq, event->getDeviceId(), event->getSource(), event->getDisplayId(), event->getAction(), event->getActionButton(), event->getFlags(), event->getEdgeFlags(), event->getMetaState(), event->getButtonState(), event->getClassification(), event->getXOffset(), event->getYOffset(), event->getXPrecision(), event->getYPrecision(), event->getRawXCursorPosition(), event->getRawYCursorPosition(), event->getDownTime(), event->getHistoricalEventTime(i), event->getPointerCount(), event->getPointerProperties(), status_t status = mInputPublisher.publishMotionEvent(publishedSeq, event->getDeviceId(), event->getSource(), event->getDisplayId(), event->getHmac(), event->getAction(), event->getActionButton(), event->getFlags(), event->getEdgeFlags(), event->getMetaState(), event->getButtonState(), event->getClassification(), event->getXScale(), event->getYScale(), event->getXOffset(), event->getYOffset(), event->getXPrecision(), event->getYPrecision(), event->getRawXCursorPosition(), event->getRawYCursorPosition(), event->getDownTime(), event->getHistoricalEventTime(i), event->getPointerCount(), event->getPointerProperties(), event->getHistoricalRawPointerCoords(0, i)); if (status) { ALOGW("Failed to send motion event sample on channel '%s'. status=%d", Loading core/jni/android_view_KeyEvent.cpp +62 −21 Original line number Diff line number Diff line Loading @@ -20,15 +20,53 @@ #include <android_runtime/AndroidRuntime.h> #include <android_runtime/Log.h> #include <utils/Log.h> #include <input/Input.h> #include <nativehelper/ScopedPrimitiveArray.h> #include <nativehelper/ScopedUtfChars.h> #include <utils/Log.h> #include <optional> #include "android_view_KeyEvent.h" #include "core_jni_helpers.h" namespace android { /** * Convert an std::array of bytes into a Java object. */ template <size_t N> static ScopedLocalRef<jbyteArray> toJbyteArray(JNIEnv* env, const std::array<uint8_t, N>& data) { ScopedLocalRef<jbyteArray> array(env, env->NewByteArray(N)); if (array.get() == nullptr) { jniThrowException(env, "java/lang/OutOfMemoryError", nullptr); return array; } static_assert(sizeof(char) == sizeof(uint8_t)); env->SetByteArrayRegion(array.get(), 0, N, reinterpret_cast<const signed char*>(data.data())); return array; } /** * Convert a Java object into an std::array of bytes of size N. * If the object is null, or the length is unexpected, return std::nullopt. */ template <size_t N> static std::optional<std::array<uint8_t, N>> fromJobject(JNIEnv* env, jobject object) { if (object == nullptr) { return std::nullopt; } jbyteArray javaArray = reinterpret_cast<jbyteArray>(object); ScopedByteArrayRO bytes(env, javaArray); if (bytes.size() != N) { ALOGE("Could not initialize array from java object, expected length %zu but got %zu", N, bytes.size()); return std::nullopt; } std::array<uint8_t, N> array; std::move(bytes.get(), bytes.get() + N, array.begin()); return array; } // ---------------------------------------------------------------------------- static struct { Loading @@ -40,6 +78,7 @@ static struct { jfieldID mDeviceId; jfieldID mSource; jfieldID mDisplayId; jfieldID mHmac; jfieldID mMetaState; jfieldID mAction; jfieldID mKeyCode; Loading @@ -54,20 +93,16 @@ static struct { // ---------------------------------------------------------------------------- jobject android_view_KeyEvent_fromNative(JNIEnv* env, const KeyEvent* event) { jobject eventObj = env->CallStaticObjectMethod(gKeyEventClassInfo.clazz, gKeyEventClassInfo.obtain, ScopedLocalRef<jbyteArray> hmac = toJbyteArray(env, event->getHmac()); jobject eventObj = env->CallStaticObjectMethod(gKeyEventClassInfo.clazz, gKeyEventClassInfo.obtain, nanoseconds_to_milliseconds(event->getDownTime()), nanoseconds_to_milliseconds(event->getEventTime()), event->getAction(), event->getKeyCode(), event->getRepeatCount(), event->getMetaState(), event->getDeviceId(), event->getScanCode(), event->getFlags(), event->getSource(), event->getDisplayId(), NULL); event->getAction(), event->getKeyCode(), event->getRepeatCount(), event->getMetaState(), event->getDeviceId(), event->getScanCode(), event->getFlags(), event->getSource(), event->getDisplayId(), hmac.get(), NULL); if (env->ExceptionCheck()) { ALOGE("An exception occurred while obtaining a key event."); LOGE_EX(env); Loading @@ -82,6 +117,11 @@ status_t android_view_KeyEvent_toNative(JNIEnv* env, jobject eventObj, jint deviceId = env->GetIntField(eventObj, gKeyEventClassInfo.mDeviceId); jint source = env->GetIntField(eventObj, gKeyEventClassInfo.mSource); jint displayId = env->GetIntField(eventObj, gKeyEventClassInfo.mDisplayId); jobject hmacObj = env->GetObjectField(eventObj, gKeyEventClassInfo.mHmac); std::optional<std::array<uint8_t, 32>> hmac = fromJobject<32>(env, hmacObj); if (!hmac) { hmac = INVALID_HMAC; } jint metaState = env->GetIntField(eventObj, gKeyEventClassInfo.mMetaState); jint action = env->GetIntField(eventObj, gKeyEventClassInfo.mAction); jint keyCode = env->GetIntField(eventObj, gKeyEventClassInfo.mKeyCode); Loading @@ -91,9 +131,8 @@ status_t android_view_KeyEvent_toNative(JNIEnv* env, jobject eventObj, jlong downTime = env->GetLongField(eventObj, gKeyEventClassInfo.mDownTime); jlong eventTime = env->GetLongField(eventObj, gKeyEventClassInfo.mEventTime); event->initialize(deviceId, source, displayId, action, flags, keyCode, scanCode, metaState, repeatCount, milliseconds_to_nanoseconds(downTime), event->initialize(deviceId, source, displayId, *hmac, action, flags, keyCode, scanCode, metaState, repeatCount, milliseconds_to_nanoseconds(downTime), milliseconds_to_nanoseconds(eventTime)); return OK; } Loading Loading @@ -134,8 +173,9 @@ int register_android_view_KeyEvent(JNIEnv* env) { jclass clazz = FindClassOrDie(env, "android/view/KeyEvent"); gKeyEventClassInfo.clazz = MakeGlobalRefOrDie(env, clazz); gKeyEventClassInfo.obtain = GetStaticMethodIDOrDie(env, gKeyEventClassInfo.clazz, "obtain", "(JJIIIIIIIIILjava/lang/String;)Landroid/view/KeyEvent;"); gKeyEventClassInfo.obtain = GetStaticMethodIDOrDie(env, gKeyEventClassInfo.clazz, "obtain", "(JJIIIIIIIII[BLjava/lang/String;)Landroid/view/KeyEvent;"); gKeyEventClassInfo.recycle = GetMethodIDOrDie(env, gKeyEventClassInfo.clazz, "recycle", "()V"); Loading @@ -143,6 +183,7 @@ int register_android_view_KeyEvent(JNIEnv* env) { gKeyEventClassInfo.mSource = GetFieldIDOrDie(env, gKeyEventClassInfo.clazz, "mSource", "I"); gKeyEventClassInfo.mDisplayId = GetFieldIDOrDie(env, gKeyEventClassInfo.clazz, "mDisplayId", "I"); gKeyEventClassInfo.mHmac = GetFieldIDOrDie(env, gKeyEventClassInfo.clazz, "mHmac", "[B"); gKeyEventClassInfo.mMetaState = GetFieldIDOrDie(env, gKeyEventClassInfo.clazz, "mMetaState", "I"); gKeyEventClassInfo.mAction = GetFieldIDOrDie(env, gKeyEventClassInfo.clazz, "mAction", "I"); Loading core/jni/android_view_KeyEvent.h +1 −1 Original line number Diff line number Diff line Loading @@ -42,4 +42,4 @@ extern status_t android_view_KeyEvent_recycle(JNIEnv* env, jobject eventObj); } // namespace android #endif // _ANDROID_OS_KEYEVENT_H #endif // _ANDROID_VIEW_KEYEVENT_H core/jni/android_view_MotionEvent.cpp +82 −162 Original line number Diff line number Diff line Loading @@ -330,14 +330,12 @@ 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 classification, jfloat xOffset, jfloat yOffset, jfloat xPrecision, jfloat yPrecision, jlong downTimeNanos, jlong eventTimeNanos, jint pointerCount, jobjectArray pointerPropertiesObjArray, jobjectArray pointerCoordsObjArray) { 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 classification, jfloat xOffset, jfloat yOffset, jfloat xPrecision, jfloat yPrecision, jlong downTimeNanos, jlong eventTimeNanos, jint pointerCount, jobjectArray pointerPropertiesObjArray, jobjectArray pointerCoordsObjArray) { if (!validatePointerCount(env, pointerCount) || !validatePointerPropertiesArray(env, pointerPropertiesObjArray, pointerCount) || !validatePointerCoordsObjArray(env, pointerCoordsObjArray, pointerCount)) { Loading Loading @@ -371,11 +369,12 @@ static jlong android_view_MotionEvent_nativeInitialize(JNIEnv* env, jclass clazz env->DeleteLocalRef(pointerCoordsObj); } event->initialize(deviceId, source, displayId, action, 0, flags, edgeFlags, metaState, buttonState, static_cast<MotionClassification>(classification), xOffset, yOffset, xPrecision, yPrecision, event->initialize(deviceId, source, displayId, INVALID_HMAC, action, 0, flags, edgeFlags, metaState, buttonState, static_cast<MotionClassification>(classification), 1 /*xScale*/, 1 /*yScale*/, xOffset, yOffset, xPrecision, yPrecision, AMOTION_EVENT_INVALID_CURSOR_POSITION, AMOTION_EVENT_INVALID_CURSOR_POSITION, downTimeNanos, eventTimeNanos, pointerCount, pointerProperties, rawPointerCoords); downTimeNanos, eventTimeNanos, pointerCount, pointerProperties, rawPointerCoords); return reinterpret_cast<jlong>(event); Loading Loading @@ -762,150 +761,71 @@ static const JNINativeMethod gMotionEventMethods[] = { "(JIIIIIIIIIFFFFJJI[Landroid/view/MotionEvent$PointerProperties;" "[Landroid/view/MotionEvent$PointerCoords;)J", (void*)android_view_MotionEvent_nativeInitialize}, { "nativeDispose", "(J)V", (void*)android_view_MotionEvent_nativeDispose }, { "nativeAddBatch", "(JJ[Landroid/view/MotionEvent$PointerCoords;I)V", {"nativeDispose", "(J)V", (void*)android_view_MotionEvent_nativeDispose}, {"nativeAddBatch", "(JJ[Landroid/view/MotionEvent$PointerCoords;I)V", (void*)android_view_MotionEvent_nativeAddBatch}, { "nativeReadFromParcel", "(JLandroid/os/Parcel;)J", {"nativeReadFromParcel", "(JLandroid/os/Parcel;)J", (void*)android_view_MotionEvent_nativeReadFromParcel}, { "nativeWriteToParcel", "(JLandroid/os/Parcel;)V", {"nativeWriteToParcel", "(JLandroid/os/Parcel;)V", (void*)android_view_MotionEvent_nativeWriteToParcel}, {"nativeAxisToString", "(I)Ljava/lang/String;", (void*)android_view_MotionEvent_nativeAxisToString}, {"nativeAxisFromString", "(Ljava/lang/String;)I", (void*)android_view_MotionEvent_nativeAxisFromString}, { "nativeGetPointerProperties", "(JILandroid/view/MotionEvent$PointerProperties;)V", {"nativeGetPointerProperties", "(JILandroid/view/MotionEvent$PointerProperties;)V", (void*)android_view_MotionEvent_nativeGetPointerProperties}, { "nativeGetPointerCoords", "(JIILandroid/view/MotionEvent$PointerCoords;)V", {"nativeGetPointerCoords", "(JIILandroid/view/MotionEvent$PointerCoords;)V", (void*)android_view_MotionEvent_nativeGetPointerCoords}, // --------------- @FastNative ---------------------- { "nativeGetPointerId", "(JI)I", (void*)android_view_MotionEvent_nativeGetPointerId }, { "nativeGetToolType", "(JI)I", (void*)android_view_MotionEvent_nativeGetToolType }, { "nativeGetEventTimeNanos", "(JI)J", {"nativeGetPointerId", "(JI)I", (void*)android_view_MotionEvent_nativeGetPointerId}, {"nativeGetToolType", "(JI)I", (void*)android_view_MotionEvent_nativeGetToolType}, {"nativeGetEventTimeNanos", "(JI)J", (void*)android_view_MotionEvent_nativeGetEventTimeNanos}, { "nativeGetRawAxisValue", "(JIII)F", (void*)android_view_MotionEvent_nativeGetRawAxisValue }, { "nativeGetAxisValue", "(JIII)F", (void*)android_view_MotionEvent_nativeGetAxisValue }, { "nativeTransform", "(JLandroid/graphics/Matrix;)V", {"nativeGetRawAxisValue", "(JIII)F", (void*)android_view_MotionEvent_nativeGetRawAxisValue}, {"nativeGetAxisValue", "(JIII)F", (void*)android_view_MotionEvent_nativeGetAxisValue}, {"nativeTransform", "(JLandroid/graphics/Matrix;)V", (void*)android_view_MotionEvent_nativeTransform}, // --------------- @CriticalNative ------------------ { "nativeCopy", "(JJZ)J", (void*)android_view_MotionEvent_nativeCopy }, { "nativeGetDeviceId", "(J)I", (void*)android_view_MotionEvent_nativeGetDeviceId }, { "nativeGetSource", "(J)I", (void*)android_view_MotionEvent_nativeGetSource }, { "nativeSetSource", "(JI)V", (void*)android_view_MotionEvent_nativeSetSource }, { "nativeGetDisplayId", "(J)I", (void*)android_view_MotionEvent_nativeGetDisplayId }, { "nativeSetDisplayId", "(JI)V", (void*)android_view_MotionEvent_nativeSetDisplayId }, { "nativeGetAction", "(J)I", (void*)android_view_MotionEvent_nativeGetAction }, { "nativeSetAction", "(JI)V", (void*)android_view_MotionEvent_nativeSetAction }, { "nativeGetActionButton", "(J)I", (void*)android_view_MotionEvent_nativeGetActionButton}, { "nativeSetActionButton", "(JI)V", (void*)android_view_MotionEvent_nativeSetActionButton}, { "nativeIsTouchEvent", "(J)Z", (void*)android_view_MotionEvent_nativeIsTouchEvent }, { "nativeGetFlags", "(J)I", (void*)android_view_MotionEvent_nativeGetFlags }, { "nativeSetFlags", "(JI)V", (void*)android_view_MotionEvent_nativeSetFlags }, { "nativeGetEdgeFlags", "(J)I", (void*)android_view_MotionEvent_nativeGetEdgeFlags }, { "nativeSetEdgeFlags", "(JI)V", (void*)android_view_MotionEvent_nativeSetEdgeFlags }, { "nativeGetMetaState", "(J)I", (void*)android_view_MotionEvent_nativeGetMetaState }, { "nativeGetButtonState", "(J)I", (void*)android_view_MotionEvent_nativeGetButtonState }, { "nativeSetButtonState", "(JI)V", (void*)android_view_MotionEvent_nativeSetButtonState }, { "nativeGetClassification", "(J)I", {"nativeCopy", "(JJZ)J", (void*)android_view_MotionEvent_nativeCopy}, {"nativeGetDeviceId", "(J)I", (void*)android_view_MotionEvent_nativeGetDeviceId}, {"nativeGetSource", "(J)I", (void*)android_view_MotionEvent_nativeGetSource}, {"nativeSetSource", "(JI)V", (void*)android_view_MotionEvent_nativeSetSource}, {"nativeGetDisplayId", "(J)I", (void*)android_view_MotionEvent_nativeGetDisplayId}, {"nativeSetDisplayId", "(JI)V", (void*)android_view_MotionEvent_nativeSetDisplayId}, {"nativeGetAction", "(J)I", (void*)android_view_MotionEvent_nativeGetAction}, {"nativeSetAction", "(JI)V", (void*)android_view_MotionEvent_nativeSetAction}, {"nativeGetActionButton", "(J)I", (void*)android_view_MotionEvent_nativeGetActionButton}, {"nativeSetActionButton", "(JI)V", (void*)android_view_MotionEvent_nativeSetActionButton}, {"nativeIsTouchEvent", "(J)Z", (void*)android_view_MotionEvent_nativeIsTouchEvent}, {"nativeGetFlags", "(J)I", (void*)android_view_MotionEvent_nativeGetFlags}, {"nativeSetFlags", "(JI)V", (void*)android_view_MotionEvent_nativeSetFlags}, {"nativeGetEdgeFlags", "(J)I", (void*)android_view_MotionEvent_nativeGetEdgeFlags}, {"nativeSetEdgeFlags", "(JI)V", (void*)android_view_MotionEvent_nativeSetEdgeFlags}, {"nativeGetMetaState", "(J)I", (void*)android_view_MotionEvent_nativeGetMetaState}, {"nativeGetButtonState", "(J)I", (void*)android_view_MotionEvent_nativeGetButtonState}, {"nativeSetButtonState", "(JI)V", (void*)android_view_MotionEvent_nativeSetButtonState}, {"nativeGetClassification", "(J)I", (void*)android_view_MotionEvent_nativeGetClassification}, { "nativeOffsetLocation", "(JFF)V", (void*)android_view_MotionEvent_nativeOffsetLocation }, { "nativeGetXOffset", "(J)F", (void*)android_view_MotionEvent_nativeGetXOffset }, { "nativeGetYOffset", "(J)F", (void*)android_view_MotionEvent_nativeGetYOffset }, { "nativeGetXPrecision", "(J)F", (void*)android_view_MotionEvent_nativeGetXPrecision }, { "nativeGetYPrecision", "(J)F", (void*)android_view_MotionEvent_nativeGetYPrecision }, { "nativeGetXCursorPosition", "(J)F", {"nativeOffsetLocation", "(JFF)V", (void*)android_view_MotionEvent_nativeOffsetLocation}, {"nativeGetXOffset", "(J)F", (void*)android_view_MotionEvent_nativeGetXOffset}, {"nativeGetYOffset", "(J)F", (void*)android_view_MotionEvent_nativeGetYOffset}, {"nativeGetXPrecision", "(J)F", (void*)android_view_MotionEvent_nativeGetXPrecision}, {"nativeGetYPrecision", "(J)F", (void*)android_view_MotionEvent_nativeGetYPrecision}, {"nativeGetXCursorPosition", "(J)F", (void*)android_view_MotionEvent_nativeGetXCursorPosition}, { "nativeGetYCursorPosition", "(J)F", {"nativeGetYCursorPosition", "(J)F", (void*)android_view_MotionEvent_nativeGetYCursorPosition}, { "nativeSetCursorPosition", "(JFF)V", {"nativeSetCursorPosition", "(JFF)V", (void*)android_view_MotionEvent_nativeSetCursorPosition}, { "nativeGetDownTimeNanos", "(J)J", (void*)android_view_MotionEvent_nativeGetDownTimeNanos }, { "nativeSetDownTimeNanos", "(JJ)V", (void*)android_view_MotionEvent_nativeSetDownTimeNanos }, { "nativeGetPointerCount", "(J)I", (void*)android_view_MotionEvent_nativeGetPointerCount }, { "nativeFindPointerIndex", "(JI)I", (void*)android_view_MotionEvent_nativeFindPointerIndex }, { "nativeGetHistorySize", "(J)I", (void*)android_view_MotionEvent_nativeGetHistorySize }, { "nativeScale", "(JF)V", (void*)android_view_MotionEvent_nativeScale }, {"nativeGetDownTimeNanos", "(J)J", (void*)android_view_MotionEvent_nativeGetDownTimeNanos}, {"nativeSetDownTimeNanos", "(JJ)V", (void*)android_view_MotionEvent_nativeSetDownTimeNanos}, {"nativeGetPointerCount", "(J)I", (void*)android_view_MotionEvent_nativeGetPointerCount}, {"nativeFindPointerIndex", "(JI)I", (void*)android_view_MotionEvent_nativeFindPointerIndex}, {"nativeGetHistorySize", "(J)I", (void*)android_view_MotionEvent_nativeGetHistorySize}, {"nativeScale", "(JF)V", (void*)android_view_MotionEvent_nativeScale}, }; int register_android_view_MotionEvent(JNIEnv* env) { Loading Loading
core/java/android/view/KeyEvent.java +12 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.view; import static android.view.Display.INVALID_DISPLAY; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.TestApi; import android.compat.annotation.UnsupportedAppUsage; import android.os.Build; Loading Loading @@ -1269,6 +1270,7 @@ public class KeyEvent extends InputEvent implements Parcelable { @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) private int mSource; private int mDisplayId; private @Nullable byte[] mHmac; @UnsupportedAppUsage private int mMetaState; @UnsupportedAppUsage Loading Loading @@ -1546,6 +1548,7 @@ public class KeyEvent extends InputEvent implements Parcelable { mDeviceId = origEvent.mDeviceId; mSource = origEvent.mSource; mDisplayId = origEvent.mDisplayId; mHmac = origEvent.mHmac == null ? null : origEvent.mHmac.clone(); mScanCode = origEvent.mScanCode; mFlags = origEvent.mFlags; mCharacters = origEvent.mCharacters; Loading Loading @@ -1573,6 +1576,7 @@ public class KeyEvent extends InputEvent implements Parcelable { mDeviceId = origEvent.mDeviceId; mSource = origEvent.mSource; mDisplayId = origEvent.mDisplayId; mHmac = null; // Don't copy HMAC, it will be invalid because eventTime is changing mScanCode = origEvent.mScanCode; mFlags = origEvent.mFlags; mCharacters = origEvent.mCharacters; Loading Loading @@ -1600,7 +1604,8 @@ public class KeyEvent extends InputEvent implements Parcelable { */ public static KeyEvent obtain(long downTime, long eventTime, int action, int code, int repeat, int metaState, int deviceId, int scancode, int flags, int source, int displayId, String characters) { int deviceId, int scancode, int flags, int source, int displayId, @Nullable byte[] hmac, String characters) { KeyEvent ev = obtain(); ev.mDownTime = downTime; ev.mEventTime = eventTime; Loading @@ -1613,6 +1618,7 @@ public class KeyEvent extends InputEvent implements Parcelable { ev.mFlags = flags; ev.mSource = source; ev.mDisplayId = displayId; ev.mHmac = hmac; ev.mCharacters = characters; return ev; } Loading @@ -1627,7 +1633,7 @@ public class KeyEvent extends InputEvent implements Parcelable { int code, int repeat, int metaState, int deviceId, int scancode, int flags, int source, String characters) { return obtain(downTime, eventTime, action, code, repeat, metaState, deviceId, scancode, flags, source, INVALID_DISPLAY, characters); flags, source, INVALID_DISPLAY, null /* hmac */, characters); } /** Loading @@ -1650,6 +1656,7 @@ public class KeyEvent extends InputEvent implements Parcelable { ev.mFlags = other.mFlags; ev.mSource = other.mSource; ev.mDisplayId = other.mDisplayId; ev.mHmac = other.mHmac == null ? null : other.mHmac.clone(); ev.mCharacters = other.mCharacters; return ev; } Loading Loading @@ -1738,6 +1745,7 @@ public class KeyEvent extends InputEvent implements Parcelable { mDeviceId = origEvent.mDeviceId; mSource = origEvent.mSource; mDisplayId = origEvent.mDisplayId; mHmac = null; // Don't copy the hmac, it will be invalid since action is changing mScanCode = origEvent.mScanCode; mFlags = origEvent.mFlags; // Don't copy mCharacters, since one way or the other we'll lose it Loading Loading @@ -3091,6 +3099,7 @@ public class KeyEvent extends InputEvent implements Parcelable { mDeviceId = in.readInt(); mSource = in.readInt(); mDisplayId = in.readInt(); mHmac = in.createByteArray(); mAction = in.readInt(); mKeyCode = in.readInt(); mRepeatCount = in.readInt(); Loading @@ -3109,6 +3118,7 @@ public class KeyEvent extends InputEvent implements Parcelable { out.writeInt(mDeviceId); out.writeInt(mSource); out.writeInt(mDisplayId); out.writeByteArray(mHmac); out.writeInt(mAction); out.writeInt(mKeyCode); out.writeInt(mRepeatCount); Loading
core/jni/android_view_InputEventSender.cpp +25 −15 Original line number Diff line number Diff line Loading @@ -113,10 +113,13 @@ status_t NativeInputEventSender::sendKeyEvent(uint32_t seq, const KeyEvent* even } uint32_t publishedSeq = mNextPublishedSeq++; status_t status = mInputPublisher.publishKeyEvent(publishedSeq, event->getDeviceId(), event->getSource(), event->getDisplayId(), event->getAction(), event->getFlags(), event->getKeyCode(), event->getScanCode(), event->getMetaState(), event->getRepeatCount(), event->getDownTime(), event->getEventTime()); status_t status = mInputPublisher.publishKeyEvent(publishedSeq, event->getDeviceId(), event->getSource(), event->getDisplayId(), event->getHmac(), event->getAction(), event->getFlags(), event->getKeyCode(), event->getScanCode(), event->getMetaState(), event->getRepeatCount(), event->getDownTime(), event->getEventTime()); if (status) { ALOGW("Failed to send key event on channel '%s'. status=%d", getInputChannelName().c_str(), status); Loading @@ -134,16 +137,23 @@ status_t NativeInputEventSender::sendMotionEvent(uint32_t seq, const MotionEvent uint32_t publishedSeq; for (size_t i = 0; i <= event->getHistorySize(); i++) { publishedSeq = mNextPublishedSeq++; status_t status = mInputPublisher.publishMotionEvent(publishedSeq, event->getDeviceId(), event->getSource(), event->getDisplayId(), event->getAction(), event->getActionButton(), event->getFlags(), event->getEdgeFlags(), event->getMetaState(), event->getButtonState(), event->getClassification(), event->getXOffset(), event->getYOffset(), event->getXPrecision(), event->getYPrecision(), event->getRawXCursorPosition(), event->getRawYCursorPosition(), event->getDownTime(), event->getHistoricalEventTime(i), event->getPointerCount(), event->getPointerProperties(), status_t status = mInputPublisher.publishMotionEvent(publishedSeq, event->getDeviceId(), event->getSource(), event->getDisplayId(), event->getHmac(), event->getAction(), event->getActionButton(), event->getFlags(), event->getEdgeFlags(), event->getMetaState(), event->getButtonState(), event->getClassification(), event->getXScale(), event->getYScale(), event->getXOffset(), event->getYOffset(), event->getXPrecision(), event->getYPrecision(), event->getRawXCursorPosition(), event->getRawYCursorPosition(), event->getDownTime(), event->getHistoricalEventTime(i), event->getPointerCount(), event->getPointerProperties(), event->getHistoricalRawPointerCoords(0, i)); if (status) { ALOGW("Failed to send motion event sample on channel '%s'. status=%d", Loading
core/jni/android_view_KeyEvent.cpp +62 −21 Original line number Diff line number Diff line Loading @@ -20,15 +20,53 @@ #include <android_runtime/AndroidRuntime.h> #include <android_runtime/Log.h> #include <utils/Log.h> #include <input/Input.h> #include <nativehelper/ScopedPrimitiveArray.h> #include <nativehelper/ScopedUtfChars.h> #include <utils/Log.h> #include <optional> #include "android_view_KeyEvent.h" #include "core_jni_helpers.h" namespace android { /** * Convert an std::array of bytes into a Java object. */ template <size_t N> static ScopedLocalRef<jbyteArray> toJbyteArray(JNIEnv* env, const std::array<uint8_t, N>& data) { ScopedLocalRef<jbyteArray> array(env, env->NewByteArray(N)); if (array.get() == nullptr) { jniThrowException(env, "java/lang/OutOfMemoryError", nullptr); return array; } static_assert(sizeof(char) == sizeof(uint8_t)); env->SetByteArrayRegion(array.get(), 0, N, reinterpret_cast<const signed char*>(data.data())); return array; } /** * Convert a Java object into an std::array of bytes of size N. * If the object is null, or the length is unexpected, return std::nullopt. */ template <size_t N> static std::optional<std::array<uint8_t, N>> fromJobject(JNIEnv* env, jobject object) { if (object == nullptr) { return std::nullopt; } jbyteArray javaArray = reinterpret_cast<jbyteArray>(object); ScopedByteArrayRO bytes(env, javaArray); if (bytes.size() != N) { ALOGE("Could not initialize array from java object, expected length %zu but got %zu", N, bytes.size()); return std::nullopt; } std::array<uint8_t, N> array; std::move(bytes.get(), bytes.get() + N, array.begin()); return array; } // ---------------------------------------------------------------------------- static struct { Loading @@ -40,6 +78,7 @@ static struct { jfieldID mDeviceId; jfieldID mSource; jfieldID mDisplayId; jfieldID mHmac; jfieldID mMetaState; jfieldID mAction; jfieldID mKeyCode; Loading @@ -54,20 +93,16 @@ static struct { // ---------------------------------------------------------------------------- jobject android_view_KeyEvent_fromNative(JNIEnv* env, const KeyEvent* event) { jobject eventObj = env->CallStaticObjectMethod(gKeyEventClassInfo.clazz, gKeyEventClassInfo.obtain, ScopedLocalRef<jbyteArray> hmac = toJbyteArray(env, event->getHmac()); jobject eventObj = env->CallStaticObjectMethod(gKeyEventClassInfo.clazz, gKeyEventClassInfo.obtain, nanoseconds_to_milliseconds(event->getDownTime()), nanoseconds_to_milliseconds(event->getEventTime()), event->getAction(), event->getKeyCode(), event->getRepeatCount(), event->getMetaState(), event->getDeviceId(), event->getScanCode(), event->getFlags(), event->getSource(), event->getDisplayId(), NULL); event->getAction(), event->getKeyCode(), event->getRepeatCount(), event->getMetaState(), event->getDeviceId(), event->getScanCode(), event->getFlags(), event->getSource(), event->getDisplayId(), hmac.get(), NULL); if (env->ExceptionCheck()) { ALOGE("An exception occurred while obtaining a key event."); LOGE_EX(env); Loading @@ -82,6 +117,11 @@ status_t android_view_KeyEvent_toNative(JNIEnv* env, jobject eventObj, jint deviceId = env->GetIntField(eventObj, gKeyEventClassInfo.mDeviceId); jint source = env->GetIntField(eventObj, gKeyEventClassInfo.mSource); jint displayId = env->GetIntField(eventObj, gKeyEventClassInfo.mDisplayId); jobject hmacObj = env->GetObjectField(eventObj, gKeyEventClassInfo.mHmac); std::optional<std::array<uint8_t, 32>> hmac = fromJobject<32>(env, hmacObj); if (!hmac) { hmac = INVALID_HMAC; } jint metaState = env->GetIntField(eventObj, gKeyEventClassInfo.mMetaState); jint action = env->GetIntField(eventObj, gKeyEventClassInfo.mAction); jint keyCode = env->GetIntField(eventObj, gKeyEventClassInfo.mKeyCode); Loading @@ -91,9 +131,8 @@ status_t android_view_KeyEvent_toNative(JNIEnv* env, jobject eventObj, jlong downTime = env->GetLongField(eventObj, gKeyEventClassInfo.mDownTime); jlong eventTime = env->GetLongField(eventObj, gKeyEventClassInfo.mEventTime); event->initialize(deviceId, source, displayId, action, flags, keyCode, scanCode, metaState, repeatCount, milliseconds_to_nanoseconds(downTime), event->initialize(deviceId, source, displayId, *hmac, action, flags, keyCode, scanCode, metaState, repeatCount, milliseconds_to_nanoseconds(downTime), milliseconds_to_nanoseconds(eventTime)); return OK; } Loading Loading @@ -134,8 +173,9 @@ int register_android_view_KeyEvent(JNIEnv* env) { jclass clazz = FindClassOrDie(env, "android/view/KeyEvent"); gKeyEventClassInfo.clazz = MakeGlobalRefOrDie(env, clazz); gKeyEventClassInfo.obtain = GetStaticMethodIDOrDie(env, gKeyEventClassInfo.clazz, "obtain", "(JJIIIIIIIIILjava/lang/String;)Landroid/view/KeyEvent;"); gKeyEventClassInfo.obtain = GetStaticMethodIDOrDie(env, gKeyEventClassInfo.clazz, "obtain", "(JJIIIIIIIII[BLjava/lang/String;)Landroid/view/KeyEvent;"); gKeyEventClassInfo.recycle = GetMethodIDOrDie(env, gKeyEventClassInfo.clazz, "recycle", "()V"); Loading @@ -143,6 +183,7 @@ int register_android_view_KeyEvent(JNIEnv* env) { gKeyEventClassInfo.mSource = GetFieldIDOrDie(env, gKeyEventClassInfo.clazz, "mSource", "I"); gKeyEventClassInfo.mDisplayId = GetFieldIDOrDie(env, gKeyEventClassInfo.clazz, "mDisplayId", "I"); gKeyEventClassInfo.mHmac = GetFieldIDOrDie(env, gKeyEventClassInfo.clazz, "mHmac", "[B"); gKeyEventClassInfo.mMetaState = GetFieldIDOrDie(env, gKeyEventClassInfo.clazz, "mMetaState", "I"); gKeyEventClassInfo.mAction = GetFieldIDOrDie(env, gKeyEventClassInfo.clazz, "mAction", "I"); Loading
core/jni/android_view_KeyEvent.h +1 −1 Original line number Diff line number Diff line Loading @@ -42,4 +42,4 @@ extern status_t android_view_KeyEvent_recycle(JNIEnv* env, jobject eventObj); } // namespace android #endif // _ANDROID_OS_KEYEVENT_H #endif // _ANDROID_VIEW_KEYEVENT_H
core/jni/android_view_MotionEvent.cpp +82 −162 Original line number Diff line number Diff line Loading @@ -330,14 +330,12 @@ 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 classification, jfloat xOffset, jfloat yOffset, jfloat xPrecision, jfloat yPrecision, jlong downTimeNanos, jlong eventTimeNanos, jint pointerCount, jobjectArray pointerPropertiesObjArray, jobjectArray pointerCoordsObjArray) { 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 classification, jfloat xOffset, jfloat yOffset, jfloat xPrecision, jfloat yPrecision, jlong downTimeNanos, jlong eventTimeNanos, jint pointerCount, jobjectArray pointerPropertiesObjArray, jobjectArray pointerCoordsObjArray) { if (!validatePointerCount(env, pointerCount) || !validatePointerPropertiesArray(env, pointerPropertiesObjArray, pointerCount) || !validatePointerCoordsObjArray(env, pointerCoordsObjArray, pointerCount)) { Loading Loading @@ -371,11 +369,12 @@ static jlong android_view_MotionEvent_nativeInitialize(JNIEnv* env, jclass clazz env->DeleteLocalRef(pointerCoordsObj); } event->initialize(deviceId, source, displayId, action, 0, flags, edgeFlags, metaState, buttonState, static_cast<MotionClassification>(classification), xOffset, yOffset, xPrecision, yPrecision, event->initialize(deviceId, source, displayId, INVALID_HMAC, action, 0, flags, edgeFlags, metaState, buttonState, static_cast<MotionClassification>(classification), 1 /*xScale*/, 1 /*yScale*/, xOffset, yOffset, xPrecision, yPrecision, AMOTION_EVENT_INVALID_CURSOR_POSITION, AMOTION_EVENT_INVALID_CURSOR_POSITION, downTimeNanos, eventTimeNanos, pointerCount, pointerProperties, rawPointerCoords); downTimeNanos, eventTimeNanos, pointerCount, pointerProperties, rawPointerCoords); return reinterpret_cast<jlong>(event); Loading Loading @@ -762,150 +761,71 @@ static const JNINativeMethod gMotionEventMethods[] = { "(JIIIIIIIIIFFFFJJI[Landroid/view/MotionEvent$PointerProperties;" "[Landroid/view/MotionEvent$PointerCoords;)J", (void*)android_view_MotionEvent_nativeInitialize}, { "nativeDispose", "(J)V", (void*)android_view_MotionEvent_nativeDispose }, { "nativeAddBatch", "(JJ[Landroid/view/MotionEvent$PointerCoords;I)V", {"nativeDispose", "(J)V", (void*)android_view_MotionEvent_nativeDispose}, {"nativeAddBatch", "(JJ[Landroid/view/MotionEvent$PointerCoords;I)V", (void*)android_view_MotionEvent_nativeAddBatch}, { "nativeReadFromParcel", "(JLandroid/os/Parcel;)J", {"nativeReadFromParcel", "(JLandroid/os/Parcel;)J", (void*)android_view_MotionEvent_nativeReadFromParcel}, { "nativeWriteToParcel", "(JLandroid/os/Parcel;)V", {"nativeWriteToParcel", "(JLandroid/os/Parcel;)V", (void*)android_view_MotionEvent_nativeWriteToParcel}, {"nativeAxisToString", "(I)Ljava/lang/String;", (void*)android_view_MotionEvent_nativeAxisToString}, {"nativeAxisFromString", "(Ljava/lang/String;)I", (void*)android_view_MotionEvent_nativeAxisFromString}, { "nativeGetPointerProperties", "(JILandroid/view/MotionEvent$PointerProperties;)V", {"nativeGetPointerProperties", "(JILandroid/view/MotionEvent$PointerProperties;)V", (void*)android_view_MotionEvent_nativeGetPointerProperties}, { "nativeGetPointerCoords", "(JIILandroid/view/MotionEvent$PointerCoords;)V", {"nativeGetPointerCoords", "(JIILandroid/view/MotionEvent$PointerCoords;)V", (void*)android_view_MotionEvent_nativeGetPointerCoords}, // --------------- @FastNative ---------------------- { "nativeGetPointerId", "(JI)I", (void*)android_view_MotionEvent_nativeGetPointerId }, { "nativeGetToolType", "(JI)I", (void*)android_view_MotionEvent_nativeGetToolType }, { "nativeGetEventTimeNanos", "(JI)J", {"nativeGetPointerId", "(JI)I", (void*)android_view_MotionEvent_nativeGetPointerId}, {"nativeGetToolType", "(JI)I", (void*)android_view_MotionEvent_nativeGetToolType}, {"nativeGetEventTimeNanos", "(JI)J", (void*)android_view_MotionEvent_nativeGetEventTimeNanos}, { "nativeGetRawAxisValue", "(JIII)F", (void*)android_view_MotionEvent_nativeGetRawAxisValue }, { "nativeGetAxisValue", "(JIII)F", (void*)android_view_MotionEvent_nativeGetAxisValue }, { "nativeTransform", "(JLandroid/graphics/Matrix;)V", {"nativeGetRawAxisValue", "(JIII)F", (void*)android_view_MotionEvent_nativeGetRawAxisValue}, {"nativeGetAxisValue", "(JIII)F", (void*)android_view_MotionEvent_nativeGetAxisValue}, {"nativeTransform", "(JLandroid/graphics/Matrix;)V", (void*)android_view_MotionEvent_nativeTransform}, // --------------- @CriticalNative ------------------ { "nativeCopy", "(JJZ)J", (void*)android_view_MotionEvent_nativeCopy }, { "nativeGetDeviceId", "(J)I", (void*)android_view_MotionEvent_nativeGetDeviceId }, { "nativeGetSource", "(J)I", (void*)android_view_MotionEvent_nativeGetSource }, { "nativeSetSource", "(JI)V", (void*)android_view_MotionEvent_nativeSetSource }, { "nativeGetDisplayId", "(J)I", (void*)android_view_MotionEvent_nativeGetDisplayId }, { "nativeSetDisplayId", "(JI)V", (void*)android_view_MotionEvent_nativeSetDisplayId }, { "nativeGetAction", "(J)I", (void*)android_view_MotionEvent_nativeGetAction }, { "nativeSetAction", "(JI)V", (void*)android_view_MotionEvent_nativeSetAction }, { "nativeGetActionButton", "(J)I", (void*)android_view_MotionEvent_nativeGetActionButton}, { "nativeSetActionButton", "(JI)V", (void*)android_view_MotionEvent_nativeSetActionButton}, { "nativeIsTouchEvent", "(J)Z", (void*)android_view_MotionEvent_nativeIsTouchEvent }, { "nativeGetFlags", "(J)I", (void*)android_view_MotionEvent_nativeGetFlags }, { "nativeSetFlags", "(JI)V", (void*)android_view_MotionEvent_nativeSetFlags }, { "nativeGetEdgeFlags", "(J)I", (void*)android_view_MotionEvent_nativeGetEdgeFlags }, { "nativeSetEdgeFlags", "(JI)V", (void*)android_view_MotionEvent_nativeSetEdgeFlags }, { "nativeGetMetaState", "(J)I", (void*)android_view_MotionEvent_nativeGetMetaState }, { "nativeGetButtonState", "(J)I", (void*)android_view_MotionEvent_nativeGetButtonState }, { "nativeSetButtonState", "(JI)V", (void*)android_view_MotionEvent_nativeSetButtonState }, { "nativeGetClassification", "(J)I", {"nativeCopy", "(JJZ)J", (void*)android_view_MotionEvent_nativeCopy}, {"nativeGetDeviceId", "(J)I", (void*)android_view_MotionEvent_nativeGetDeviceId}, {"nativeGetSource", "(J)I", (void*)android_view_MotionEvent_nativeGetSource}, {"nativeSetSource", "(JI)V", (void*)android_view_MotionEvent_nativeSetSource}, {"nativeGetDisplayId", "(J)I", (void*)android_view_MotionEvent_nativeGetDisplayId}, {"nativeSetDisplayId", "(JI)V", (void*)android_view_MotionEvent_nativeSetDisplayId}, {"nativeGetAction", "(J)I", (void*)android_view_MotionEvent_nativeGetAction}, {"nativeSetAction", "(JI)V", (void*)android_view_MotionEvent_nativeSetAction}, {"nativeGetActionButton", "(J)I", (void*)android_view_MotionEvent_nativeGetActionButton}, {"nativeSetActionButton", "(JI)V", (void*)android_view_MotionEvent_nativeSetActionButton}, {"nativeIsTouchEvent", "(J)Z", (void*)android_view_MotionEvent_nativeIsTouchEvent}, {"nativeGetFlags", "(J)I", (void*)android_view_MotionEvent_nativeGetFlags}, {"nativeSetFlags", "(JI)V", (void*)android_view_MotionEvent_nativeSetFlags}, {"nativeGetEdgeFlags", "(J)I", (void*)android_view_MotionEvent_nativeGetEdgeFlags}, {"nativeSetEdgeFlags", "(JI)V", (void*)android_view_MotionEvent_nativeSetEdgeFlags}, {"nativeGetMetaState", "(J)I", (void*)android_view_MotionEvent_nativeGetMetaState}, {"nativeGetButtonState", "(J)I", (void*)android_view_MotionEvent_nativeGetButtonState}, {"nativeSetButtonState", "(JI)V", (void*)android_view_MotionEvent_nativeSetButtonState}, {"nativeGetClassification", "(J)I", (void*)android_view_MotionEvent_nativeGetClassification}, { "nativeOffsetLocation", "(JFF)V", (void*)android_view_MotionEvent_nativeOffsetLocation }, { "nativeGetXOffset", "(J)F", (void*)android_view_MotionEvent_nativeGetXOffset }, { "nativeGetYOffset", "(J)F", (void*)android_view_MotionEvent_nativeGetYOffset }, { "nativeGetXPrecision", "(J)F", (void*)android_view_MotionEvent_nativeGetXPrecision }, { "nativeGetYPrecision", "(J)F", (void*)android_view_MotionEvent_nativeGetYPrecision }, { "nativeGetXCursorPosition", "(J)F", {"nativeOffsetLocation", "(JFF)V", (void*)android_view_MotionEvent_nativeOffsetLocation}, {"nativeGetXOffset", "(J)F", (void*)android_view_MotionEvent_nativeGetXOffset}, {"nativeGetYOffset", "(J)F", (void*)android_view_MotionEvent_nativeGetYOffset}, {"nativeGetXPrecision", "(J)F", (void*)android_view_MotionEvent_nativeGetXPrecision}, {"nativeGetYPrecision", "(J)F", (void*)android_view_MotionEvent_nativeGetYPrecision}, {"nativeGetXCursorPosition", "(J)F", (void*)android_view_MotionEvent_nativeGetXCursorPosition}, { "nativeGetYCursorPosition", "(J)F", {"nativeGetYCursorPosition", "(J)F", (void*)android_view_MotionEvent_nativeGetYCursorPosition}, { "nativeSetCursorPosition", "(JFF)V", {"nativeSetCursorPosition", "(JFF)V", (void*)android_view_MotionEvent_nativeSetCursorPosition}, { "nativeGetDownTimeNanos", "(J)J", (void*)android_view_MotionEvent_nativeGetDownTimeNanos }, { "nativeSetDownTimeNanos", "(JJ)V", (void*)android_view_MotionEvent_nativeSetDownTimeNanos }, { "nativeGetPointerCount", "(J)I", (void*)android_view_MotionEvent_nativeGetPointerCount }, { "nativeFindPointerIndex", "(JI)I", (void*)android_view_MotionEvent_nativeFindPointerIndex }, { "nativeGetHistorySize", "(J)I", (void*)android_view_MotionEvent_nativeGetHistorySize }, { "nativeScale", "(JF)V", (void*)android_view_MotionEvent_nativeScale }, {"nativeGetDownTimeNanos", "(J)J", (void*)android_view_MotionEvent_nativeGetDownTimeNanos}, {"nativeSetDownTimeNanos", "(JJ)V", (void*)android_view_MotionEvent_nativeSetDownTimeNanos}, {"nativeGetPointerCount", "(J)I", (void*)android_view_MotionEvent_nativeGetPointerCount}, {"nativeFindPointerIndex", "(JI)I", (void*)android_view_MotionEvent_nativeFindPointerIndex}, {"nativeGetHistorySize", "(J)I", (void*)android_view_MotionEvent_nativeGetHistorySize}, {"nativeScale", "(JF)V", (void*)android_view_MotionEvent_nativeScale}, }; int register_android_view_MotionEvent(JNIEnv* env) { Loading