diff options
| author | Michael Wright <michaelwr@google.com> | 2015-06-23 12:48:52 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-23 12:48:56 +0000 |
| commit | 805fc82ea9c12aba53af4ebda6ea3f8a349201ac (patch) | |
| tree | 3144f5f6b897c0c24930068819166c383a7f36c8 | |
| parent | 121197326cca17b65d14ca1454e1bcbd0340061a (diff) | |
| parent | 6b819b4147af4ec14ec08c50f83bb42f44481917 (diff) | |
| download | frameworks_base-805fc82ea9c12aba53af4ebda6ea3f8a349201ac.zip frameworks_base-805fc82ea9c12aba53af4ebda6ea3f8a349201ac.tar.gz frameworks_base-805fc82ea9c12aba53af4ebda6ea3f8a349201ac.tar.bz2 | |
Merge "Add method to set action button on MotionEvent" into mnc-dev
| -rw-r--r-- | core/java/android/view/MotionEvent.java | 11 | ||||
| -rw-r--r-- | core/jni/android_view_MotionEvent.cpp | 9 |
2 files changed, 20 insertions, 0 deletions
diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java index 4394cd8..6026d04 100644 --- a/core/java/android/view/MotionEvent.java +++ b/core/java/android/view/MotionEvent.java @@ -1399,6 +1399,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { private static native int nativeGetButtonState(long nativePtr); private static native void nativeSetButtonState(long nativePtr, int buttonState); private static native int nativeGetActionButton(long nativePtr); + private static native void nativeSetActionButton(long nativePtr, int actionButton); private static native void nativeOffsetLocation(long nativePtr, float deltaX, float deltaY); private static native float nativeGetXOffset(long nativePtr); private static native float nativeGetYOffset(long nativePtr); @@ -2284,6 +2285,16 @@ public final class MotionEvent extends InputEvent implements Parcelable { } /** + * Sets the action button for the event. + * + * @see #getActionButton() + * @hide + */ + public final void setActionButton(int button) { + nativeSetActionButton(mNativePtr, button); + } + + /** * Returns the original raw X coordinate of this event. For touch * events on the screen, this is the original location of the event * on the screen, before it had been adjusted for the containing window diff --git a/core/jni/android_view_MotionEvent.cpp b/core/jni/android_view_MotionEvent.cpp index eb28c4d..98c17c0 100644 --- a/core/jni/android_view_MotionEvent.cpp +++ b/core/jni/android_view_MotionEvent.cpp @@ -462,6 +462,12 @@ static int android_view_MotionEvent_nativeGetActionButton(JNIEnv* env, jclass cl return event->getActionButton(); } +static void android_view_MotionEvent_nativeSetActionButton(JNIEnv* env, jclass clazz, + jlong nativePtr, jint button) { + MotionEvent* event = reinterpret_cast<MotionEvent*>(nativePtr); + event->setActionButton(button); +} + static jboolean android_view_MotionEvent_nativeIsTouchEvent(JNIEnv* env, jclass clazz, jlong nativePtr) { MotionEvent* event = reinterpret_cast<MotionEvent*>(nativePtr); @@ -779,6 +785,9 @@ static JNINativeMethod gMotionEventMethods[] = { { "nativeGetActionButton", "(J)I", (void*)android_view_MotionEvent_nativeGetActionButton}, + { "nativeSetActionButton", + "(JI)V", + (void*)android_view_MotionEvent_nativeSetActionButton}, { "nativeIsTouchEvent", "(J)Z", (void*)android_view_MotionEvent_nativeIsTouchEvent }, |
