summaryrefslogtreecommitdiff
path: root/libs/input/InputConsumer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/input/InputConsumer.cpp')
-rw-r--r--libs/input/InputConsumer.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/libs/input/InputConsumer.cpp b/libs/input/InputConsumer.cpp
index fcf490d5f9..dce528f763 100644
--- a/libs/input/InputConsumer.cpp
+++ b/libs/input/InputConsumer.cpp
@@ -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();
}
}