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

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

am 42bb545a: am 5c225b16: Even more native input dispatch work in progress.

Merge commit '42bb545a54d89f0ddbb230d7a01ea4210c0f6c00'

* commit '42bb545a54d89f0ddbb230d7a01ea4210c0f6c00':
  Even more native input dispatch work in progress.
parents 1d055eb0 b0f31749
Loading
Loading
Loading
Loading
+39 −10
Original line number Original line Diff line number Diff line
@@ -148,6 +148,9 @@ private:
    int32_t mNature;
    int32_t mNature;
};
};


/*
 * Key events.
 */
class KeyEvent : public InputEvent {
class KeyEvent : public InputEvent {
public:
public:
    virtual ~KeyEvent() { }
    virtual ~KeyEvent() { }
@@ -193,6 +196,9 @@ private:
    nsecs_t mEventTime;
    nsecs_t mEventTime;
};
};


/*
 * Motion events.
 */
class MotionEvent : public InputEvent {
class MotionEvent : public InputEvent {
public:
public:
    virtual ~MotionEvent() { }
    virtual ~MotionEvent() { }
@@ -205,6 +211,10 @@ public:


    inline int32_t getMetaState() const { return mMetaState; }
    inline int32_t getMetaState() const { return mMetaState; }


    inline float getXOffset() const { return mXOffset; }

    inline float getYOffset() const { return mYOffset; }

    inline float getXPrecision() const { return mXPrecision; }
    inline float getXPrecision() const { return mXPrecision; }


    inline float getYPrecision() const { return mYPrecision; }
    inline float getYPrecision() const { return mYPrecision; }
@@ -217,16 +227,20 @@ public:


    inline nsecs_t getEventTime() const { return mSampleEventTimes[getHistorySize()]; }
    inline nsecs_t getEventTime() const { return mSampleEventTimes[getHistorySize()]; }


    inline float getRawX() const { return mRawX; }
    inline float getRawX(size_t pointerIndex) const {
        return getCurrentPointerCoords(pointerIndex).x;
    }


    inline float getRawY() const { return mRawY; }
    inline float getRawY(size_t pointerIndex) const {
        return getCurrentPointerCoords(pointerIndex).y;
    }


    inline float getX(size_t pointerIndex) const {
    inline float getX(size_t pointerIndex) const {
        return getCurrentPointerCoords(pointerIndex).x;
        return getRawX(pointerIndex) + mXOffset;
    }
    }


    inline float getY(size_t pointerIndex) const {
    inline float getY(size_t pointerIndex) const {
        return getCurrentPointerCoords(pointerIndex).y;
        return getRawY(pointerIndex) + mYOffset;
    }
    }


    inline float getPressure(size_t pointerIndex) const {
    inline float getPressure(size_t pointerIndex) const {
@@ -243,14 +257,22 @@ public:
        return mSampleEventTimes[historicalIndex];
        return mSampleEventTimes[historicalIndex];
    }
    }


    inline float getHistoricalX(size_t pointerIndex, size_t historicalIndex) const {
    inline float getHistoricalRawX(size_t pointerIndex, size_t historicalIndex) const {
        return getHistoricalPointerCoords(pointerIndex, historicalIndex).x;
        return getHistoricalPointerCoords(pointerIndex, historicalIndex).x;
    }
    }


    inline float getHistoricalY(size_t pointerIndex, size_t historicalIndex) const {
    inline float getHistoricalRawY(size_t pointerIndex, size_t historicalIndex) const {
        return getHistoricalPointerCoords(pointerIndex, historicalIndex).y;
        return getHistoricalPointerCoords(pointerIndex, historicalIndex).y;
    }
    }


    inline float getHistoricalX(size_t pointerIndex, size_t historicalIndex) const {
        return getHistoricalRawX(pointerIndex, historicalIndex) + mXOffset;
    }

    inline float getHistoricalY(size_t pointerIndex, size_t historicalIndex) const {
        return getHistoricalRawY(pointerIndex, historicalIndex) + mYOffset;
    }

    inline float getHistoricalPressure(size_t pointerIndex, size_t historicalIndex) const {
    inline float getHistoricalPressure(size_t pointerIndex, size_t historicalIndex) const {
        return getHistoricalPointerCoords(pointerIndex, historicalIndex).pressure;
        return getHistoricalPointerCoords(pointerIndex, historicalIndex).pressure;
    }
    }
@@ -265,8 +287,8 @@ public:
            int32_t action,
            int32_t action,
            int32_t edgeFlags,
            int32_t edgeFlags,
            int32_t metaState,
            int32_t metaState,
            float rawX,
            float xOffset,
            float rawY,
            float yOffset,
            float xPrecision,
            float xPrecision,
            float yPrecision,
            float yPrecision,
            nsecs_t downTime,
            nsecs_t downTime,
@@ -281,12 +303,19 @@ public:


