diff options
author | 2024-11-12 22:22:43 -0800 | |
---|---|---|
committer | 2024-11-12 22:22:43 -0800 | |
commit | 6dc15689f6bb4b04c102ac3107f31377ee91f05e (patch) | |
tree | 3ca9d372bc99ac1182fdb4bc895c556d0f108bd3 /libs/input/InputConsumer.cpp | |
parent | d4d02798539f29d00059d458fd01e5b2869acbb6 (diff) | |
parent | f151262626f1c08a104cc35d9864493ea8a72dec (diff) |
Merge 24Q4 (ab/12406339) into aosp-main-future
Bug: 370570306
Merged-In: I9be1254c3e2685b0aa950b314c581824f40ce26c
Change-Id: I35bc501a2b1d9eb100aaab25cd660cf2e0542f99
Diffstat (limited to 'libs/input/InputConsumer.cpp')
-rw-r--r-- | libs/input/InputConsumer.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/libs/input/InputConsumer.cpp b/libs/input/InputConsumer.cpp index fcf490d5f9..1eeb4e678c 100644 --- a/libs/input/InputConsumer.cpp +++ b/libs/input/InputConsumer.cpp @@ -135,7 +135,7 @@ void addSample(MotionEvent& event, const InputMessage& msg) { } event.setMetaState(event.getMetaState() | msg.body.motion.metaState); - event.addSample(msg.body.motion.eventTime, pointerCoords); + event.addSample(msg.body.motion.eventTime, pointerCoords, msg.body.motion.eventId); } void initializeTouchModeEvent(TouchModeEvent& event, const InputMessage& msg) { @@ -235,8 +235,9 @@ status_t InputConsumer::consume(InputEventFactoryInterface* factory, bool consum mMsgDeferred = false; } else { // Receive a fresh message. - status_t result = mChannel->receiveMessage(&mMsg); - if (result == OK) { + android::base::Result<InputMessage> result = mChannel->receiveMessage(); + if (result.ok()) { + mMsg = std::move(result.value()); const auto [_, inserted] = mConsumeTimes.emplace(mMsg.header.seq, systemTime(SYSTEM_TIME_MONOTONIC)); LOG_ALWAYS_FATAL_IF(!inserted, "Already have a consume time for seq=%" PRIu32, @@ -244,11 +245,11 @@ status_t InputConsumer::consume(InputEventFactoryInterface* factory, bool consum // Trace the event processing timeline - event was just read from the socket ATRACE_ASYNC_BEGIN(mProcessingTraceTag.c_str(), /*cookie=*/mMsg.header.seq); - } - if (result) { + } else { // Consume the next batched event unless batches are being held for later. - if (consumeBatches || result != WOULD_BLOCK) { - result = consumeBatch(factory, frameTime, outSeq, outEvent); + if (consumeBatches || result.error().code() != WOULD_BLOCK) { + result = android::base::Error( + consumeBatch(factory, frameTime, outSeq, outEvent)); if (*outEvent) { ALOGD_IF(DEBUG_TRANSPORT_CONSUMER, "channel '%s' consumer ~ consumed batch event, seq=%u", @@ -256,7 +257,7 @@ status_t InputConsumer::consume(InputEventFactoryInterface* factory, bool consum break; } } - return result; + return result.error().code(); } } @@ -696,7 +697,7 @@ void InputConsumer::resampleTouchState(nsecs_t sampleTime, MotionEvent* event, currentCoords.getY(), otherCoords.getX(), otherCoords.getY(), alpha); } - event->addSample(sampleTime, touchState.lastResample.pointers); + event->addSample(sampleTime, touchState.lastResample.pointers, event->getId()); } status_t InputConsumer::sendFinishedSignal(uint32_t seq, bool handled) { |