summaryrefslogtreecommitdiff
path: root/include/input
diff options
context:
space:
mode:
author Paul Ramirez <peramirez@google.com> 2024-07-16 17:44:20 +0000
committer Paul Ramirez <peramirez@google.com> 2024-07-17 22:25:23 +0000
commitb41d38e432b15ab6cfe9ccac6180c7919aed2e48 (patch)
tree5cdbc8975acf10e3b9f3b374040737abb69760d5 /include/input
parent3f001ca85d7f10f717e8190ee1405019d671fdc7 (diff)
Move batching logic from consumeBatchedInputEvents
Moved MotionEvent creation and batching into createBatchedMotionEvent Bug: 297226446 Flag: EXEMPT refactor Test: TEST=libinput_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST Change-Id: I7e768f28bfae641b0ab38c4addc6b14c6dd23723
Diffstat (limited to 'include/input')
-rw-r--r--include/input/InputConsumerNoResampling.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/input/InputConsumerNoResampling.h b/include/input/InputConsumerNoResampling.h
index c7b1970149..ae8de5f411 100644
--- a/include/input/InputConsumerNoResampling.h
+++ b/include/input/InputConsumerNoResampling.h
@@ -16,8 +16,8 @@
#pragma once
+#include <input/InputTransport.h>
#include <utils/Looper.h>
-#include "InputTransport.h"
namespace android {
@@ -182,6 +182,16 @@ private:
*/
std::map<DeviceId, std::queue<InputMessage>> mBatches;
/**
+ * Creates a MotionEvent by consuming samples from the provided queue. If one message has
+ * eventTime > frameTime, all subsequent messages in the queue will be skipped. It is assumed
+ * that messages are queued in chronological order. In other words, only events that occurred
+ * prior to the requested frameTime will be consumed.
+ * @param frameTime the time up to which to consume events
+ * @param messages the queue of messages to consume from
+ */
+ std::pair<std::unique_ptr<MotionEvent>, std::optional<uint32_t>> createBatchedMotionEvent(
+ const nsecs_t frameTime, std::queue<InputMessage>& messages);
+ /**
* A map from a single sequence number to several sequence numbers. This is needed because of
* batching. When batching is enabled, a single MotionEvent will contain several samples. Each
* sample came from an individual InputMessage of Type::Motion, and therefore will have to be