diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/view/InputDevice.java | 23 | ||||
-rw-r--r-- | core/jni/android_view_InputDevice.cpp | 6 |
2 files changed, 21 insertions, 8 deletions
diff --git a/core/java/android/view/InputDevice.java b/core/java/android/view/InputDevice.java index dd523d2..2595ee5 100644 --- a/core/java/android/view/InputDevice.java +++ b/core/java/android/view/InputDevice.java @@ -371,8 +371,8 @@ public final class InputDevice implements Parcelable { if (axis < 0) { break; } - addMotionRange(axis, in.readInt(), - in.readFloat(), in.readFloat(), in.readFloat(), in.readFloat()); + addMotionRange(axis, in.readInt(), in.readFloat(), in.readFloat(), in.readFloat(), + in.readFloat(), in.readFloat()); } } @@ -584,8 +584,8 @@ public final class InputDevice implements Parcelable { // Called from native code. private void addMotionRange(int axis, int source, - float min, float max, float flat, float fuzz) { - mMotionRanges.add(new MotionRange(axis, source, min, max, flat, fuzz)); + float min, float max, float flat, float fuzz, float resolution) { + mMotionRanges.add(new MotionRange(axis, source, min, max, flat, fuzz, resolution)); } /** @@ -625,14 +625,17 @@ public final class InputDevice implements Parcelable { private float mMax; private float mFlat; private float mFuzz; + private float mResolution; - private MotionRange(int axis, int source, float min, float max, float flat, float fuzz) { + private MotionRange(int axis, int source, float min, float max, float flat, float fuzz, + float resolution) { mAxis = axis; mSource = source; mMin = min; mMax = max; mFlat = flat; mFuzz = fuzz; + mResolution = resolution; } /** @@ -711,6 +714,14 @@ public final class InputDevice implements Parcelable { public float getFuzz() { return mFuzz; } + + /** + * Gets the resolution for input device measurements with respect to this axis. + * @return The resolution in units per millimeter, or units per radian for rotational axes. + */ + public float getResolution() { + return mResolution; + } } @Override @@ -734,6 +745,7 @@ public final class InputDevice implements Parcelable { out.writeFloat(range.mMax); out.writeFloat(range.mFlat); out.writeFloat(range.mFuzz); + out.writeFloat(range.mResolution); } out.writeInt(-1); } @@ -788,6 +800,7 @@ public final class InputDevice implements Parcelable { description.append(" max=").append(range.mMax); description.append(" flat=").append(range.mFlat); description.append(" fuzz=").append(range.mFuzz); + description.append(" resolution=").append(range.mResolution); description.append("\n"); } return description.toString(); diff --git a/core/jni/android_view_InputDevice.cpp b/core/jni/android_view_InputDevice.cpp index 576f831..e3a54a8 100644 --- a/core/jni/android_view_InputDevice.cpp +++ b/core/jni/android_view_InputDevice.cpp @@ -62,8 +62,8 @@ jobject android_view_InputDevice_create(JNIEnv* env, const InputDeviceInfo& devi const Vector<InputDeviceInfo::MotionRange>& ranges = deviceInfo.getMotionRanges(); for (size_t i = 0; i < ranges.size(); i++) { const InputDeviceInfo::MotionRange& range = ranges.itemAt(i); - env->CallVoidMethod(inputDeviceObj.get(), gInputDeviceClassInfo.addMotionRange, - range.axis, range.source, range.min, range.max, range.flat, range.fuzz); + env->CallVoidMethod(inputDeviceObj.get(), gInputDeviceClassInfo.addMotionRange, range.axis, + range.source, range.min, range.max, range.flat, range.fuzz, range.resolution); if (env->ExceptionCheck()) { return NULL; } @@ -90,7 +90,7 @@ int register_android_view_InputDevice(JNIEnv* env) "<init>", "(IILjava/lang/String;Ljava/lang/String;ZIILandroid/view/KeyCharacterMap;Z)V"); GET_METHOD_ID(gInputDeviceClassInfo.addMotionRange, gInputDeviceClassInfo.clazz, - "addMotionRange", "(IIFFFF)V"); + "addMotionRange", "(IIFFFFF)V"); return 0; } |