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

Commit 5197d17b authored by Jeff Brown's avatar Jeff Brown Committed by Android Git Automerger
Browse files

am c5ed5910: Add support for new input sources.

Merge commit 'c5ed5910c9ef066cec6a13bbb404ec57b1e92637' into gingerbread-plus-aosp

* commit 'c5ed5910c9ef066cec6a13bbb404ec57b1e92637':
  Add support for new input sources.
parents e2798f27 5c1ed84a
Loading
Loading
Loading
Loading
+26 −0
Original line number Original line Diff line number Diff line
@@ -59,6 +59,32 @@ namespace android {


class KeyLayoutMap;
class KeyLayoutMap;


/*
 * Input device classes.
 */
enum {
    /* The input device is a keyboard. */
    INPUT_DEVICE_CLASS_KEYBOARD      = 0x00000001,

    /* The input device is an alpha-numeric keyboard (not just a dial pad). */
    INPUT_DEVICE_CLASS_ALPHAKEY      = 0x00000002,

    /* The input device is a touchscreen (either single-touch or multi-touch). */
    INPUT_DEVICE_CLASS_TOUCHSCREEN   = 0x00000004,

    /* The input device is a trackball. */
    INPUT_DEVICE_CLASS_TRACKBALL     = 0x00000008,

    /* The input device is a multi-touch touchscreen. */
    INPUT_DEVICE_CLASS_TOUCHSCREEN_MT= 0x00000010,

    /* The input device is a directional pad. */
    INPUT_DEVICE_CLASS_DPAD          = 0x00000020,

    /* The input device is a gamepad (implies keyboard). */
    INPUT_DEVICE_CLASS_GAMEPAD       = 0x00000040
};

/*
/*
 * Grand Central Station for events.
 * Grand Central Station for events.
 *
 *
+53 −8
Original line number Original line Diff line number Diff line
@@ -32,7 +32,7 @@ enum {
    /*
    /*
     * Private control to determine when an app is tracking a key sequence.
     * Private control to determine when an app is tracking a key sequence.
     */
     */
    KEY_EVENT_FLAG_START_TRACKING = 0x40000000
    AKEY_EVENT_FLAG_START_TRACKING = 0x40000000
};
};


