Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8775af63 authored by Michael Wright's avatar Michael Wright Committed by Android Git Automerger
Browse files

am aaddfacf: am bdb706e4: Merge "Pipe through device resolution information" into jb-mr2-dev

* commit 'aaddfacf':
  Pipe through device resolution information
parents 6adbb903 aaddfacf
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -24528,6 +24528,7 @@ package android.view {
    method public float getMax();
    method public float getMin();
    method public float getRange();
    method public float getResolution();
    method public int getSource();
    method public boolean isFromSource(int);
  }
+18 −5
Original line number Diff line number Diff line
@@ -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();
+3 −3
Original line number Diff line number Diff line
@@ -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;
}
+2 −1
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ public:
        float max;
        float flat;
        float fuzz;
        float resolution;
    };

    void initialize(int32_t id, int32_t generation, const InputDeviceIdentifier& identifier,
@@ -83,7 +84,7 @@ public:

    void addSource(uint32_t source);
    void addMotionRange(int32_t axis, uint32_t source,
            float min, float max, float flat, float fuzz);
            float min, float max, float flat, float fuzz, float resolution);
    void addMotionRange(const MotionRange& range);

    inline void setKeyboardType(int32_t keyboardType) { mKeyboardType = keyboardType; }
+2 −2
Original line number Diff line number Diff line
@@ -172,8 +172,8 @@ void InputDeviceInfo::addSource(uint32_t source) {
}

void InputDeviceInfo::addMotionRange(int32_t axis, uint32_t source, float min, float max,
        float flat, float fuzz) {
    MotionRange range = { axis, source, min, max, flat, fuzz };
        float flat, float fuzz, float resolution) {
    MotionRange range = { axis, source, min, max, flat, fuzz, resolution };
    mMotionRanges.add(range);
}

Loading