From 71c6f73ada569787a7064af4ea2a4c01adb75a85 Mon Sep 17 00:00:00 2001 From: jioana Date: Tue, 16 Jul 2024 15:42:56 +0000 Subject: Update MotionEvent's id when a new sample is added. Until now the MotionEvent's id was set during the "initialize" call, and it was equal to the first sample's eventId. We want to use the latest sample's eventId. Bug: b/350907221 Test: atest libinput_tests inputflinger_tests Flag: EXEMPT bugfix Change-Id: I0d967e7fe644fc2b2c09d044c3ee8ed13276d787 --- libs/input/Input.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libs/input/Input.cpp') diff --git a/libs/input/Input.cpp b/libs/input/Input.cpp index b09814797f..a2bb3453fe 100644 --- a/libs/input/Input.cpp +++ b/libs/input/Input.cpp @@ -580,7 +580,7 @@ void MotionEvent::initialize(int32_t id, int32_t deviceId, uint32_t source, &pointerProperties[pointerCount]); mSampleEventTimes.clear(); mSamplePointerCoords.clear(); - addSample(eventTime, pointerCoords); + addSample(eventTime, pointerCoords, mId); } void MotionEvent::copyFrom(const MotionEvent* other, bool keepHistory) { @@ -640,9 +640,9 @@ void MotionEvent::splitFrom(const android::MotionEvent& other, mSampleEventTimes = other.mSampleEventTimes; } -void MotionEvent::addSample( - int64_t eventTime, - const PointerCoords* pointerCoords) { +void MotionEvent::addSample(int64_t eventTime, const PointerCoords* pointerCoords, + int32_t eventId) { + mId = eventId; mSampleEventTimes.push_back(eventTime); mSamplePointerCoords.insert(mSamplePointerCoords.end(), &pointerCoords[0], &pointerCoords[getPointerCount()]); -- cgit v1.2.3-59-g8ed1b