blob: 1822e4a0db50034a51a00ef8d7edf6273713efc7 [file] [log] [blame]
Jeff Brown5912f952013-07-01 19:10:31 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _LIBINPUT_INPUT_TRANSPORT_H
18#define _LIBINPUT_INPUT_TRANSPORT_H
19
Robert Carr2c358bf2018-08-08 15:58:15 -070020#pragma GCC system_header
21
Jeff Brown5912f952013-07-01 19:10:31 -070022/**
23 * Native input transport.
24 *
25 * The InputChannel provides a mechanism for exchanging InputMessage structures across processes.
26 *
27 * The InputPublisher and InputConsumer each handle one end-point of an input channel.
28 * The InputPublisher is used by the input dispatcher to send events to the application.
29 * The InputConsumer is used by the application to receive events from the input dispatcher.
30 */
31
Siarhei Vishniakouec8f7252018-07-06 11:19:32 +010032#include <string>
33
Atif Niyaz3d3fa522019-07-25 11:12:39 -070034#include <android-base/chrono_utils.h>
35
Robert Carr803535b2018-08-02 16:38:15 -070036#include <binder/IBinder.h>
Jeff Brown5912f952013-07-01 19:10:31 -070037#include <input/Input.h>
Jeff Brown5912f952013-07-01 19:10:31 -070038#include <utils/BitSet.h>
Atif Niyaz3d3fa522019-07-25 11:12:39 -070039#include <utils/Errors.h>
40#include <utils/RefBase.h>
41#include <utils/Timers.h>
42#include <utils/Vector.h>
Jeff Brown5912f952013-07-01 19:10:31 -070043
Josh Gao2ccbe3a2019-08-09 14:35:36 -070044#include <android-base/unique_fd.h>
45
Jeff Brown5912f952013-07-01 19:10:31 -070046namespace android {
Robert Carr3720ed02018-08-08 16:08:27 -070047class Parcel;
Jeff Brown5912f952013-07-01 19:10:31 -070048
49/*
50 * Intermediate representation used to send input events and related signals.
Fengwei Yin83e0e422014-05-24 05:32:09 +080051 *
52 * Note that this structure is used for IPCs so its layout must be identical
53 * on 64 and 32 bit processes. This is tested in StructLayout_test.cpp.
Siarhei Vishniakou1f7c0e42018-11-16 22:18:53 -080054 *
55 * Since the struct must be aligned to an 8-byte boundary, there could be uninitialized bytes
56 * in-between the defined fields. This padding data should be explicitly accounted for by adding
57 * "empty" fields into the struct. This data is memset to zero before sending the struct across
58 * the socket. Adding the explicit fields ensures that the memset is not optimized away by the
59 * compiler. When a new field is added to the struct, the corresponding change
60 * in StructLayout_test should be made.
Jeff Brown5912f952013-07-01 19:10:31 -070061 */
62struct InputMessage {
Siarhei Vishniakou52402772019-10-22 09:32:30 -070063 enum class Type : uint32_t {
64 KEY,
65 MOTION,
66 FINISHED,
Jeff Brown5912f952013-07-01 19:10:31 -070067 };
68
69 struct Header {
Siarhei Vishniakou52402772019-10-22 09:32:30 -070070 Type type; // 4 bytes
Fengwei Yin83e0e422014-05-24 05:32:09 +080071 // We don't need this field in order to align the body below but we
72 // leave it here because InputMessage::size() and other functions
73 // compute the size of this structure as sizeof(Header) + sizeof(Body).
74 uint32_t padding;
Jeff Brown5912f952013-07-01 19:10:31 -070075 } header;
76
Fengwei Yin83e0e422014-05-24 05:32:09 +080077 // Body *must* be 8 byte aligned.
Jeff Brown5912f952013-07-01 19:10:31 -070078 union Body {
79 struct Key {
80 uint32_t seq;
Siarhei Vishniakou1f7c0e42018-11-16 22:18:53 -080081 uint32_t empty1;
Fengwei Yin83e0e422014-05-24 05:32:09 +080082 nsecs_t eventTime __attribute__((aligned(8)));
Jeff Brown5912f952013-07-01 19:10:31 -070083 int32_t deviceId;
84 int32_t source;
Siarhei Vishniakoua62a8dd2018-06-08 21:17:33 +010085 int32_t displayId;
Jeff Brown5912f952013-07-01 19:10:31 -070086 int32_t action;
87 int32_t flags;
88 int32_t keyCode;
89 int32_t scanCode;
90 int32_t metaState;
91 int32_t repeatCount;
Siarhei Vishniakou1f7c0e42018-11-16 22:18:53 -080092 uint32_t empty2;
Fengwei Yin83e0e422014-05-24 05:32:09 +080093 nsecs_t downTime __attribute__((aligned(8)));
Jeff Brown5912f952013-07-01 19:10:31 -070094
95 inline size_t size() const {
96 return sizeof(Key);
97 }
98 } key;
99
100 struct Motion {
101 uint32_t seq;
Siarhei Vishniakou1f7c0e42018-11-16 22:18:53 -0800102 uint32_t empty1;
Fengwei Yin83e0e422014-05-24 05:32:09 +0800103 nsecs_t eventTime __attribute__((aligned(8)));
Jeff Brown5912f952013-07-01 19:10:31 -0700104 int32_t deviceId;
105 int32_t source;
Tarandeep Singh58641502017-07-31 10:51:54 -0700106 int32_t displayId;
Jeff Brown5912f952013-07-01 19:10:31 -0700107 int32_t action;
Michael Wright7b159c92015-05-14 14:48:03 +0100108 int32_t actionButton;
Jeff Brown5912f952013-07-01 19:10:31 -0700109 int32_t flags;
110 int32_t metaState;
111 int32_t buttonState;
Siarhei Vishniakou16a2e302019-01-14 19:21:45 -0800112 MotionClassification classification; // base type: uint8_t
113 uint8_t empty2[3];
Jeff Brown5912f952013-07-01 19:10:31 -0700114 int32_t edgeFlags;
Fengwei Yin83e0e422014-05-24 05:32:09 +0800115 nsecs_t downTime __attribute__((aligned(8)));
Jeff Brown5912f952013-07-01 19:10:31 -0700116 float xOffset;
117 float yOffset;
118 float xPrecision;
119 float yPrecision;
Garfield Tan00f511d2019-06-12 16:55:40 -0700120 float xCursorPosition;
121 float yCursorPosition;
Narayan Kamathed5fd382014-05-02 17:53:33 +0100122 uint32_t pointerCount;
Siarhei Vishniakou1f7c0e42018-11-16 22:18:53 -0800123 uint32_t empty3;
Fengwei Yin83e0e422014-05-24 05:32:09 +0800124 // Note that PointerCoords requires 8 byte alignment.
Michael Wrightb03f1032015-05-14 16:29:13 +0100125 struct Pointer {
Jeff Brown5912f952013-07-01 19:10:31 -0700126 PointerProperties properties;
127 PointerCoords coords;
128 } pointers[MAX_POINTERS];
129
130 int32_t getActionId() const {
131 uint32_t index = (action & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK)
132 >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
133 return pointers[index].properties.id;
134 }
135
136 inline size_t size() const {
137 return sizeof(Motion) - sizeof(Pointer) * MAX_POINTERS
138 + sizeof(Pointer) * pointerCount;
139 }
140 } motion;
141
142 struct Finished {
143 uint32_t seq;
144 bool handled;
145
146 inline size_t size() const {
147 return sizeof(Finished);
148 }
149 } finished;
Fengwei Yin83e0e422014-05-24 05:32:09 +0800150 } __attribute__((aligned(8))) body;
Jeff Brown5912f952013-07-01 19:10:31 -0700151
152 bool isValid(size_t actualSize) const;
153 size_t size() const;
Siarhei Vishniakou1f7c0e42018-11-16 22:18:53 -0800154 void getSanitizedCopy(InputMessage* msg) const;
Jeff Brown5912f952013-07-01 19:10:31 -0700155};
156
157/*
158 * An input channel consists of a local unix domain socket used to send and receive
159 * input messages across processes. Each channel has a descriptive name for debugging purposes.
160 *
161 * Each endpoint has its own InputChannel object that specifies its file descriptor.
162 *
163 * The input channel is closed when all references to it are released.
164 */
165class InputChannel : public RefBase {
166protected:
167 virtual ~InputChannel();
168
169public:
Josh Gao2ccbe3a2019-08-09 14:35:36 -0700170 static sp<InputChannel> create(const std::string& name, android::base::unique_fd fd);
Jeff Brown5912f952013-07-01 19:10:31 -0700171
172 /* Creates a pair of input channels.
173 *
174 * Returns OK on success.
175 */
Siarhei Vishniakouf93fcf42017-11-22 16:00:14 -0800176 static status_t openInputChannelPair(const std::string& name,
Jeff Brown5912f952013-07-01 19:10:31 -0700177 sp<InputChannel>& outServerChannel, sp<InputChannel>& outClientChannel);
178
Siarhei Vishniakouf93fcf42017-11-22 16:00:14 -0800179 inline std::string getName() const { return mName; }
Josh Gao2ccbe3a2019-08-09 14:35:36 -0700180 inline int getFd() const { return mFd.get(); }
Jeff Brown5912f952013-07-01 19:10:31 -0700181
182 /* Sends a message to the other endpoint.
183 *
184 * If the channel is full then the message is guaranteed not to have been sent at all.
185 * Try again after the consumer has sent a finished signal indicating that it has
186 * consumed some of the pending messages from the channel.
187 *
188 * Returns OK on success.
189 * Returns WOULD_BLOCK if the channel is full.
190 * Returns DEAD_OBJECT if the channel's peer has been closed.
191 * Other errors probably indicate that the channel is broken.
192 */
193 status_t sendMessage(const InputMessage* msg);
194
195 /* Receives a message sent by the other endpoint.
196 *
197 * If there is no message present, try again after poll() indicates that the fd
198 * is readable.
199 *
200 * Returns OK on success.
201 * Returns WOULD_BLOCK if there is no message present.
202 * Returns DEAD_OBJECT if the channel's peer has been closed.
203 * Other errors probably indicate that the channel is broken.
204 */
205 status_t receiveMessage(InputMessage* msg);
206
207 /* Returns a new object that has a duplicate of this channel's fd. */
208 sp<InputChannel> dup() const;
209
Robert Carr3720ed02018-08-08 16:08:27 -0700210 status_t write(Parcel& out) const;
Josh Gao2ccbe3a2019-08-09 14:35:36 -0700211 static sp<InputChannel> read(const Parcel& from);
Robert Carr3720ed02018-08-08 16:08:27 -0700212
Robert Carr803535b2018-08-02 16:38:15 -0700213 sp<IBinder> getToken() const;
214 void setToken(const sp<IBinder>& token);
215
Jeff Brown5912f952013-07-01 19:10:31 -0700216private:
Josh Gao2ccbe3a2019-08-09 14:35:36 -0700217 InputChannel(const std::string& name, android::base::unique_fd fd);
Siarhei Vishniakouf93fcf42017-11-22 16:00:14 -0800218 std::string mName;
Josh Gao2ccbe3a2019-08-09 14:35:36 -0700219 android::base::unique_fd mFd;
Robert Carr803535b2018-08-02 16:38:15 -0700220
221 sp<IBinder> mToken = nullptr;
Jeff Brown5912f952013-07-01 19:10:31 -0700222};
223
224/*
225 * Publishes input events to an input channel.
226 */
227class InputPublisher {
228public:
229 /* Creates a publisher associated with an input channel. */
230 explicit InputPublisher(const sp<InputChannel>& channel);
231
232 /* Destroys the publisher and releases its input channel. */
233 ~InputPublisher();
234
235 /* Gets the underlying input channel. */
236 inline sp<InputChannel> getChannel() { return mChannel; }
237
238 /* Publishes a key event to the input channel.
239 *
240 * Returns OK on success.
241 * Returns WOULD_BLOCK if the channel is full.
242 * Returns DEAD_OBJECT if the channel's peer has been closed.
243 * Returns BAD_VALUE if seq is 0.
244 * Other errors probably indicate that the channel is broken.
245 */
246 status_t publishKeyEvent(
247 uint32_t seq,
248 int32_t deviceId,
249 int32_t source,
Siarhei Vishniakoua62a8dd2018-06-08 21:17:33 +0100250 int32_t displayId,
Jeff Brown5912f952013-07-01 19:10:31 -0700251 int32_t action,
252 int32_t flags,
253 int32_t keyCode,
254 int32_t scanCode,
255 int32_t metaState,
256 int32_t repeatCount,
257 nsecs_t downTime,
258 nsecs_t eventTime);
259
260 /* Publishes a motion event to the input channel.
261 *
262 * Returns OK on success.
263 * Returns WOULD_BLOCK if the channel is full.
264 * Returns DEAD_OBJECT if the channel's peer has been closed.
265 * Returns BAD_VALUE if seq is 0 or if pointerCount is less than 1 or greater than MAX_POINTERS.
266 * Other errors probably indicate that the channel is broken.
267 */
Garfield Tan00f511d2019-06-12 16:55:40 -0700268 status_t publishMotionEvent(uint32_t seq, int32_t deviceId, int32_t source, int32_t displayId,
269 int32_t action, int32_t actionButton, int32_t flags,
270 int32_t edgeFlags, int32_t metaState, int32_t buttonState,
271 MotionClassification classification, float xOffset, float yOffset,
272 float xPrecision, float yPrecision, float xCursorPosition,
273 float yCursorPosition, nsecs_t downTime, nsecs_t eventTime,
274 uint32_t pointerCount, const PointerProperties* pointerProperties,
275 const PointerCoords* pointerCoords);
Jeff Brown5912f952013-07-01 19:10:31 -0700276
277 /* Receives the finished signal from the consumer in reply to the original dispatch signal.
278 * If a signal was received, returns the message sequence number,
279 * and whether the consumer handled the message.
280 *
281 * The returned sequence number is never 0 unless the operation failed.
282 *
283 * Returns OK on success.
284 * Returns WOULD_BLOCK if there is no signal present.
285 * Returns DEAD_OBJECT if the channel's peer has been closed.
286 * Other errors probably indicate that the channel is broken.
287 */
288 status_t receiveFinishedSignal(uint32_t* outSeq, bool* outHandled);
289
290private:
Atif Niyaz3d3fa522019-07-25 11:12:39 -0700291
Jeff Brown5912f952013-07-01 19:10:31 -0700292 sp<InputChannel> mChannel;
293};
294
295/*
296 * Consumes input events from an input channel.
297 */
298class InputConsumer {
299public:
300 /* Creates a consumer associated with an input channel. */
301 explicit InputConsumer(const sp<InputChannel>& channel);
302
303 /* Destroys the consumer and releases its input channel. */
304 ~InputConsumer();
305
306 /* Gets the underlying input channel. */
307 inline sp<InputChannel> getChannel() { return mChannel; }
308
309 /* Consumes an input event from the input channel and copies its contents into
310 * an InputEvent object created using the specified factory.
311 *
312 * Tries to combine a series of move events into larger batches whenever possible.
313 *
314 * If consumeBatches is false, then defers consuming pending batched events if it
315 * is possible for additional samples to be added to them later. Call hasPendingBatch()
316 * to determine whether a pending batch is available to be consumed.
317 *
318 * If consumeBatches is true, then events are still batched but they are consumed
319 * immediately as soon as the input channel is exhausted.
320 *
321 * The frameTime parameter specifies the time when the current display frame started
322 * rendering in the CLOCK_MONOTONIC time base, or -1 if unknown.
323 *
324 * The returned sequence number is never 0 unless the operation failed.
325 *
326 * Returns OK on success.
327 * Returns WOULD_BLOCK if there is no event present.
328 * Returns DEAD_OBJECT if the channel's peer has been closed.
329 * Returns NO_MEMORY if the event could not be created.
330 * Other errors probably indicate that the channel is broken.
331 */
332 status_t consume(InputEventFactoryInterface* factory, bool consumeBatches,
Siarhei Vishniakou777a10b2018-01-31 16:45:06 -0800333 nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent);
Jeff Brown5912f952013-07-01 19:10:31 -0700334
335 /* Sends a finished signal to the publisher to inform it that the message
336 * with the specified sequence number has finished being process and whether
337 * the message was handled by the consumer.
338 *
339 * Returns OK on success.
340 * Returns BAD_VALUE if seq is 0.
341 * Other errors probably indicate that the channel is broken.
342 */
343 status_t sendFinishedSignal(uint32_t seq, bool handled);
344
345 /* Returns true if there is a deferred event waiting.
346 *
347 * Should be called after calling consume() to determine whether the consumer
348 * has a deferred event to be processed. Deferred events are somewhat special in
349 * that they have already been removed from the input channel. If the input channel
350 * becomes empty, the client may need to do extra work to ensure that it processes
351 * the deferred event despite the fact that the input channel's file descriptor
352 * is not readable.
353 *
354 * One option is simply to call consume() in a loop until it returns WOULD_BLOCK.
355 * This guarantees that all deferred events will be processed.
356 *
357 * Alternately, the caller can call hasDeferredEvent() to determine whether there is
358 * a deferred event waiting and then ensure that its event loop wakes up at least
359 * one more time to consume the deferred event.
360 */
361 bool hasDeferredEvent() const;
362
363 /* Returns true if there is a pending batch.
364 *
365 * Should be called after calling consume() with consumeBatches == false to determine
366 * whether consume() should be called again later on with consumeBatches == true.
367 */
368 bool hasPendingBatch() const;
369
370private:
371 // True if touch resampling is enabled.
372 const bool mResampleTouch;
373
374 // The input channel.
375 sp<InputChannel> mChannel;
376
377 // The current input message.
378 InputMessage mMsg;
379
380 // True if mMsg contains a valid input message that was deferred from the previous
381 // call to consume and that still needs to be handled.
382 bool mMsgDeferred;
383
384 // Batched motion events per device and source.
385 struct Batch {
386 Vector<InputMessage> samples;
387 };
388 Vector<Batch> mBatches;
389
390 // Touch state per device and source, only for sources of class pointer.
391 struct History {
392 nsecs_t eventTime;
393 BitSet32 idBits;
394 int32_t idToIndex[MAX_POINTER_ID + 1];
395 PointerCoords pointers[MAX_POINTERS];
396
Siarhei Vishniakou086a02a2017-06-12 15:01:41 +0100397 void initializeFrom(const InputMessage& msg) {
398 eventTime = msg.body.motion.eventTime;
Jeff Brown5912f952013-07-01 19:10:31 -0700399 idBits.clear();
Siarhei Vishniakou086a02a2017-06-12 15:01:41 +0100400 for (uint32_t i = 0; i < msg.body.motion.pointerCount; i++) {
401 uint32_t id = msg.body.motion.pointers[i].properties.id;
Jeff Brown5912f952013-07-01 19:10:31 -0700402 idBits.markBit(id);
403 idToIndex[id] = i;
Siarhei Vishniakou086a02a2017-06-12 15:01:41 +0100404 pointers[i].copyFrom(msg.body.motion.pointers[i].coords);
Jeff Brown5912f952013-07-01 19:10:31 -0700405 }
406 }
407
Siarhei Vishniakou56c9ae12017-11-06 21:16:47 -0800408 void initializeFrom(const History& other) {
409 eventTime = other.eventTime;
410 idBits = other.idBits; // temporary copy
411 for (size_t i = 0; i < other.idBits.count(); i++) {
412 uint32_t id = idBits.clearFirstMarkedBit();
413 int32_t index = other.idToIndex[id];
414 idToIndex[id] = index;
415 pointers[index].copyFrom(other.pointers[index]);
416 }
417 idBits = other.idBits; // final copy
418 }
419
Jeff Brown5912f952013-07-01 19:10:31 -0700420 const PointerCoords& getPointerById(uint32_t id) const {
421 return pointers[idToIndex[id]];
422 }
Siarhei Vishniakouc7dc3782017-08-24 20:36:28 -0700423
424 bool hasPointerId(uint32_t id) const {
425 return idBits.hasBit(id);
426 }
Jeff Brown5912f952013-07-01 19:10:31 -0700427 };
428 struct TouchState {
429 int32_t deviceId;
430 int32_t source;
431 size_t historyCurrent;
432 size_t historySize;
433 History history[2];
434 History lastResample;
435
436 void initialize(int32_t deviceId, int32_t source) {
437 this->deviceId = deviceId;
438 this->source = source;
439 historyCurrent = 0;
440 historySize = 0;
441 lastResample.eventTime = 0;
442 lastResample.idBits.clear();
443 }
444
Siarhei Vishniakou086a02a2017-06-12 15:01:41 +0100445 void addHistory(const InputMessage& msg) {
Jeff Brown5912f952013-07-01 19:10:31 -0700446 historyCurrent ^= 1;
447 if (historySize < 2) {
448 historySize += 1;
449 }
450 history[historyCurrent].initializeFrom(msg);
451 }
452
453 const History* getHistory(size_t index) const {
454 return &history[(historyCurrent + index) & 1];
455 }
Siarhei Vishniakou086a02a2017-06-12 15:01:41 +0100456
457 bool recentCoordinatesAreIdentical(uint32_t id) const {
458 // Return true if the two most recently received "raw" coordinates are identical
459 if (historySize < 2) {
460 return false;
461 }
Siarhei Vishniakouc7dc3782017-08-24 20:36:28 -0700462 if (!getHistory(0)->hasPointerId(id) || !getHistory(1)->hasPointerId(id)) {
463 return false;
464 }
Siarhei Vishniakou086a02a2017-06-12 15:01:41 +0100465 float currentX = getHistory(0)->getPointerById(id).getX();
466 float currentY = getHistory(0)->getPointerById(id).getY();
467 float previousX = getHistory(1)->getPointerById(id).getX();
468 float previousY = getHistory(1)->getPointerById(id).getY();
469 if (currentX == previousX && currentY == previousY) {
470 return true;
471 }
472 return false;
473 }
Jeff Brown5912f952013-07-01 19:10:31 -0700474 };
475 Vector<TouchState> mTouchStates;
476
477 // Chain of batched sequence numbers. When multiple input messages are combined into
478 // a batch, we append a record here that associates the last sequence number in the
479 // batch with the previous one. When the finished signal is sent, we traverse the
480 // chain to individually finish all input messages that were part of the batch.
481 struct SeqChain {
482 uint32_t seq; // sequence number of batched input message
483 uint32_t chain; // sequence number of previous batched input message
484 };
485 Vector<SeqChain> mSeqChains;
486
487 status_t consumeBatch(InputEventFactoryInterface* factory,
Siarhei Vishniakou777a10b2018-01-31 16:45:06 -0800488 nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent);
Jeff Brown5912f952013-07-01 19:10:31 -0700489 status_t consumeSamples(InputEventFactoryInterface* factory,
Siarhei Vishniakou777a10b2018-01-31 16:45:06 -0800490 Batch& batch, size_t count, uint32_t* outSeq, InputEvent** outEvent);
Jeff Brown5912f952013-07-01 19:10:31 -0700491
Siarhei Vishniakou086a02a2017-06-12 15:01:41 +0100492 void updateTouchState(InputMessage& msg);
Jeff Brown5912f952013-07-01 19:10:31 -0700493 void resampleTouchState(nsecs_t frameTime, MotionEvent* event,
494 const InputMessage *next);
495
496 ssize_t findBatch(int32_t deviceId, int32_t source) const;
497 ssize_t findTouchState(int32_t deviceId, int32_t source) const;
498
499 status_t sendUnchainedFinishedSignal(uint32_t seq, bool handled);
500
Siarhei Vishniakou56c9ae12017-11-06 21:16:47 -0800501 static void rewriteMessage(TouchState& state, InputMessage& msg);
Jeff Brown5912f952013-07-01 19:10:31 -0700502 static void initializeKeyEvent(KeyEvent* event, const InputMessage* msg);
503 static void initializeMotionEvent(MotionEvent* event, const InputMessage* msg);
504 static void addSample(MotionEvent* event, const InputMessage* msg);
505 static bool canAddSample(const Batch& batch, const InputMessage* msg);
506 static ssize_t findSampleNoLaterThan(const Batch& batch, nsecs_t time);
507 static bool shouldResampleTool(int32_t toolType);
508
509 static bool isTouchResamplingEnabled();
510};
511
512} // namespace android
513
514#endif // _LIBINPUT_INPUT_TRANSPORT_H