diff options
author | Michael Wright <michaelwr@google.com> | 2015-05-14 15:31:10 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-05-14 15:31:14 +0000 |
commit | 1b2e5c11b6a89d56d5058907c3b0c88bf0170857 (patch) | |
tree | 99faee0bd39591ea6006dec81c99965c1069a3ea /core/jni | |
parent | 39b8c69a2356b03b56c7f11385a35bef58d2fceb (diff) | |
parent | 5bd69e6e6164c59a0423edd0d5243fc8c07e6af3 (diff) | |
download | frameworks_base-1b2e5c11b6a89d56d5058907c3b0c88bf0170857.zip frameworks_base-1b2e5c11b6a89d56d5058907c3b0c88bf0170857.tar.gz frameworks_base-1b2e5c11b6a89d56d5058907c3b0c88bf0170857.tar.bz2 |
Merge "Revert "Revert "Add new MotionEvent actions for button press and release.""" into mnc-dev
Diffstat (limited to 'core/jni')
-rw-r--r-- | core/jni/android_view_InputEventSender.cpp | 3 | ||||
-rw-r--r-- | core/jni/android_view_MotionEvent.cpp | 20 |
2 files changed, 21 insertions, 2 deletions
diff --git a/core/jni/android_view_InputEventSender.cpp b/core/jni/android_view_InputEventSender.cpp index 265daeb..d61dee7 100644 --- a/core/jni/android_view_InputEventSender.cpp +++ b/core/jni/android_view_InputEventSender.cpp @@ -135,7 +135,8 @@ status_t NativeInputEventSender::sendMotionEvent(uint32_t seq, const MotionEvent for (size_t i = 0; i <= event->getHistorySize(); i++) { publishedSeq = mNextPublishedSeq++; status_t status = mInputPublisher.publishMotionEvent(publishedSeq, - event->getDeviceId(), event->getSource(), event->getAction(), event->getFlags(), + event->getDeviceId(), event->getSource(), + event->getAction(), event->getActionButton(), event->getFlags(), event->getEdgeFlags(), event->getMetaState(), event->getButtonState(), event->getXOffset(), event->getYOffset(), event->getXPrecision(), event->getYPrecision(), diff --git a/core/jni/android_view_MotionEvent.cpp b/core/jni/android_view_MotionEvent.cpp index e622768..1f28643 100644 --- a/core/jni/android_view_MotionEvent.cpp +++ b/core/jni/android_view_MotionEvent.cpp @@ -370,7 +370,7 @@ static jlong android_view_MotionEvent_nativeInitialize(JNIEnv* env, jclass clazz env->DeleteLocalRef(pointerCoordsObj); } - event->initialize(deviceId, source, action, flags, edgeFlags, metaState, buttonState, + event->initialize(deviceId, source, action, flags, edgeFlags, metaState, buttonState, 0, xOffset, yOffset, xPrecision, yPrecision, downTimeNanos, eventTimeNanos, pointerCount, pointerProperties, rawPointerCoords); @@ -456,6 +456,12 @@ static void android_view_MotionEvent_nativeSetAction(JNIEnv* env, jclass clazz, event->setAction(action); } +static int android_view_MotionEvent_nativeGetActionButton(JNIEnv* env, jclass clazz, + jlong nativePtr) { + MotionEvent* event = reinterpret_cast<MotionEvent*>(nativePtr); + return event->getActionButton(); +} + static jboolean android_view_MotionEvent_nativeIsTouchEvent(JNIEnv* env, jclass clazz, jlong nativePtr) { MotionEvent* event = reinterpret_cast<MotionEvent*>(nativePtr); @@ -498,6 +504,12 @@ static jint android_view_MotionEvent_nativeGetButtonState(JNIEnv* env, jclass cl return event->getButtonState(); } +static void android_view_MotionEvent_nativeSetButtonState(JNIEnv* env, jclass clazz, + jlong nativePtr, jint buttonState) { + MotionEvent* event = reinterpret_cast<MotionEvent*>(nativePtr); + event->setButtonState(buttonState); +} + static void android_view_MotionEvent_nativeOffsetLocation(JNIEnv* env, jclass clazz, jlong nativePtr, jfloat deltaX, jfloat deltaY) { MotionEvent* event = reinterpret_cast<MotionEvent*>(nativePtr); @@ -764,6 +776,9 @@ static JNINativeMethod gMotionEventMethods[] = { { "nativeSetAction", "(JI)V", (void*)android_view_MotionEvent_nativeSetAction }, + { "nativeGetActionButton", + "(J)I", + (void*)android_view_MotionEvent_nativeGetActionButton}, { "nativeIsTouchEvent", "(J)Z", (void*)android_view_MotionEvent_nativeIsTouchEvent }, @@ -785,6 +800,9 @@ static JNINativeMethod gMotionEventMethods[] = { { "nativeGetButtonState", "(J)I", (void*)android_view_MotionEvent_nativeGetButtonState }, + { "nativeSetButtonState", + "(JI)V", + (void*)android_view_MotionEvent_nativeSetButtonState }, { "nativeOffsetLocation", "(JFF)V", (void*)android_view_MotionEvent_nativeOffsetLocation }, |