Merge "TouchInputMapper: Fix pointer ID in dispatchPointerMouse"
diff --git a/services/inputflinger/reader/mapper/TouchInputMapper.cpp b/services/inputflinger/reader/mapper/TouchInputMapper.cpp
index 2ebbd37..eaf03f1 100644
--- a/services/inputflinger/reader/mapper/TouchInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/TouchInputMapper.cpp
@@ -3441,7 +3441,7 @@
         uint32_t currentIndex = mCurrentRawState.rawPointerData.idToIndex[id];
         float deltaX = 0, deltaY = 0;
         if (mLastCookedState.mouseIdBits.hasBit(id)) {
-            uint32_t lastIndex = mCurrentRawState.rawPointerData.idToIndex[id];
+            uint32_t lastIndex = mLastRawState.rawPointerData.idToIndex[id];
             deltaX = (mCurrentRawState.rawPointerData.pointers[currentIndex].x -
                       mLastRawState.rawPointerData.pointers[lastIndex].x) *
                     mPointerXMovementScale;