/*
/*
@@ -130,6 +130,11 @@ struct PointerCoords {
    float y;
    float y;
    float pressure;
    float pressure;
    float size;
    float size;
    float touchMajor;
    float touchMinor;
    float toolMajor;
    float toolMinor;
    float orientation;
};
};


/*
/*
@@ -143,14 +148,14 @@ public:


    inline int32_t getDeviceId() const { return mDeviceId; }
    inline int32_t getDeviceId() const { return mDeviceId; }


    inline int32_t getNature() const { return mNature; }
    inline int32_t getSource() const { return mSource; }
    
    
protected:
protected:
    void initialize(int32_t deviceId, int32_t nature);
    void initialize(int32_t deviceId, int32_t source);


private:
private:
    int32_t mDeviceId;
    int32_t mDeviceId;
    int32_t mNature;
    int32_t mSource;
};
};


/*
/*
@@ -160,7 +165,7 @@ class KeyEvent : public InputEvent {
public:
public:
    virtual ~KeyEvent() { }
    virtual ~KeyEvent() { }


    virtual int32_t getType() const { return INPUT_EVENT_TYPE_KEY; }
    virtual int32_t getType() const { return AINPUT_EVENT_TYPE_KEY; }


    inline int32_t getAction() const { return mAction; }
    inline int32_t getAction() const { return mAction; }


@@ -188,7 +193,7 @@ public:
    
    
    void initialize(
    void initialize(
            int32_t deviceId,
            int32_t deviceId,
            int32_t nature,
            int32_t source,
            int32_t action,
            int32_t action,
            int32_t flags,
            int32_t flags,
            int32_t keyCode,
            int32_t keyCode,
@@ -216,7 +221,7 @@ class MotionEvent : public InputEvent {
public:
public:
    virtual ~MotionEvent() { }
    virtual ~MotionEvent() { }


    virtual int32_t getType() const { return INPUT_EVENT_TYPE_MOTION; }
    virtual int32_t getType() const { return AINPUT_EVENT_TYPE_MOTION; }


    inline int32_t getAction() const { return mAction; }
    inline int32_t getAction() const { return mAction; }


@@ -264,6 +269,26 @@ public:
        return getCurrentPointerCoords(pointerIndex).size;
        return getCurrentPointerCoords(pointerIndex).size;
    }
    }


    inline float getTouchMajor(size_t pointerIndex) const {
        return getCurrentPointerCoords(pointerIndex).touchMajor;
    }

    inline float getTouchMinor(size_t pointerIndex) const {
        return getCurrentPointerCoords(pointerIndex).touchMinor;
    }

    inline float getToolMajor(size_t pointerIndex) const {
        return getCurrentPointerCoords(pointerIndex).toolMajor;
    }

    inline float getToolMinor(size_t pointerIndex) const {
        return getCurrentPointerCoords(pointerIndex).toolMinor;
    }

    inline float getOrientation(size_t pointerIndex) const {
        return getCurrentPointerCoords(pointerIndex).orientation;
    }

    inline size_t getHistorySize() const { return mSampleEventTimes.size() - 1; }
    inline size_t getHistorySize() const { return mSampleEventTimes.size() - 1; }


    inline nsecs_t getHistoricalEventTime(size_t historicalIndex) const {
    inline nsecs_t getHistoricalEventTime(size_t historicalIndex) const {
@@ -294,9 +319,29 @@ public:
        return getHistoricalPointerCoords(pointerIndex, historicalIndex).size;
        return getHistoricalPointerCoords(pointerIndex, historicalIndex).size;
    }
    }


    inline float getHistoricalTouchMajor(size_t pointerIndex, size_t historicalIndex) const {
        return getHistoricalPointerCoords(pointerIndex, historicalIndex).touchMajor;
    }

    inline float getHistoricalTouchMinor(size_t pointerIndex, size_t historicalIndex) const {
        return getHistoricalPointerCoords(pointerIndex, historicalIndex).touchMinor;
    }

    inline float getHistoricalToolMajor(size_t pointerIndex, size_t historicalIndex) const {
        return getHistoricalPointerCoords(pointerIndex, historicalIndex).toolMajor;
    }

    inline float getHistoricalToolMinor(size_t pointerIndex, size_t historicalIndex) const {
        return getHistoricalPointerCoords(pointerIndex, historicalIndex).toolMinor;
    }

    inline float getHistoricalOrientation(size_t pointerIndex, size_t historicalIndex) const {
        return getHistoricalPointerCoords(pointerIndex, historicalIndex).orientation;
    }

    void initialize(
    void initialize(
            int32_t deviceId,
            int32_t deviceId,
            int32_t nature,
            int32_t source,
            int32_t action,
            int32_t action,
            int32_t edgeFlags,
            int32_t edgeFlags,
            int32_t metaState,
            int32_t metaState,
+17 −2
Original line number Original line Diff line number Diff line
@@ -42,6 +42,7 @@ namespace android {
extern int32_t updateMetaState(int32_t keyCode, bool down, int32_t oldMetaState);
extern int32_t updateMetaState(int32_t keyCode, bool down, int32_t oldMetaState);
extern int32_t rotateKeyCode(int32_t keyCode, int32_t orientation);
extern int32_t rotateKeyCode(int32_t keyCode, int32_t orientation);



/*
/*
 * An input device structure tracks the state of a single input device.
 * An input device structure tracks the state of a single input device.
 *
 *
@@ -168,8 +169,11 @@ struct InputDevice {
                FIELD_ABS_MT_POSITION_X = 1,
                FIELD_ABS_MT_POSITION_X = 1,
                FIELD_ABS_MT_POSITION_Y = 2,
                FIELD_ABS_MT_POSITION_Y = 2,
                FIELD_ABS_MT_TOUCH_MAJOR = 4,
                FIELD_ABS_MT_TOUCH_MAJOR = 4,
                FIELD_ABS_MT_WIDTH_MAJOR = 8,
                FIELD_ABS_MT_TOUCH_MINOR = 8,
                FIELD_ABS_MT_TRACKING_ID = 16
                FIELD_ABS_MT_WIDTH_MAJOR = 16,
                FIELD_ABS_MT_WIDTH_MINOR = 32,
                FIELD_ABS_MT_ORIENTATION = 64,
                FIELD_ABS_MT_TRACKING_ID = 128
            };
            };


            uint32_t pointerCount;
            uint32_t pointerCount;
@@ -179,7 +183,10 @@ struct InputDevice {
                int32_t absMTPositionX;
                int32_t absMTPositionX;
                int32_t absMTPositionY;
                int32_t absMTPositionY;
                int32_t absMTTouchMajor;
                int32_t absMTTouchMajor;
                int32_t absMTTouchMinor;
                int32_t absMTWidthMajor;
                int32_t absMTWidthMajor;
                int32_t absMTWidthMinor;
                int32_t absMTOrientation;
                int32_t absMTTrackingId;
                int32_t absMTTrackingId;


                inline void clear() {
                inline void clear() {
@@ -206,6 +213,11 @@ struct InputDevice {
        int32_t y;
        int32_t y;
        int32_t pressure;
        int32_t pressure;
        int32_t size;
        int32_t size;
        int32_t touchMajor;
        int32_t touchMinor;
        int32_t toolMajor;
        int32_t toolMinor;
        int32_t orientation;
    };
    };


    struct TouchData {
    struct TouchData {
@@ -236,6 +248,7 @@ struct InputDevice {
            AbsoluteAxisInfo yAxis;
            AbsoluteAxisInfo yAxis;
            AbsoluteAxisInfo pressureAxis;
            AbsoluteAxisInfo pressureAxis;
            AbsoluteAxisInfo sizeAxis;
            AbsoluteAxisInfo sizeAxis;
            AbsoluteAxisInfo orientationAxis;
        } parameters;
        } parameters;


        // The touch data of the current sample being processed.
        // The touch data of the current sample being processed.
@@ -290,6 +303,8 @@ struct InputDevice {


            int32_t sizeOrigin;
            int32_t sizeOrigin;
            float sizeScale;
            float sizeScale;

            float orientationScale;
        } precalculated;
        } precalculated;


        void reset();
        void reset();
+8 −8
Original line number Original line Diff line number Diff line
@@ -167,10 +167,10 @@ public:
     */
     */
    virtual void notifyConfigurationChanged(nsecs_t eventTime) = 0;
    virtual void notifyConfigurationChanged(nsecs_t eventTime) = 0;
    virtual void notifyAppSwitchComing(nsecs_t eventTime) = 0;
    virtual void notifyAppSwitchComing(nsecs_t eventTime) = 0;
    virtual void notifyKey(nsecs_t eventTime, int32_t deviceId, int32_t nature,
    virtual void notifyKey(nsecs_t eventTime, int32_t deviceId, int32_t source,
            uint32_t policyFlags, int32_t action, int32_t flags, int32_t keyCode,
            uint32_t policyFlags, int32_t action, int32_t flags, int32_t keyCode,
            int32_t scanCode, int32_t metaState, nsecs_t downTime) = 0;
            int32_t scanCode, int32_t metaState, nsecs_t downTime) = 0;
    virtual void notifyMotion(nsecs_t eventTime, int32_t deviceId, int32_t nature,
    virtual void notifyMotion(nsecs_t eventTime, int32_t deviceId, int32_t source,
            uint32_t policyFlags, int32_t action, int32_t metaState, int32_t edgeFlags,
            uint32_t policyFlags, int32_t action, int32_t metaState, int32_t edgeFlags,
            uint32_t pointerCount, const int32_t* pointerIds, const PointerCoords* pointerCoords,
            uint32_t pointerCount, const int32_t* pointerIds, const PointerCoords* pointerCoords,
            float xPrecision, float yPrecision, nsecs_t downTime) = 0;
            float xPrecision, float yPrecision, nsecs_t downTime) = 0;
