Loading core/java/android/view/MotionEvent.java +9 −0 Original line number Diff line number Diff line Loading @@ -4233,6 +4233,13 @@ public final class MotionEvent extends InputEvent implements Parcelable { */ public float relativeY; /** * Whether these coordinate data were generated by resampling. * * @hide */ public boolean isResampled; /** * Clears the contents of this object. * Resets all axes to zero. Loading @@ -4251,6 +4258,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { orientation = 0; relativeX = 0; relativeY = 0; isResampled = false; } /** Loading Loading @@ -4283,6 +4291,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { orientation = other.orientation; relativeX = other.relativeX; relativeY = other.relativeY; isResampled = other.isResampled; } /** Loading core/jni/android_view_MotionEvent.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ static struct { jfieldID orientation; jfieldID relativeX; jfieldID relativeY; jfieldID isResampled; } gPointerCoordsClassInfo; static struct { Loading Loading @@ -223,6 +224,8 @@ static void pointerCoordsToNative(JNIEnv* env, jobject pointerCoordsObj, outRawPointerCoords->setAxisValue(AMOTION_EVENT_AXIS_RELATIVE_Y, env->GetFloatField(pointerCoordsObj, gPointerCoordsClassInfo.relativeY)); outRawPointerCoords->isResampled = env->GetBooleanField(pointerCoordsObj, gPointerCoordsClassInfo.isResampled); BitSet64 bits = BitSet64(env->GetLongField(pointerCoordsObj, gPointerCoordsClassInfo.mPackedAxisBits)); Loading Loading @@ -440,6 +443,11 @@ static void android_view_MotionEvent_nativeGetPointerCoords(JNIEnv* env, jclass bits.clearBit(axis); } pointerCoordsFromNative(env, rawPointerCoords, bits, outPointerCoordsObj); const bool isResampled = historyPos == HISTORY_CURRENT ? event->isResampled(pointerIndex, event->getHistorySize()) : event->isResampled(pointerIndex, historyPos); env->SetBooleanField(outPointerCoordsObj, gPointerCoordsClassInfo.isResampled, isResampled); } static void android_view_MotionEvent_nativeGetPointerProperties(JNIEnv* env, jclass clazz, Loading Loading @@ -881,6 +889,7 @@ int register_android_view_MotionEvent(JNIEnv* env) { gPointerCoordsClassInfo.orientation = GetFieldIDOrDie(env, clazz, "orientation", "F"); gPointerCoordsClassInfo.relativeX = GetFieldIDOrDie(env, clazz, "relativeX", "F"); gPointerCoordsClassInfo.relativeY = GetFieldIDOrDie(env, clazz, "relativeY", "F"); gPointerCoordsClassInfo.isResampled = GetFieldIDOrDie(env, clazz, "isResampled", "Z"); clazz = FindClassOrDie(env, "android/view/MotionEvent$PointerProperties"); Loading Loading
core/java/android/view/MotionEvent.java +9 −0 Original line number Diff line number Diff line Loading @@ -4233,6 +4233,13 @@ public final class MotionEvent extends InputEvent implements Parcelable { */ public float relativeY; /** * Whether these coordinate data were generated by resampling. * * @hide */ public boolean isResampled; /** * Clears the contents of this object. * Resets all axes to zero. Loading @@ -4251,6 +4258,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { orientation = 0; relativeX = 0; relativeY = 0; isResampled = false; } /** Loading Loading @@ -4283,6 +4291,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { orientation = other.orientation; relativeX = other.relativeX; relativeY = other.relativeY; isResampled = other.isResampled; } /** Loading
core/jni/android_view_MotionEvent.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ static struct { jfieldID orientation; jfieldID relativeX; jfieldID relativeY; jfieldID isResampled; } gPointerCoordsClassInfo; static struct { Loading Loading @@ -223,6 +224,8 @@ static void pointerCoordsToNative(JNIEnv* env, jobject pointerCoordsObj, outRawPointerCoords->setAxisValue(AMOTION_EVENT_AXIS_RELATIVE_Y, env->GetFloatField(pointerCoordsObj, gPointerCoordsClassInfo.relativeY)); outRawPointerCoords->isResampled = env->GetBooleanField(pointerCoordsObj, gPointerCoordsClassInfo.isResampled); BitSet64 bits = BitSet64(env->GetLongField(pointerCoordsObj, gPointerCoordsClassInfo.mPackedAxisBits)); Loading Loading @@ -440,6 +443,11 @@ static void android_view_MotionEvent_nativeGetPointerCoords(JNIEnv* env, jclass bits.clearBit(axis); } pointerCoordsFromNative(env, rawPointerCoords, bits, outPointerCoordsObj); const bool isResampled = historyPos == HISTORY_CURRENT ? event->isResampled(pointerIndex, event->getHistorySize()) : event->isResampled(pointerIndex, historyPos); env->SetBooleanField(outPointerCoordsObj, gPointerCoordsClassInfo.isResampled, isResampled); } static void android_view_MotionEvent_nativeGetPointerProperties(JNIEnv* env, jclass clazz, Loading Loading @@ -881,6 +889,7 @@ int register_android_view_MotionEvent(JNIEnv* env) { gPointerCoordsClassInfo.orientation = GetFieldIDOrDie(env, clazz, "orientation", "F"); gPointerCoordsClassInfo.relativeX = GetFieldIDOrDie(env, clazz, "relativeX", "F"); gPointerCoordsClassInfo.relativeY = GetFieldIDOrDie(env, clazz, "relativeY", "F"); gPointerCoordsClassInfo.isResampled = GetFieldIDOrDie(env, clazz, "isResampled", "Z"); clazz = FindClassOrDie(env, "android/view/MotionEvent$PointerProperties"); Loading