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

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

am 7b8df313: am 00ba8844: Fix individual pointer id up/down reporting.

Merge commit '7b8df313f714d6e8d536e0f8bbe5496fe9a6c26d'

* commit '7b8df313f714d6e8d536e0f8bbe5496fe9a6c26d':
  Fix individual pointer id up/down reporting.
parents 989ce29b cd423c42
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -286,7 +286,8 @@ private:
            int32_t keyEventAction, int32_t keyEventFlags);
            int32_t keyEventAction, int32_t keyEventFlags);
    void dispatchTouches(nsecs_t when, InputDevice* device, uint32_t policyFlags);
    void dispatchTouches(nsecs_t when, InputDevice* device, uint32_t policyFlags);
    void dispatchTouch(nsecs_t when, InputDevice* device, uint32_t policyFlags,
    void dispatchTouch(nsecs_t when, InputDevice* device, uint32_t policyFlags,
            InputDevice::TouchData* touch, BitSet32 idBits, int32_t motionEventAction);
            InputDevice::TouchData* touch, BitSet32 idBits, uint32_t changedId,
            int32_t motionEventAction);


    // display
    // display
    void resetDisplayProperties();
    void resetDisplayProperties();
+10 −9
Original line number Original line Diff line number Diff line
@@ -766,7 +766,7 @@ void InputReader::dispatchTouches(nsecs_t when,
        // The dispatcher takes care of batching moves so we don't have to deal with that here.
        // The dispatcher takes care of batching moves so we don't have to deal with that here.
        int32_t motionEventAction = AMOTION_EVENT_ACTION_MOVE;
        int32_t motionEventAction = AMOTION_EVENT_ACTION_MOVE;
        dispatchTouch(when, device, policyFlags, & device->touchScreen.currentTouch,
        dispatchTouch(when, device, policyFlags, & device->touchScreen.currentTouch,
                currentIdBits, motionEventAction);
                currentIdBits, -1, motionEventAction);
    } else {
    } else {
        // There may be pointers going up and pointers going down at the same time when pointer
        // There may be pointers going up and pointers going down at the same time when pointer
        // ids are reported by the device driver.
        // ids are reported by the device driver.
@@ -784,12 +784,11 @@ void InputReader::dispatchTouches(nsecs_t when,
            if (activeIdBits.isEmpty()) {
            if (activeIdBits.isEmpty()) {
                motionEventAction = AMOTION_EVENT_ACTION_UP;
                motionEventAction = AMOTION_EVENT_ACTION_UP;
            } else {
            } else {
                motionEventAction = AMOTION_EVENT_ACTION_POINTER_UP
                motionEventAction = AMOTION_EVENT_ACTION_POINTER_UP;
                        | (upId << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT);
            }
            }


            dispatchTouch(when, device, policyFlags, & device->touchScreen.lastTouch,
            dispatchTouch(when, device, policyFlags, & device->touchScreen.lastTouch,
                    oldActiveIdBits, motionEventAction);
                    oldActiveIdBits, upId, motionEventAction);
        }
        }


        while (! downIdBits.isEmpty()) {
        while (! downIdBits.isEmpty()) {
@@ -803,18 +802,17 @@ void InputReader::dispatchTouches(nsecs_t when,
                motionEventAction = AMOTION_EVENT_ACTION_DOWN;
                motionEventAction = AMOTION_EVENT_ACTION_DOWN;
                device->touchScreen.downTime = when;
                device->touchScreen.downTime = when;
            } else {
            } else {
                motionEventAction = AMOTION_EVENT_ACTION_POINTER_DOWN
                motionEventAction = AMOTION_EVENT_ACTION_POINTER_DOWN;
                        | (downId << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT);
            }
            }


            dispatchTouch(when, device, policyFlags, & device->touchScreen.currentTouch,
            dispatchTouch(when, device, policyFlags, & device->touchScreen.currentTouch,
                    activeIdBits, motionEventAction);
                    activeIdBits, downId, motionEventAction);
        }
        }
    }
    }
}
}


void InputReader::dispatchTouch(nsecs_t when, InputDevice* device, uint32_t policyFlags,
void InputReader::dispatchTouch(nsecs_t when, InputDevice* device, uint32_t policyFlags,
        InputDevice::TouchData* touch, BitSet32 idBits,
        InputDevice::TouchData* touch, BitSet32 idBits, uint32_t changedId,
        int32_t motionEventAction) {
        int32_t motionEventAction) {
    int32_t orientedWidth, orientedHeight;
    int32_t orientedWidth, orientedHeight;
    switch (mDisplayOrientation) {
    switch (mDisplayOrientation) {
@@ -904,12 +902,15 @@ void InputReader::dispatchTouch(nsecs_t when, InputDevice* device, uint32_t poli
        pointerCoords[pointerCount].toolMinor = toolMinor;
        pointerCoords[pointerCount].toolMinor = toolMinor;
        pointerCoords[pointerCount].orientation = orientation;
        pointerCoords[pointerCount].orientation = orientation;


        if (id == changedId) {
            motionEventAction |= pointerCount << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
        }

        pointerCount += 1;
        pointerCount += 1;
    }
    }


    // Check edge flags by looking only at the first pointer since the flags are
    // Check edge flags by looking only at the first pointer since the flags are
    // global to the event.
    // global to the event.
    // XXX Maybe we should revise the edge flags API to work on a per-pointer basis.
    int32_t motionEventEdgeFlags = 0;
    int32_t motionEventEdgeFlags = 0;
    if (motionEventAction == AMOTION_EVENT_ACTION_DOWN) {
    if (motionEventAction == AMOTION_EVENT_ACTION_DOWN) {
        if (pointerCoords[0].x <= 0) {
        if (pointerCoords[0].x <= 0) {