@@ -232,10 +232,10 @@ public:


    virtual void notifyConfigurationChanged(nsecs_t eventTime);
    virtual void notifyConfigurationChanged(nsecs_t eventTime);
    virtual void notifyAppSwitchComing(nsecs_t eventTime);
    virtual void notifyAppSwitchComing(nsecs_t eventTime);
    virtual void notifyKey(nsecs_t eventTime, int32_t deviceId, int32_t nature,
    virtual void notifyKey(nsecs_t eventTime, int32_t deviceId, int32_t source,
            uint32_t policyFlags, int32_t action, int32_t flags, int32_t keyCode,
            uint32_t policyFlags, int32_t action, int32_t flags, int32_t keyCode,
            int32_t scanCode, int32_t metaState, nsecs_t downTime);
            int32_t scanCode, int32_t metaState, nsecs_t downTime);
    virtual void notifyMotion(nsecs_t eventTime, int32_t deviceId, int32_t nature,
    virtual void notifyMotion(nsecs_t eventTime, int32_t deviceId, int32_t source,
            uint32_t policyFlags, int32_t action, int32_t metaState, int32_t edgeFlags,
            uint32_t policyFlags, int32_t action, int32_t metaState, int32_t edgeFlags,
            uint32_t pointerCount, const int32_t* pointerIds, const PointerCoords* pointerCoords,
            uint32_t pointerCount, const int32_t* pointerIds, const PointerCoords* pointerCoords,
            float xPrecision, float yPrecision, nsecs_t downTime);
            float xPrecision, float yPrecision, nsecs_t downTime);
