Loading include/android/input.h +15 −0 Original line number Diff line number Diff line Loading @@ -650,6 +650,21 @@ enum { * vertical or horizontal. The movement of a rotating scroller is an example of this. */ AMOTION_EVENT_AXIS_SCROLL = 26, /** * Axis constant: The movement of x position of a motion event. * * - For a mouse, reports a difference of x position between the previous position. * This is useful when pointer is captured, in that case the mouse pointer doesn't * change the location but this axis reports the difference which allows the app * to see how the mouse is moved. */ AMOTION_EVENT_AXIS_RELATIVE_X = 27, /** * Axis constant: The movement of y position of a motion event. * * Same as {@link RELATIVE_X}, but for y position. */ AMOTION_EVENT_AXIS_RELATIVE_Y = 28, /** * Axis constant: Generic 1 axis of a motion event. * The interpretation of a generic axis is device-specific. Loading services/inputflinger/InputDispatcher.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -902,7 +902,7 @@ void InputDispatcher::logOutboundMotionDetailsLocked(const char* prefix, const M ALOGD(" Pointer %d: id=%d, toolType=%d, " "x=%f, y=%f, pressure=%f, size=%f, " "touchMajor=%f, touchMinor=%f, toolMajor=%f, toolMinor=%f, " "orientation=%f", "orientation=%f, relativeX=%f, relativeY=%f", i, entry->pointerProperties[i].id, entry->pointerProperties[i].toolType, entry->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_X), Loading @@ -913,7 +913,9 @@ void InputDispatcher::logOutboundMotionDetailsLocked(const char* prefix, const M entry->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR), entry->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR), entry->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR), entry->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_ORIENTATION)); entry->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_ORIENTATION), entry->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_RELATIVE_X), entry->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_RELATIVE_Y)); } #endif } Loading services/inputflinger/InputReader.cpp +27 −8 Original line number Diff line number Diff line Loading @@ -2614,6 +2614,8 @@ void CursorInputMapper::sync(nsecs_t when) { mPointerController->getPosition(&x, &y); pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_X, x); pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_Y, y); pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_RELATIVE_X, deltaX); pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_RELATIVE_Y, deltaY); displayId = ADISPLAY_ID_DEFAULT; } else { pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_X, deltaX); Loading Loading @@ -5333,13 +5335,14 @@ bool TouchInputMapper::preparePointerGestures(nsecs_t when, } } float deltaX = 0, deltaY = 0; if (activeTouchId >= 0 && mLastCookedState.fingerIdBits.hasBit(activeTouchId)) { const RawPointerData::Pointer& currentPointer = mCurrentRawState.rawPointerData.pointerForId(activeTouchId); const RawPointerData::Pointer& lastPointer = mLastRawState.rawPointerData.pointerForId(activeTouchId); float deltaX = (currentPointer.x - lastPointer.x) * mPointerXMovementScale; float deltaY = (currentPointer.y - lastPointer.y) * mPointerYMovementScale; deltaX = (currentPointer.x - lastPointer.x) * mPointerXMovementScale; deltaY = (currentPointer.y - lastPointer.y) * mPointerYMovementScale; rotateDelta(mSurfaceOrientation, &deltaX, &deltaY); mPointerVelocityControl.move(when, &deltaX, &deltaY); Loading @@ -5366,6 +5369,8 @@ bool TouchInputMapper::preparePointerGestures(nsecs_t when, mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_X, x); mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, y); mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 1.0f); mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_RELATIVE_X, deltaX); mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_RELATIVE_Y, deltaY); } else if (currentFingerCount == 0) { // Case 3. No fingers down and button is not pressed. (NEUTRAL) if (mPointerGesture.lastGestureMode != PointerGesture::NEUTRAL) { Loading Loading @@ -5473,15 +5478,14 @@ bool TouchInputMapper::preparePointerGestures(nsecs_t when, mPointerGesture.currentGestureMode = PointerGesture::TAP_DRAG; } float deltaX = 0, deltaY = 0; if (mLastCookedState.fingerIdBits.hasBit(activeTouchId)) { const RawPointerData::Pointer& currentPointer = mCurrentRawState.rawPointerData.pointerForId(activeTouchId); const RawPointerData::Pointer& lastPointer = mLastRawState.rawPointerData.pointerForId(activeTouchId); float deltaX = (currentPointer.x - lastPointer.x) * mPointerXMovementScale; float deltaY = (currentPointer.y - lastPointer.y) * mPointerYMovementScale; deltaX = (currentPointer.x - lastPointer.x) * mPointerXMovementScale; deltaY = (currentPointer.y - lastPointer.y) * mPointerYMovementScale; rotateDelta(mSurfaceOrientation, &deltaX, &deltaY); mPointerVelocityControl.move(when, &deltaX, &deltaY); Loading Loading @@ -5525,6 +5529,10 @@ bool TouchInputMapper::preparePointerGestures(nsecs_t when, mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, y); mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, down ? 1.0f : 0.0f); mPointerGesture.currentGestureCoords[0].setAxisValue( AMOTION_EVENT_AXIS_RELATIVE_X, deltaX); mPointerGesture.currentGestureCoords[0].setAxisValue( AMOTION_EVENT_AXIS_RELATIVE_Y, deltaY); if (lastFingerCount == 0 && currentFingerCount != 0) { mPointerGesture.resetTap(); Loading Loading @@ -5771,6 +5779,10 @@ bool TouchInputMapper::preparePointerGestures(nsecs_t when, mPointerGesture.referenceGestureX); mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, mPointerGesture.referenceGestureY); mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_RELATIVE_X, commonDeltaX); mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_RELATIVE_Y, commonDeltaY); mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 1.0f); } else if (mPointerGesture.currentGestureMode == PointerGesture::FREEFORM) { // FREEFORM mode. Loading Loading @@ -5867,6 +5879,10 @@ bool TouchInputMapper::preparePointerGestures(nsecs_t when, AMOTION_EVENT_AXIS_Y, mPointerGesture.referenceGestureY + deltaY); mPointerGesture.currentGestureCoords[i].setAxisValue( AMOTION_EVENT_AXIS_PRESSURE, 1.0f); mPointerGesture.currentGestureCoords[i].setAxisValue( AMOTION_EVENT_AXIS_RELATIVE_X, deltaX); mPointerGesture.currentGestureCoords[i].setAxisValue( AMOTION_EVENT_AXIS_RELATIVE_Y, deltaY); } if (mPointerGesture.activeGestureId < 0) { Loading Loading @@ -5960,12 +5976,13 @@ void TouchInputMapper::dispatchPointerMouse(nsecs_t when, uint32_t policyFlags) if (!mCurrentCookedState.mouseIdBits.isEmpty()) { uint32_t id = mCurrentCookedState.mouseIdBits.firstMarkedBit(); uint32_t currentIndex = mCurrentRawState.rawPointerData.idToIndex[id]; float deltaX = 0, deltaY = 0; if (mLastCookedState.mouseIdBits.hasBit(id)) { uint32_t lastIndex = mCurrentRawState.rawPointerData.idToIndex[id]; float deltaX = (mCurrentRawState.rawPointerData.pointers[currentIndex].x deltaX = (mCurrentRawState.rawPointerData.pointers[currentIndex].x - mLastRawState.rawPointerData.pointers[lastIndex].x) * mPointerXMovementScale; float deltaY = (mCurrentRawState.rawPointerData.pointers[currentIndex].y deltaY = (mCurrentRawState.rawPointerData.pointers[currentIndex].y - mLastRawState.rawPointerData.pointers[lastIndex].y) * mPointerYMovementScale; Loading @@ -5988,6 +6005,8 @@ void TouchInputMapper::dispatchPointerMouse(nsecs_t when, uint32_t policyFlags) mPointerSimple.currentCoords.setAxisValue(AMOTION_EVENT_AXIS_Y, y); mPointerSimple.currentCoords.setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, hovering ? 0.0f : 1.0f); mPointerSimple.currentCoords.setAxisValue(AMOTION_EVENT_AXIS_RELATIVE_X, x); mPointerSimple.currentCoords.setAxisValue(AMOTION_EVENT_AXIS_RELATIVE_Y, y); mPointerSimple.currentProperties.id = 0; mPointerSimple.currentProperties.toolType = mCurrentCookedState.cookedPointerData.pointerProperties[currentIndex].toolType; Loading Loading
include/android/input.h +15 −0 Original line number Diff line number Diff line Loading @@ -650,6 +650,21 @@ enum { * vertical or horizontal. The movement of a rotating scroller is an example of this. */ AMOTION_EVENT_AXIS_SCROLL = 26, /** * Axis constant: The movement of x position of a motion event. * * - For a mouse, reports a difference of x position between the previous position. * This is useful when pointer is captured, in that case the mouse pointer doesn't * change the location but this axis reports the difference which allows the app * to see how the mouse is moved. */ AMOTION_EVENT_AXIS_RELATIVE_X = 27, /** * Axis constant: The movement of y position of a motion event. * * Same as {@link RELATIVE_X}, but for y position. */ AMOTION_EVENT_AXIS_RELATIVE_Y = 28, /** * Axis constant: Generic 1 axis of a motion event. * The interpretation of a generic axis is device-specific. Loading
services/inputflinger/InputDispatcher.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -902,7 +902,7 @@ void InputDispatcher::logOutboundMotionDetailsLocked(const char* prefix, const M ALOGD(" Pointer %d: id=%d, toolType=%d, " "x=%f, y=%f, pressure=%f, size=%f, " "touchMajor=%f, touchMinor=%f, toolMajor=%f, toolMinor=%f, " "orientation=%f", "orientation=%f, relativeX=%f, relativeY=%f", i, entry->pointerProperties[i].id, entry->pointerProperties[i].toolType, entry->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_X), Loading @@ -913,7 +913,9 @@ void InputDispatcher::logOutboundMotionDetailsLocked(const char* prefix, const M entry->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR), entry->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR), entry->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR), entry->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_ORIENTATION)); entry->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_ORIENTATION), entry->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_RELATIVE_X), entry->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_RELATIVE_Y)); } #endif } Loading
services/inputflinger/InputReader.cpp +27 −8 Original line number Diff line number Diff line Loading @@ -2614,6 +2614,8 @@ void CursorInputMapper::sync(nsecs_t when) { mPointerController->getPosition(&x, &y); pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_X, x); pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_Y, y); pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_RELATIVE_X, deltaX); pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_RELATIVE_Y, deltaY); displayId = ADISPLAY_ID_DEFAULT; } else { pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_X, deltaX); Loading Loading @@ -5333,13 +5335,14 @@ bool TouchInputMapper::preparePointerGestures(nsecs_t when, } } float deltaX = 0, deltaY = 0; if (activeTouchId >= 0 && mLastCookedState.fingerIdBits.hasBit(activeTouchId)) { const RawPointerData::Pointer& currentPointer = mCurrentRawState.rawPointerData.pointerForId(activeTouchId); const RawPointerData::Pointer& lastPointer = mLastRawState.rawPointerData.pointerForId(activeTouchId); float deltaX = (currentPointer.x - lastPointer.x) * mPointerXMovementScale; float deltaY = (currentPointer.y - lastPointer.y) * mPointerYMovementScale; deltaX = (currentPointer.x - lastPointer.x) * mPointerXMovementScale; deltaY = (currentPointer.y - lastPointer.y) * mPointerYMovementScale; rotateDelta(mSurfaceOrientation, &deltaX, &deltaY); mPointerVelocityControl.move(when, &deltaX, &deltaY); Loading @@ -5366,6 +5369,8 @@ bool TouchInputMapper::preparePointerGestures(nsecs_t when, mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_X, x); mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, y); mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 1.0f); mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_RELATIVE_X, deltaX); mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_RELATIVE_Y, deltaY); } else if (currentFingerCount == 0) { // Case 3. No fingers down and button is not pressed. (NEUTRAL) if (mPointerGesture.lastGestureMode != PointerGesture::NEUTRAL) { Loading Loading @@ -5473,15 +5478,14 @@ bool TouchInputMapper::preparePointerGestures(nsecs_t when, mPointerGesture.currentGestureMode = PointerGesture::TAP_DRAG; } float deltaX = 0, deltaY = 0; if (mLastCookedState.fingerIdBits.hasBit(activeTouchId)) { const RawPointerData::Pointer& currentPointer = mCurrentRawState.rawPointerData.pointerForId(activeTouchId); const RawPointerData::Pointer& lastPointer = mLastRawState.rawPointerData.pointerForId(activeTouchId); float deltaX = (currentPointer.x - lastPointer.x) * mPointerXMovementScale; float deltaY = (currentPointer.y - lastPointer.y) * mPointerYMovementScale; deltaX = (currentPointer.x - lastPointer.x) * mPointerXMovementScale; deltaY = (currentPointer.y - lastPointer.y) * mPointerYMovementScale; rotateDelta(mSurfaceOrientation, &deltaX, &deltaY); mPointerVelocityControl.move(when, &deltaX, &deltaY); Loading Loading @@ -5525,6 +5529,10 @@ bool TouchInputMapper::preparePointerGestures(nsecs_t when, mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, y); mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, down ? 1.0f : 0.0f); mPointerGesture.currentGestureCoords[0].setAxisValue( AMOTION_EVENT_AXIS_RELATIVE_X, deltaX); mPointerGesture.currentGestureCoords[0].setAxisValue( AMOTION_EVENT_AXIS_RELATIVE_Y, deltaY); if (lastFingerCount == 0 && currentFingerCount != 0) { mPointerGesture.resetTap(); Loading Loading @@ -5771,6 +5779,10 @@ bool TouchInputMapper::preparePointerGestures(nsecs_t when, mPointerGesture.referenceGestureX); mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, mPointerGesture.referenceGestureY); mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_RELATIVE_X, commonDeltaX); mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_RELATIVE_Y, commonDeltaY); mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 1.0f); } else if (mPointerGesture.currentGestureMode == PointerGesture::FREEFORM) { // FREEFORM mode. Loading Loading @@ -5867,6 +5879,10 @@ bool TouchInputMapper::preparePointerGestures(nsecs_t when, AMOTION_EVENT_AXIS_Y, mPointerGesture.referenceGestureY + deltaY); mPointerGesture.currentGestureCoords[i].setAxisValue( AMOTION_EVENT_AXIS_PRESSURE, 1.0f); mPointerGesture.currentGestureCoords[i].setAxisValue( AMOTION_EVENT_AXIS_RELATIVE_X, deltaX); mPointerGesture.currentGestureCoords[i].setAxisValue( AMOTION_EVENT_AXIS_RELATIVE_Y, deltaY); } if (mPointerGesture.activeGestureId < 0) { Loading Loading @@ -5960,12 +5976,13 @@ void TouchInputMapper::dispatchPointerMouse(nsecs_t when, uint32_t policyFlags) if (!mCurrentCookedState.mouseIdBits.isEmpty()) { uint32_t id = mCurrentCookedState.mouseIdBits.firstMarkedBit(); uint32_t currentIndex = mCurrentRawState.rawPointerData.idToIndex[id]; float deltaX = 0, deltaY = 0; if (mLastCookedState.mouseIdBits.hasBit(id)) { uint32_t lastIndex = mCurrentRawState.rawPointerData.idToIndex[id]; float deltaX = (mCurrentRawState.rawPointerData.pointers[currentIndex].x deltaX = (mCurrentRawState.rawPointerData.pointers[currentIndex].x - mLastRawState.rawPointerData.pointers[lastIndex].x) * mPointerXMovementScale; float deltaY = (mCurrentRawState.rawPointerData.pointers[currentIndex].y deltaY = (mCurrentRawState.rawPointerData.pointers[currentIndex].y - mLastRawState.rawPointerData.pointers[lastIndex].y) * mPointerYMovementScale; Loading @@ -5988,6 +6005,8 @@ void TouchInputMapper::dispatchPointerMouse(nsecs_t when, uint32_t policyFlags) mPointerSimple.currentCoords.setAxisValue(AMOTION_EVENT_AXIS_Y, y); mPointerSimple.currentCoords.setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, hovering ? 0.0f : 1.0f); mPointerSimple.currentCoords.setAxisValue(AMOTION_EVENT_AXIS_RELATIVE_X, x); mPointerSimple.currentCoords.setAxisValue(AMOTION_EVENT_AXIS_RELATIVE_Y, y); mPointerSimple.currentProperties.id = 0; mPointerSimple.currentProperties.toolType = mCurrentCookedState.cookedPointerData.pointerProperties[currentIndex].toolType; Loading