    void offsetLocation(float xOffset, float yOffset);
    void offsetLocation(float xOffset, float yOffset);


    // Low-level accessors.
    inline const int32_t* getPointerIds() const { return mPointerIds.array(); }
    inline const nsecs_t* getSampleEventTimes() const { return mSampleEventTimes.array(); }
    inline const PointerCoords* getSamplePointerCoords() const {
            return mSamplePointerCoords.array();
    }

private:
private:
    int32_t mAction;
    int32_t mAction;
    int32_t mEdgeFlags;
    int32_t mEdgeFlags;
    int32_t mMetaState;
    int32_t mMetaState;
    float mRawX;
    float mXOffset;
    float mRawY;
    float mYOffset;
    float mXPrecision;
    float mXPrecision;
    float mYPrecision;
    float mYPrecision;
    nsecs_t mDownTime;
    nsecs_t mDownTime;
+5 −3
Original line number Original line Diff line number Diff line
@@ -62,7 +62,7 @@ public:
     * Returns OK on success.
     * Returns OK on success.
     */
     */
    static status_t openInputChannelPair(const String8& name,
    static status_t openInputChannelPair(const String8& name,
            InputChannel** outServerChannel, InputChannel** outClientChannel);
            sp<InputChannel>& outServerChannel, sp<InputChannel>& outClientChannel);


    inline String8 getName() const { return mName; }
    inline String8 getName() const { return mName; }
    inline int32_t getAshmemFd() const { return mAshmemFd; }
    inline int32_t getAshmemFd() const { return mAshmemFd; }
@@ -72,7 +72,8 @@ public:
    /* Sends a signal to the other endpoint.
    /* Sends a signal to the other endpoint.
     *
     *
     * Returns OK on success.
     * Returns OK on success.
     * Errors probably indicate that the channel is broken.
     * Returns DEAD_OBJECT if the channel's peer has been closed.
     * Other errors probably indicate that the channel is broken.
     */
     */
    status_t sendSignal(char signal);
    status_t sendSignal(char signal);


@@ -81,6 +82,7 @@ public:
     *
     *
     * Returns OK on success.
     * Returns OK on success.
     * Returns WOULD_BLOCK if there is no signal present.
     * Returns WOULD_BLOCK if there is no signal present.
     * Returns DEAD_OBJECT if the channel's peer has been closed.
     * Other errors probably indicate that the channel is broken.
     * Other errors probably indicate that the channel is broken.
     */
     */
    status_t receiveSignal(char* outSignal);
    status_t receiveSignal(char* outSignal);
@@ -298,7 +300,7 @@ public:
     * Returns INVALID_OPERATION if there is no currently published event.
     * Returns INVALID_OPERATION if there is no currently published event.
     * Returns NO_MEMORY if the event could not be created.
     * Returns NO_MEMORY if the event could not be created.
     */
     */
    status_t consume(InputEventFactoryInterface* factory, InputEvent** event);
    status_t consume(InputEventFactoryInterface* factory, InputEvent** outEvent);