@@ -281,7 +281,7 @@ private:


    struct KeyEntry : EventEntry {
    struct KeyEntry : EventEntry {
        int32_t deviceId;
        int32_t deviceId;
        int32_t nature;
        int32_t source;
        uint32_t policyFlags;
        uint32_t policyFlags;
        int32_t action;
        int32_t action;
        int32_t flags;
        int32_t flags;
@@ -301,7 +301,7 @@ private:


    struct MotionEntry : EventEntry {
    struct MotionEntry : EventEntry {
        int32_t deviceId;
        int32_t deviceId;
        int32_t nature;
        int32_t source;
        uint32_t policyFlags;
        uint32_t policyFlags;
        int32_t action;
        int32_t action;
        int32_t metaState;
        int32_t metaState;
@@ -424,11 +424,11 @@ private:


        ConfigurationChangedEntry* obtainConfigurationChangedEntry(nsecs_t eventTime);
        ConfigurationChangedEntry* obtainConfigurationChangedEntry(nsecs_t eventTime);
        KeyEntry* obtainKeyEntry(nsecs_t eventTime,
        KeyEntry* obtainKeyEntry(nsecs_t eventTime,
                int32_t deviceId, int32_t nature, uint32_t policyFlags, int32_t action,
                int32_t deviceId, int32_t source, uint32_t policyFlags, int32_t action,
                int32_t flags, int32_t keyCode, int32_t scanCode, int32_t metaState,
                int32_t flags, int32_t keyCode, int32_t scanCode, int32_t metaState,
                int32_t repeatCount, nsecs_t downTime);
                int32_t repeatCount, nsecs_t downTime);
        MotionEntry* obtainMotionEntry(nsecs_t eventTime,
        MotionEntry* obtainMotionEntry(nsecs_t eventTime,
                int32_t deviceId, int32_t nature, uint32_t policyFlags, int32_t action,
                int32_t deviceId, int32_t source, uint32_t policyFlags, int32_t action,
                int32_t metaState, int32_t edgeFlags, float xPrecision, float yPrecision,
                int32_t metaState, int32_t edgeFlags, float xPrecision, float yPrecision,
                nsecs_t downTime, uint32_t pointerCount,
                nsecs_t downTime, uint32_t pointerCount,
                const int32_t* pointerIds, const PointerCoords* pointerCoords);
                const int32_t* pointerIds, const PointerCoords* pointerCoords);
+5 −5
Original line number Original line Diff line number Diff line
@@ -119,7 +119,7 @@ struct InputMessage {
    };
    };


    int32_t deviceId;
    int32_t deviceId;
    int32_t nature;
    int32_t source;


    union {
    union {
        struct {
        struct {
@@ -198,7 +198,7 @@ public:
     */
     */
    status_t publishKeyEvent(
    status_t publishKeyEvent(
            int32_t deviceId,
            int32_t deviceId,
            int32_t nature,
            int32_t source,
            int32_t action,
            int32_t action,
            int32_t flags,
            int32_t flags,
            int32_t keyCode,
            int32_t keyCode,
@@ -216,7 +216,7 @@ public:
     */
     */
    status_t publishMotionEvent(
    status_t publishMotionEvent(
            int32_t deviceId,
            int32_t deviceId,
            int32_t nature,
            int32_t source,
            int32_t action,
            int32_t action,
            int32_t edgeFlags,
            int32_t edgeFlags,
            int32_t metaState,
            int32_t metaState,
@@ -233,7 +233,7 @@ public:
    /* Appends a motion sample to a motion event unless already consumed.
    /* Appends a motion sample to a motion event unless already consumed.
     *
     *
     * Returns OK on success.
     * Returns OK on success.
     * Returns INVALID_OPERATION if the current event is not a MOTION_EVENT_ACTION_MOVE event.
     * Returns INVALID_OPERATION if the current event is not a AMOTION_EVENT_ACTION_MOVE event.
     * Returns FAILED_TRANSACTION if the current event has already been consumed.
     * Returns FAILED_TRANSACTION if the current event has already been consumed.
     * Returns NO_MEMORY if the buffer is full and no additional samples can be added.
     * Returns NO_MEMORY if the buffer is full and no additional samples can be added.
     */
     */
@@ -272,7 +272,7 @@ private:
    status_t publishInputEvent(
    status_t publishInputEvent(
            int32_t type,
            int32_t type,
            int32_t deviceId,
            int32_t deviceId,
            int32_t nature);
            int32_t source);
};
};


/*
/*
Loading