    /* Sends a finished signal to the publisher to inform it that the current message is
    /* Sends a finished signal to the publisher to inform it that the current message is
     * finished processing.
     * finished processing.
+3 −1
Original line number Original line Diff line number Diff line
@@ -114,8 +114,10 @@ private:
    };
    };


    Mutex mLock;
    Mutex mLock;
    Condition mAwake;
    bool mPolling;
    bool mPolling;
    uint32_t mWaiters;
    Condition mAwake;
    Condition mResume;


    int mWakeReadPipeFd;
    int mWakeReadPipeFd;
    int mWakeWritePipeFd;
    int mWakeWritePipeFd;
+7 −7
Original line number Original line Diff line number Diff line
@@ -115,10 +115,10 @@ public:




    //! insert an array at a given index
    //! insert an array at a given index
            ssize_t         insertArrayAt(const TYPE* array, size_t index, size_t numItems);
            ssize_t         insertArrayAt(const TYPE* array, size_t index, size_t length);


    //! append an array at the end of this vector
    //! append an array at the end of this vector
            ssize_t         appendArray(const TYPE* array, size_t numItems);
            ssize_t         appendArray(const TYPE* array, size_t length);


            /*! 
            /*! 
             * add/insert/replace items
             * add/insert/replace items
@@ -126,7 +126,7 @@ public:
             
             
    //! insert one or several items initialized with their default constructor
    //! insert one or several items initialized with their default constructor
    inline  ssize_t         insertAt(size_t index, size_t numItems = 1);
    inline  ssize_t         insertAt(size_t index, size_t numItems = 1);
    //! insert on onr several items initialized from a prototype item
    //! insert one or several items initialized from a prototype item
            ssize_t         insertAt(const TYPE& prototype_item, size_t index, size_t numItems = 1);
            ssize_t         insertAt(const TYPE& prototype_item, size_t index, size_t numItems = 1);
    //! pop the top of the stack (removes the last element). No-op if the stack's empty
    //! pop the top of the stack (removes the last element). No-op if the stack's empty
    inline  void            pop();
    inline  void            pop();
@@ -265,13 +265,13 @@ ssize_t Vector<TYPE>::appendVector(const Vector<TYPE>& vector) {
}
}


template<class TYPE> inline
template<class TYPE> inline
ssize_t Vector<TYPE>::insertArrayAt(const TYPE* array, size_t index, size_t numItems) {
ssize_t Vector<TYPE>::insertArrayAt(const TYPE* array, size_t index, size_t length) {
    return VectorImpl::insertAt(array, index, numItems);
    return VectorImpl::insertArrayAt(array, index, length);
}
}


template<class TYPE> inline
template<class TYPE> inline
ssize_t Vector<TYPE>::appendArray(const TYPE* array, size_t numItems) {
ssize_t Vector<TYPE>::appendArray(const TYPE* array, size_t length) {
    return VectorImpl::add(array, numItems);
    return VectorImpl::appendArray(array, length);
}
}


template<class TYPE> inline
template<class TYPE> inline
+6 −4
Original line number Original line Diff line number Diff line
@@ -65,9 +65,11 @@ public:
            size_t          capacity() const;
            size_t          capacity() const;
            ssize_t         setCapacity(size_t size);
            ssize_t         setCapacity(size_t size);


            /*! append/insert another vector */
            /*! append/insert another vector or array */
            ssize_t         insertVectorAt(const VectorImpl& vector, size_t index);
            ssize_t         insertVectorAt(const VectorImpl& vector, size_t index);
            ssize_t         appendVector(const VectorImpl& vector);
            ssize_t         appendVector(const VectorImpl& vector);
            ssize_t         insertArrayAt(const void* array, size_t index, size_t length);
            ssize_t         appendArray(const void* array, size_t length);
            
            
            /*! add/insert/replace items */
            /*! add/insert/replace items */
            ssize_t         insertAt(size_t where, size_t numItems = 1);
            ssize_t         insertAt(size_t where, size_t numItems = 1);
@@ -76,7 +78,7 @@ public:
            void            push();
            void            push();
            void            push(const void* item);
            void            push(const void* item);
            ssize_t         add();
            ssize_t         add();
            ssize_t         add(const void* item, size_t numItems = 1);
            ssize_t         add(const void* item);
            ssize_t         replaceAt(size_t index);
            ssize_t         replaceAt(size_t index);
            ssize_t         replaceAt(const void* item, size_t index);
            ssize_t         replaceAt(const void* item, size_t index);


@@ -184,8 +186,8 @@ private:
            void            push(const void* item);
            void            push(const void* item);
            ssize_t         insertVectorAt(const VectorImpl& vector, size_t index);
            ssize_t         insertVectorAt(const VectorImpl& vector, size_t index);
            ssize_t         appendVector(const VectorImpl& vector);
            ssize_t         appendVector(const VectorImpl& vector);
            ssize_t         insertArrayAt(const void* array, size_t index, size_t numItems);
            ssize_t         insertArrayAt(const void* array, size_t index, size_t length);
            ssize_t         appendArray(const void* array, size_t numItems);
            ssize_t         appendArray(const void* array, size_t length);
            ssize_t         insertAt(size_t where, size_t numItems = 1);
            ssize_t         insertAt(size_t where, size_t numItems = 1);
            ssize_t         insertAt(const void* item, size_t where, size_t numItems = 1);
            ssize_t         insertAt(const void* item, size_t where, size_t numItems = 1);
            ssize_t         replaceAt(size_t index);
            ssize_t         replaceAt(size_t index);
Loading