blob: 7d936baf7a47951fb195e99d44c5323a90ebb22a [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_H
18#define _LIBINPUT_INPUT_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 event structures.
24 */
25
26#include <android/input.h>
Siarhei Vishniakou5d552c42021-05-21 05:02:22 +000027#include <android/os/IInputConstants.h>
Garfield Tanab0ab9c2019-07-10 18:58:28 -070028#include <math.h>
Garfield Tan00f511d2019-06-12 16:55:40 -070029#include <stdint.h>
chaviwfd9c1ed2020-07-01 10:57:59 -070030#include <ui/Transform.h>
Michael Wrightd0bd3912014-03-19 12:06:10 -070031#include <utils/BitSet.h>
Jeff Brown5912f952013-07-01 19:10:31 -070032#include <utils/KeyedVector.h>
Jeff Brown5912f952013-07-01 19:10:31 -070033#include <utils/RefBase.h>
Michael Wrightd0bd3912014-03-19 12:06:10 -070034#include <utils/Timers.h>
35#include <utils/Vector.h>
Siarhei Vishniakou9c858ac2020-01-23 14:20:11 -060036#include <array>
Garfield Tan00f511d2019-06-12 16:55:40 -070037#include <limits>
Siarhei Vishniakou727a44e2019-11-23 12:59:16 -080038#include <queue>
Jeff Brown5912f952013-07-01 19:10:31 -070039
Jeff Brown5912f952013-07-01 19:10:31 -070040/*
41 * Additional private constants not defined in ndk/ui/input.h.
42 */
43enum {
44 /* Signifies that the key is being predispatched */
45 AKEY_EVENT_FLAG_PREDISPATCH = 0x20000000,
46
47 /* Private control to determine when an app is tracking a key sequence. */
48 AKEY_EVENT_FLAG_START_TRACKING = 0x40000000,
49
50 /* Key event is inconsistent with previously sent key events. */
51 AKEY_EVENT_FLAG_TAINTED = 0x80000000,
52};
53
54enum {
Michael Wrightcdcd8f22016-03-22 16:52:13 -070055
56 /**
57 * This flag indicates that the window that received this motion event is partly
58 * or wholly obscured by another visible window above it. This flag is set to true
59 * even if the event did not directly pass through the obscured area.
60 * A security sensitive application can check this flag to identify situations in which
61 * a malicious application may have covered up part of its content for the purpose
62 * of misleading the user or hijacking touches. An appropriate response might be
63 * to drop the suspect touches or to take additional precautions to confirm the user's
64 * actual intent.
65 */
66 AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED = 0x2,
67
Prabir Pradhan141a9862018-11-19 14:35:56 -080068 /**
69 * This flag indicates that the event has been generated by a gesture generator. It
70 * provides a hint to the GestureDetector to not apply any touch slop.
71 */
72 AMOTION_EVENT_FLAG_IS_GENERATED_GESTURE = 0x8,
73
Prabir Pradhan47cf0a02021-03-11 20:30:57 -080074 /**
75 * This flag indicates that the event will not cause a focus change if it is directed to an
76 * unfocused window, even if it an ACTION_DOWN. This is typically used with pointer
77 * gestures to allow the user to direct gestures to an unfocused window without bringing it
78 * into focus.
79 */
80 AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE = 0x40,
81
Jeff Brown5912f952013-07-01 19:10:31 -070082 /* Motion event is inconsistent with previously sent motion events. */
83 AMOTION_EVENT_FLAG_TAINTED = 0x80000000,
84};
85
Siarhei Vishniakou54d3e182020-01-15 17:38:38 -080086/**
87 * Allowed VerifiedKeyEvent flags. All other flags from KeyEvent do not get verified.
88 * These values must be kept in sync with VerifiedKeyEvent.java
89 */
90constexpr int32_t VERIFIED_KEY_EVENT_FLAGS = AKEY_EVENT_FLAG_CANCELED;
91
92/**
93 * Allowed VerifiedMotionEventFlags. All other flags from MotionEvent do not get verified.
94 * These values must be kept in sync with VerifiedMotionEvent.java
95 */
96constexpr int32_t VERIFIED_MOTION_EVENT_FLAGS =
97 AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED | AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED;
98
arthurhungcc7f9802020-04-30 17:55:40 +080099/**
100 * This flag indicates that the point up event has been canceled.
101 * Typically this is used for palm event when the user has accidental touches.
102 * TODO: Adjust flag to public api
103 */
104constexpr int32_t AMOTION_EVENT_FLAG_CANCELED = 0x20;
105
Jeff Brown5912f952013-07-01 19:10:31 -0700106enum {
107 /* Used when a motion event is not associated with any display.
108 * Typically used for non-pointer events. */
109 ADISPLAY_ID_NONE = -1,
110
111 /* The default display id. */
112 ADISPLAY_ID_DEFAULT = 0,
113};
114
115enum {
116 /*
117 * Indicates that an input device has switches.
118 * This input source flag is hidden from the API because switches are only used by the system
119 * and applications have no way to interact with them.
120 */
121 AINPUT_SOURCE_SWITCH = 0x80000000,
122};
123
Michael Wright962a1082013-10-17 17:35:53 -0700124enum {
125 /**
126 * Constants for LEDs. Hidden from the API since we don't actually expose a way to interact
127 * with LEDs to developers
128 *
Michael Wright872db4f2014-04-22 15:03:51 -0700129 * NOTE: If you add LEDs here, you must also add them to InputEventLabels.h
Michael Wright962a1082013-10-17 17:35:53 -0700130 */
131
132 ALED_NUM_LOCK = 0x00,
133 ALED_CAPS_LOCK = 0x01,
134 ALED_SCROLL_LOCK = 0x02,
135 ALED_COMPOSE = 0x03,
136 ALED_KANA = 0x04,
137 ALED_SLEEP = 0x05,
138 ALED_SUSPEND = 0x06,
139 ALED_MUTE = 0x07,
140 ALED_MISC = 0x08,
141 ALED_MAIL = 0x09,
142 ALED_CHARGING = 0x0a,
143 ALED_CONTROLLER_1 = 0x10,
144 ALED_CONTROLLER_2 = 0x11,
145 ALED_CONTROLLER_3 = 0x12,
146 ALED_CONTROLLER_4 = 0x13,
147};
148
Michael Wright9b04f862013-10-18 17:53:50 -0700149/* Maximum number of controller LEDs we support */
150#define MAX_CONTROLLER_LEDS 4
151
Jeff Brown5912f952013-07-01 19:10:31 -0700152/*
Jeff Brown5912f952013-07-01 19:10:31 -0700153 * Maximum number of pointers supported per motion event.
154 * Smallest number of pointers is 1.
155 * (We want at least 10 but some touch controllers obstensibly configured for 10 pointers
156 * will occasionally emit 11. There is not much harm making this constant bigger.)
157 */
158#define MAX_POINTERS 16
159
160/*
Flanker552a8a52015-09-07 15:28:58 +0800161 * Maximum number of samples supported per motion event.
162 */
163#define MAX_SAMPLES UINT16_MAX
164
165/*
Jeff Brown5912f952013-07-01 19:10:31 -0700166 * Maximum pointer id value supported in a motion event.
167 * Smallest pointer id is 0.
168 * (This is limited by our use of BitSet32 to track pointer assignments.)
169 */
170#define MAX_POINTER_ID 31
171
172/*
173 * Declare a concrete type for the NDK's input event forward declaration.
174 */
175struct AInputEvent {
176 virtual ~AInputEvent() { }
177};
178
179/*
180 * Declare a concrete type for the NDK's input device forward declaration.
181 */
182struct AInputDevice {
183 virtual ~AInputDevice() { }
184};
185
186
187namespace android {
188
Brett Chabotfaa986c2020-11-04 17:39:36 -0800189#ifdef __linux__
Jeff Brown5912f952013-07-01 19:10:31 -0700190class Parcel;
Brett Chabotfaa986c2020-11-04 17:39:36 -0800191#endif
Jeff Brown5912f952013-07-01 19:10:31 -0700192
Siarhei Vishniakou7feb2ea2019-11-25 15:11:23 -0800193const char* inputEventTypeToString(int32_t type);
194
Jeff Brown5912f952013-07-01 19:10:31 -0700195/*
196 * Flags that flow alongside events in the input dispatch system to help with certain
197 * policy decisions such as waking from device sleep.
198 *
199 * These flags are also defined in frameworks/base/core/java/android/view/WindowManagerPolicy.java.
200 */
201enum {
202 /* These flags originate in RawEvents and are generally set in the key map.
Michael Wright872db4f2014-04-22 15:03:51 -0700203 * NOTE: If you want a flag to be able to set in a keylayout file, then you must add it to
204 * InputEventLabels.h as well. */
Jeff Brown5912f952013-07-01 19:10:31 -0700205
Jeff Brownc9aa6282015-02-11 19:03:28 -0800206 // Indicates that the event should wake the device.
Jeff Brown5912f952013-07-01 19:10:31 -0700207 POLICY_FLAG_WAKE = 0x00000001,
Jeff Brownc9aa6282015-02-11 19:03:28 -0800208
209 // Indicates that the key is virtual, such as a capacitive button, and should
210 // generate haptic feedback. Virtual keys may be suppressed for some time
211 // after a recent touch to prevent accidental activation of virtual keys adjacent
212 // to the touch screen during an edge swipe.
Michael Wright872db4f2014-04-22 15:03:51 -0700213 POLICY_FLAG_VIRTUAL = 0x00000002,
Jeff Brownc9aa6282015-02-11 19:03:28 -0800214
215 // Indicates that the key is the special function modifier.
Michael Wright872db4f2014-04-22 15:03:51 -0700216 POLICY_FLAG_FUNCTION = 0x00000004,
Jeff Brown5912f952013-07-01 19:10:31 -0700217
Jeff Brownc9aa6282015-02-11 19:03:28 -0800218 // Indicates that the key represents a special gesture that has been detected by
219 // the touch firmware or driver. Causes touch events from the same device to be canceled.
220 POLICY_FLAG_GESTURE = 0x00000008,
221
Jeff Brown5912f952013-07-01 19:10:31 -0700222 POLICY_FLAG_RAW_MASK = 0x0000ffff,
223
Siarhei Vishniakou5d552c42021-05-21 05:02:22 +0000224 POLICY_FLAG_INPUTFILTER_TRUSTED = android::os::IInputConstants::POLICY_FLAG_INPUTFILTER_TRUSTED,
225
226 POLICY_FLAG_INJECTED_FROM_ACCESSIBILITY =
227 android::os::IInputConstants::POLICY_FLAG_INJECTED_FROM_ACCESSIBILITY,
228
Jeff Brown5912f952013-07-01 19:10:31 -0700229 /* These flags are set by the input dispatcher. */
230
231 // Indicates that the input event was injected.
232 POLICY_FLAG_INJECTED = 0x01000000,
233
234 // Indicates that the input event is from a trusted source such as a directly attached
235 // input device or an application with system-wide event injection permission.
236 POLICY_FLAG_TRUSTED = 0x02000000,
237
238 // Indicates that the input event has passed through an input filter.
239 POLICY_FLAG_FILTERED = 0x04000000,
240
241 // Disables automatic key repeating behavior.
242 POLICY_FLAG_DISABLE_KEY_REPEAT = 0x08000000,
243
244 /* These flags are set by the input reader policy as it intercepts each event. */
245
Jeff Browndb19e462014-04-08 19:55:38 -0700246 // Indicates that the device was in an interactive state when the
247 // event was intercepted.
248 POLICY_FLAG_INTERACTIVE = 0x20000000,
Jeff Brown5912f952013-07-01 19:10:31 -0700249
250 // Indicates that the event should be dispatched to applications.
251 // The input event should still be sent to the InputDispatcher so that it can see all
252 // input events received include those that it will not deliver.
253 POLICY_FLAG_PASS_TO_USER = 0x40000000,
254};
255
Siarhei Vishniakou49e59222018-12-28 18:17:15 -0800256/**
257 * Classifications of the current gesture, if available.
258 *
259 * The following values must be kept in sync with MotionEvent.java
260 */
261enum class MotionClassification : uint8_t {
262 /**
263 * No classification is available.
264 */
265 NONE = 0,
266 /**
267 * Too early to classify the current gesture. Need more events. Look for changes in the
268 * upcoming motion events.
269 */
270 AMBIGUOUS_GESTURE = 1,
271 /**
272 * The current gesture likely represents a user intentionally exerting force on the touchscreen.
273 */
274 DEEP_PRESS = 2,
275};
276
Siarhei Vishniakou16a2e302019-01-14 19:21:45 -0800277/**
278 * String representation of MotionClassification
279 */
280const char* motionClassificationToString(MotionClassification classification);
281
Garfield Tan00f511d2019-06-12 16:55:40 -0700282/**
Siarhei Vishniakouf94ae022021-02-04 01:23:17 +0000283 * Portion of FrameMetrics timeline of interest to input code.
284 */
285enum GraphicsTimeline : size_t {
286 /** Time when the app sent the buffer to SurfaceFlinger. */
287 GPU_COMPLETED_TIME = 0,
288
289 /** Time when the frame was presented on the display */
290 PRESENT_TIME = 1,
291
292 /** Total size of the 'GraphicsTimeline' array. Must always be last. */
293 SIZE = 2
294};
295
296/**
Garfield Tan84b087e2020-01-23 10:49:05 -0800297 * Generator of unique numbers used to identify input events.
298 *
299 * Layout of ID:
300 * |--------------------------|---------------------------|
301 * | 2 bits for source | 30 bits for random number |
302 * |--------------------------|---------------------------|
303 */
304class IdGenerator {
305private:
306 static constexpr uint32_t SOURCE_SHIFT = 30;
307
308public:
309 // Used to divide integer space to ensure no conflict among these sources./
310 enum class Source : int32_t {
Garfield Tan750c7f42020-05-18 17:41:46 -0700311 INPUT_READER = static_cast<int32_t>(0x0u << SOURCE_SHIFT),
312 INPUT_DISPATCHER = static_cast<int32_t>(0x1u << SOURCE_SHIFT),
313 OTHER = static_cast<int32_t>(0x3u << SOURCE_SHIFT), // E.g. app injected events
Garfield Tan84b087e2020-01-23 10:49:05 -0800314 };
315 IdGenerator(Source source);
316
317 int32_t nextId() const;
318
319 // Extract source from given id.
320 static inline Source getSource(int32_t id) { return static_cast<Source>(SOURCE_MASK & id); }
321
322private:
323 const Source mSource;
324
Garfield Tan750c7f42020-05-18 17:41:46 -0700325 static constexpr int32_t SOURCE_MASK = static_cast<int32_t>(0x3u << SOURCE_SHIFT);
Garfield Tan84b087e2020-01-23 10:49:05 -0800326};
327
328/**
Garfield Tan00f511d2019-06-12 16:55:40 -0700329 * Invalid value for cursor position. Used for non-mouse events, tests and injected events. Don't
330 * use it for direct comparison with any other value, because NaN isn't equal to itself according to
331 * IEEE 754. Use isnan() instead to check if a cursor position is valid.
332 */
333constexpr float AMOTION_EVENT_INVALID_CURSOR_POSITION = std::numeric_limits<float>::quiet_NaN();
334
Evan Rosky84f07f02021-04-16 10:42:42 -0700335/**
336 * Invalid value for display size. Used when display size isn't available for an event or doesn't
337 * matter. This is just a constant 0 so that it has no effect if unused.
338 */
339constexpr int32_t AMOTION_EVENT_INVALID_DISPLAY_SIZE = 0;
340
Jeff Brown5912f952013-07-01 19:10:31 -0700341/*
342 * Pointer coordinate data.
343 */
344struct PointerCoords {
Michael Wright8f6710f2014-06-09 18:56:43 -0700345 enum { MAX_AXES = 30 }; // 30 so that sizeof(PointerCoords) == 128
Jeff Brown5912f952013-07-01 19:10:31 -0700346
347 // Bitfield of axes that are present in this structure.
Fengwei Yin83e0e422014-05-24 05:32:09 +0800348 uint64_t bits __attribute__((aligned(8)));
Jeff Brown5912f952013-07-01 19:10:31 -0700349
350 // Values of axes that are stored in this structure packed in order by axis id
351 // for each axis that is present in the structure according to 'bits'.
352 float values[MAX_AXES];
353
354 inline void clear() {
Michael Wrightd0bd3912014-03-19 12:06:10 -0700355 BitSet64::clear(bits);
356 }
357
358 bool isEmpty() const {
359 return BitSet64::isEmpty(bits);
Jeff Brown5912f952013-07-01 19:10:31 -0700360 }
361
362 float getAxisValue(int32_t axis) const;
363 status_t setAxisValue(int32_t axis, float value);
364
Robert Carre07e1032018-11-26 12:55:53 -0800365 void scale(float globalScale);
366
367 // Scale the pointer coordinates according to a global scale and a
368 // window scale. The global scale will be applied to TOUCH/TOOL_MAJOR/MINOR
369 // axes, however the window scaling will not.
370 void scale(float globalScale, float windowXScale, float windowYScale);
Jeff Browned4d28d2014-02-11 14:28:48 -0800371 void applyOffset(float xOffset, float yOffset);
Jeff Brown5912f952013-07-01 19:10:31 -0700372
chaviwc01e1372020-07-01 12:37:31 -0700373 void transform(const ui::Transform& transform);
374
Jeff Brown5912f952013-07-01 19:10:31 -0700375 inline float getX() const {
376 return getAxisValue(AMOTION_EVENT_AXIS_X);
377 }
378
379 inline float getY() const {
380 return getAxisValue(AMOTION_EVENT_AXIS_Y);
381 }
382
Evan Rosky84f07f02021-04-16 10:42:42 -0700383 vec2 getXYValue() const { return vec2(getX(), getY()); }
384
Brett Chabotfaa986c2020-11-04 17:39:36 -0800385#ifdef __linux__
Jeff Brown5912f952013-07-01 19:10:31 -0700386 status_t readFromParcel(Parcel* parcel);
387 status_t writeToParcel(Parcel* parcel) const;
Brett Chabotfaa986c2020-11-04 17:39:36 -0800388#endif
Jeff Brown5912f952013-07-01 19:10:31 -0700389
390 bool operator==(const PointerCoords& other) const;
391 inline bool operator!=(const PointerCoords& other) const {
392 return !(*this == other);
393 }
394
395 void copyFrom(const PointerCoords& other);
396
397private:
398 void tooManyAxes(int axis);
399};
400
401/*
402 * Pointer property data.
403 */
404struct PointerProperties {
405 // The id of the pointer.
406 int32_t id;
407
408 // The pointer tool type.
409 int32_t toolType;
410
411 inline void clear() {
412 id = -1;
413 toolType = 0;
414 }
415
416 bool operator==(const PointerProperties& other) const;
417 inline bool operator!=(const PointerProperties& other) const {
418 return !(*this == other);
419 }
420
421 void copyFrom(const PointerProperties& other);
422};
423
424/*
425 * Input events.
426 */
427class InputEvent : public AInputEvent {
428public:
429 virtual ~InputEvent() { }
430
431 virtual int32_t getType() const = 0;
432
Garfield Tan4cc839f2020-01-24 11:26:14 -0800433 inline int32_t getId() const { return mId; }
434
Jeff Brown5912f952013-07-01 19:10:31 -0700435 inline int32_t getDeviceId() const { return mDeviceId; }
436
Siarhei Vishniakou3826d472020-01-27 10:44:40 -0600437 inline uint32_t getSource() const { return mSource; }
Jeff Brown5912f952013-07-01 19:10:31 -0700438
Siarhei Vishniakou3826d472020-01-27 10:44:40 -0600439 inline void setSource(uint32_t source) { mSource = source; }
Jeff Brown5912f952013-07-01 19:10:31 -0700440
Siarhei Vishniakoua62a8dd2018-06-08 21:17:33 +0100441 inline int32_t getDisplayId() const { return mDisplayId; }
442
443 inline void setDisplayId(int32_t displayId) { mDisplayId = displayId; }
444
Siarhei Vishniakou9c858ac2020-01-23 14:20:11 -0600445 inline std::array<uint8_t, 32> getHmac() const { return mHmac; }
Siarhei Vishniakoua62a8dd2018-06-08 21:17:33 +0100446
Garfield Tan4cc839f2020-01-24 11:26:14 -0800447 static int32_t nextId();
448
Jeff Brown5912f952013-07-01 19:10:31 -0700449protected:
Garfield Tan4cc839f2020-01-24 11:26:14 -0800450 void initialize(int32_t id, int32_t deviceId, uint32_t source, int32_t displayId,
Siarhei Vishniakou9c858ac2020-01-23 14:20:11 -0600451 std::array<uint8_t, 32> hmac);
Garfield Tan4cc839f2020-01-24 11:26:14 -0800452
Jeff Brown5912f952013-07-01 19:10:31 -0700453 void initialize(const InputEvent& from);
454
Garfield Tan4cc839f2020-01-24 11:26:14 -0800455 int32_t mId;
Jeff Brown5912f952013-07-01 19:10:31 -0700456 int32_t mDeviceId;
Siarhei Vishniakou3826d472020-01-27 10:44:40 -0600457 uint32_t mSource;
Siarhei Vishniakoua62a8dd2018-06-08 21:17:33 +0100458 int32_t mDisplayId;
Siarhei Vishniakou9c858ac2020-01-23 14:20:11 -0600459 std::array<uint8_t, 32> mHmac;
Jeff Brown5912f952013-07-01 19:10:31 -0700460};
461
462/*
463 * Key events.
464 */
465class KeyEvent : public InputEvent {
466public:
467 virtual ~KeyEvent() { }
468
469 virtual int32_t getType() const { return AINPUT_EVENT_TYPE_KEY; }
470
471 inline int32_t getAction() const { return mAction; }
472
473 inline int32_t getFlags() const { return mFlags; }
474
475 inline void setFlags(int32_t flags) { mFlags = flags; }
476
477 inline int32_t getKeyCode() const { return mKeyCode; }
478
479 inline int32_t getScanCode() const { return mScanCode; }
480
481 inline int32_t getMetaState() const { return mMetaState; }
482
483 inline int32_t getRepeatCount() const { return mRepeatCount; }
484
485 inline nsecs_t getDownTime() const { return mDownTime; }
486
487 inline nsecs_t getEventTime() const { return mEventTime; }
488
Michael Wright872db4f2014-04-22 15:03:51 -0700489 static const char* getLabel(int32_t keyCode);
490 static int32_t getKeyCodeFromLabel(const char* label);
Siarhei Vishniakou777a10b2018-01-31 16:45:06 -0800491
Garfield Tan4cc839f2020-01-24 11:26:14 -0800492 void initialize(int32_t id, int32_t deviceId, uint32_t source, int32_t displayId,
Siarhei Vishniakou9c858ac2020-01-23 14:20:11 -0600493 std::array<uint8_t, 32> hmac, int32_t action, int32_t flags, int32_t keyCode,
494 int32_t scanCode, int32_t metaState, int32_t repeatCount, nsecs_t downTime,
495 nsecs_t eventTime);
Jeff Brown5912f952013-07-01 19:10:31 -0700496 void initialize(const KeyEvent& from);
497
Siarhei Vishniakoud44dddf2020-03-25 16:16:40 -0700498 static const char* actionToString(int32_t action);
499
Jeff Brown5912f952013-07-01 19:10:31 -0700500protected:
501 int32_t mAction;
502 int32_t mFlags;
503 int32_t mKeyCode;
504 int32_t mScanCode;
505 int32_t mMetaState;
506 int32_t mRepeatCount;
507 nsecs_t mDownTime;
508 nsecs_t mEventTime;
509};
510
511/*
512 * Motion events.
513 */
514class MotionEvent : public InputEvent {
515public:
516 virtual ~MotionEvent() { }
517
518 virtual int32_t getType() const { return AINPUT_EVENT_TYPE_MOTION; }
519
520 inline int32_t getAction() const { return mAction; }
521
522 inline int32_t getActionMasked() const { return mAction & AMOTION_EVENT_ACTION_MASK; }
523
524 inline int32_t getActionIndex() const {
525 return (mAction & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK)
526 >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
527 }
528
529 inline void setAction(int32_t action) { mAction = action; }
530
531 inline int32_t getFlags() const { return mFlags; }
532
533 inline void setFlags(int32_t flags) { mFlags = flags; }
534
535 inline int32_t getEdgeFlags() const { return mEdgeFlags; }
536
537 inline void setEdgeFlags(int32_t edgeFlags) { mEdgeFlags = edgeFlags; }
538
539 inline int32_t getMetaState() const { return mMetaState; }
540
541 inline void setMetaState(int32_t metaState) { mMetaState = metaState; }
542
543 inline int32_t getButtonState() const { return mButtonState; }
544
Michael Wright6db58792016-09-14 19:53:37 +0100545 inline void setButtonState(int32_t buttonState) { mButtonState = buttonState; }
Michael Wright7b159c92015-05-14 14:48:03 +0100546
Siarhei Vishniakou49e59222018-12-28 18:17:15 -0800547 inline MotionClassification getClassification() const { return mClassification; }
548
Michael Wright7b159c92015-05-14 14:48:03 +0100549 inline int32_t getActionButton() const { return mActionButton; }
550
Michael Wright21957b92015-06-17 21:06:54 +0100551 inline void setActionButton(int32_t button) { mActionButton = button; }
552
chaviw9eaa22c2020-07-01 16:21:27 -0700553 inline float getXOffset() const { return mTransform.tx(); }
Siarhei Vishniakou9c858ac2020-01-23 14:20:11 -0600554
chaviw9eaa22c2020-07-01 16:21:27 -0700555 inline float getYOffset() const { return mTransform.ty(); }
Siarhei Vishniakou9c858ac2020-01-23 14:20:11 -0600556
chaviw9eaa22c2020-07-01 16:21:27 -0700557 inline ui::Transform getTransform() const { return mTransform; }
Jeff Brown5912f952013-07-01 19:10:31 -0700558
559 inline float getXPrecision() const { return mXPrecision; }
560
561 inline float getYPrecision() const { return mYPrecision; }
562
Garfield Tan937bb832019-07-25 17:48:31 -0700563 inline float getRawXCursorPosition() const { return mRawXCursorPosition; }
Garfield Tan00f511d2019-06-12 16:55:40 -0700564
565 float getXCursorPosition() const;
566
Garfield Tan937bb832019-07-25 17:48:31 -0700567 inline float getRawYCursorPosition() const { return mRawYCursorPosition; }
Garfield Tan00f511d2019-06-12 16:55:40 -0700568
569 float getYCursorPosition() const;
570
Garfield Tan937bb832019-07-25 17:48:31 -0700571 void setCursorPosition(float x, float y);
572
Evan Rosky84f07f02021-04-16 10:42:42 -0700573 int2 getDisplaySize() const { return {mDisplayWidth, mDisplayHeight}; }
574
Garfield Tanab0ab9c2019-07-10 18:58:28 -0700575 static inline bool isValidCursorPosition(float x, float y) { return !isnan(x) && !isnan(y); }
576
Jeff Brown5912f952013-07-01 19:10:31 -0700577 inline nsecs_t getDownTime() const { return mDownTime; }
578
579 inline void setDownTime(nsecs_t downTime) { mDownTime = downTime; }
580
581 inline size_t getPointerCount() const { return mPointerProperties.size(); }
582
583 inline const PointerProperties* getPointerProperties(size_t pointerIndex) const {
584 return &mPointerProperties[pointerIndex];
585 }
586
587 inline int32_t getPointerId(size_t pointerIndex) const {
588 return mPointerProperties[pointerIndex].id;
589 }
590
591 inline int32_t getToolType(size_t pointerIndex) const {
592 return mPointerProperties[pointerIndex].toolType;
593 }
594
595 inline nsecs_t getEventTime() const { return mSampleEventTimes[getHistorySize()]; }
596
Evan Rosky84f07f02021-04-16 10:42:42 -0700597 /**
598 * The actual raw pointer coords: whatever comes from the input device without any external
599 * transforms applied.
600 */
Jeff Brown5912f952013-07-01 19:10:31 -0700601 const PointerCoords* getRawPointerCoords(size_t pointerIndex) const;
602
Evan Rosky84f07f02021-04-16 10:42:42 -0700603 /**
604 * This is the raw axis value. However, for X/Y axes, this currently applies a "compat-raw"
605 * transform because many apps (incorrectly) assumed that raw == oriented-screen-space.
606 * "compat raw" is raw coordinates with screen rotation applied.
607 */
Jeff Brown5912f952013-07-01 19:10:31 -0700608 float getRawAxisValue(int32_t axis, size_t pointerIndex) const;
609
610 inline float getRawX(size_t pointerIndex) const {
611 return getRawAxisValue(AMOTION_EVENT_AXIS_X, pointerIndex);
612 }
613
614 inline float getRawY(size_t pointerIndex) const {
615 return getRawAxisValue(AMOTION_EVENT_AXIS_Y, pointerIndex);
616 }
617
618 float getAxisValue(int32_t axis, size_t pointerIndex) const;
619
Siarhei Vishniakou69e4d0f2020-09-14 19:53:29 -0500620 /**
621 * Get the X coordinate of the latest sample in this MotionEvent for pointer 'pointerIndex'.
622 * Identical to calling getHistoricalX(pointerIndex, getHistorySize()).
623 */
Jeff Brown5912f952013-07-01 19:10:31 -0700624 inline float getX(size_t pointerIndex) const {
625 return getAxisValue(AMOTION_EVENT_AXIS_X, pointerIndex);
626 }
627
Siarhei Vishniakou69e4d0f2020-09-14 19:53:29 -0500628 /**
629 * Get the Y coordinate of the latest sample in this MotionEvent for pointer 'pointerIndex'.
630 * Identical to calling getHistoricalX(pointerIndex, getHistorySize()).
631 */
Jeff Brown5912f952013-07-01 19:10:31 -0700632 inline float getY(size_t pointerIndex) const {
633 return getAxisValue(AMOTION_EVENT_AXIS_Y, pointerIndex);
634 }
635
636 inline float getPressure(size_t pointerIndex) const {
637 return getAxisValue(AMOTION_EVENT_AXIS_PRESSURE, pointerIndex);
638 }
639
640 inline float getSize(size_t pointerIndex) const {
641 return getAxisValue(AMOTION_EVENT_AXIS_SIZE, pointerIndex);
642 }
643
644 inline float getTouchMajor(size_t pointerIndex) const {
645 return getAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR, pointerIndex);
646 }
647
648 inline float getTouchMinor(size_t pointerIndex) const {
649 return getAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR, pointerIndex);
650 }
651
652 inline float getToolMajor(size_t pointerIndex) const {
653 return getAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR, pointerIndex);
654 }
655
656 inline float getToolMinor(size_t pointerIndex) const {
657 return getAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR, pointerIndex);
658 }
659
660 inline float getOrientation(size_t pointerIndex) const {
661 return getAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, pointerIndex);
662 }
663
664 inline size_t getHistorySize() const { return mSampleEventTimes.size() - 1; }
665
666 inline nsecs_t getHistoricalEventTime(size_t historicalIndex) const {
667 return mSampleEventTimes[historicalIndex];
668 }
669
Evan Rosky84f07f02021-04-16 10:42:42 -0700670 /**
671 * The actual raw pointer coords: whatever comes from the input device without any external
672 * transforms applied.
673 */
Jeff Brown5912f952013-07-01 19:10:31 -0700674 const PointerCoords* getHistoricalRawPointerCoords(
675 size_t pointerIndex, size_t historicalIndex) const;
676
Evan Rosky84f07f02021-04-16 10:42:42 -0700677 /**
678 * This is the raw axis value. However, for X/Y axes, this currently applies a "compat-raw"
679 * transform because many apps (incorrectly) assumed that raw == oriented-screen-space.
680 * "compat raw" is raw coordinates with screen rotation applied.
681 */
Jeff Brown5912f952013-07-01 19:10:31 -0700682 float getHistoricalRawAxisValue(int32_t axis, size_t pointerIndex,
683 size_t historicalIndex) const;
684
685 inline float getHistoricalRawX(size_t pointerIndex, size_t historicalIndex) const {
686 return getHistoricalRawAxisValue(
687 AMOTION_EVENT_AXIS_X, pointerIndex, historicalIndex);
688 }
689
690 inline float getHistoricalRawY(size_t pointerIndex, size_t historicalIndex) const {
691 return getHistoricalRawAxisValue(
692 AMOTION_EVENT_AXIS_Y, pointerIndex, historicalIndex);
693 }
694
695 float getHistoricalAxisValue(int32_t axis, size_t pointerIndex, size_t historicalIndex) const;
696
697 inline float getHistoricalX(size_t pointerIndex, size_t historicalIndex) const {
698 return getHistoricalAxisValue(
699 AMOTION_EVENT_AXIS_X, pointerIndex, historicalIndex);
700 }
701
702 inline float getHistoricalY(size_t pointerIndex, size_t historicalIndex) const {
703 return getHistoricalAxisValue(
704 AMOTION_EVENT_AXIS_Y, pointerIndex, historicalIndex);
705 }
706
707 inline float getHistoricalPressure(size_t pointerIndex, size_t historicalIndex) const {
708 return getHistoricalAxisValue(
709 AMOTION_EVENT_AXIS_PRESSURE, pointerIndex, historicalIndex);
710 }
711
712 inline float getHistoricalSize(size_t pointerIndex, size_t historicalIndex) const {
713 return getHistoricalAxisValue(
714 AMOTION_EVENT_AXIS_SIZE, pointerIndex, historicalIndex);
715 }
716
717 inline float getHistoricalTouchMajor(size_t pointerIndex, size_t historicalIndex) const {
718 return getHistoricalAxisValue(
719 AMOTION_EVENT_AXIS_TOUCH_MAJOR, pointerIndex, historicalIndex);
720 }
721
722 inline float getHistoricalTouchMinor(size_t pointerIndex, size_t historicalIndex) const {
723 return getHistoricalAxisValue(
724 AMOTION_EVENT_AXIS_TOUCH_MINOR, pointerIndex, historicalIndex);
725 }
726
727 inline float getHistoricalToolMajor(size_t pointerIndex, size_t historicalIndex) const {
728 return getHistoricalAxisValue(
729 AMOTION_EVENT_AXIS_TOOL_MAJOR, pointerIndex, historicalIndex);
730 }
731
732 inline float getHistoricalToolMinor(size_t pointerIndex, size_t historicalIndex) const {
733 return getHistoricalAxisValue(
734 AMOTION_EVENT_AXIS_TOOL_MINOR, pointerIndex, historicalIndex);
735 }
736
737 inline float getHistoricalOrientation(size_t pointerIndex, size_t historicalIndex) const {
738 return getHistoricalAxisValue(
739 AMOTION_EVENT_AXIS_ORIENTATION, pointerIndex, historicalIndex);
740 }
741
742 ssize_t findPointerIndex(int32_t pointerId) const;
743
Garfield Tan4cc839f2020-01-24 11:26:14 -0800744 void initialize(int32_t id, int32_t deviceId, uint32_t source, int32_t displayId,
Siarhei Vishniakou9c858ac2020-01-23 14:20:11 -0600745 std::array<uint8_t, 32> hmac, int32_t action, int32_t actionButton,
746 int32_t flags, int32_t edgeFlags, int32_t metaState, int32_t buttonState,
chaviw9eaa22c2020-07-01 16:21:27 -0700747 MotionClassification classification, const ui::Transform& transform,
748 float xPrecision, float yPrecision, float rawXCursorPosition,
Evan Rosky84f07f02021-04-16 10:42:42 -0700749 float rawYCursorPosition, int32_t displayWidth, int32_t displayHeight,
750 nsecs_t downTime, nsecs_t eventTime, size_t pointerCount,
751 const PointerProperties* pointerProperties, const PointerCoords* pointerCoords);
Jeff Brown5912f952013-07-01 19:10:31 -0700752
753 void copyFrom(const MotionEvent* other, bool keepHistory);
754
755 void addSample(
756 nsecs_t eventTime,
757 const PointerCoords* pointerCoords);
758
759 void offsetLocation(float xOffset, float yOffset);
760
Robert Carre07e1032018-11-26 12:55:53 -0800761 void scale(float globalScaleFactor);
Jeff Brown5912f952013-07-01 19:10:31 -0700762
Evan Roskyd4d4d802021-05-03 20:12:21 -0700763 // Set 3x3 perspective matrix transformation.
Jeff Brown5a2f68e2013-07-15 17:28:19 -0700764 // Matrix is in row-major form and compatible with SkMatrix.
chaviw9eaa22c2020-07-01 16:21:27 -0700765 void transform(const std::array<float, 9>& matrix);
Jeff Brown5912f952013-07-01 19:10:31 -0700766
Evan Roskyd4d4d802021-05-03 20:12:21 -0700767 // Apply 3x3 perspective matrix transformation only to content (do not modify mTransform).
768 // Matrix is in row-major form and compatible with SkMatrix.
769 void applyTransform(const std::array<float, 9>& matrix);
770
Brett Chabotfaa986c2020-11-04 17:39:36 -0800771#ifdef __linux__
Jeff Brown5912f952013-07-01 19:10:31 -0700772 status_t readFromParcel(Parcel* parcel);
773 status_t writeToParcel(Parcel* parcel) const;
Brett Chabotfaa986c2020-11-04 17:39:36 -0800774#endif
Jeff Brown5912f952013-07-01 19:10:31 -0700775
Siarhei Vishniakou3826d472020-01-27 10:44:40 -0600776 static bool isTouchEvent(uint32_t source, int32_t action);
Jeff Brown5912f952013-07-01 19:10:31 -0700777 inline bool isTouchEvent() const {
778 return isTouchEvent(mSource, mAction);
779 }
780
781 // Low-level accessors.
782 inline const PointerProperties* getPointerProperties() const {
783 return mPointerProperties.array();
784 }
Siarhei Vishniakou46a27742020-09-09 13:57:28 -0500785 inline const nsecs_t* getSampleEventTimes() const { return mSampleEventTimes.data(); }
Jeff Brown5912f952013-07-01 19:10:31 -0700786 inline const PointerCoords* getSamplePointerCoords() const {
787 return mSamplePointerCoords.array();
788 }
789
Michael Wright872db4f2014-04-22 15:03:51 -0700790 static const char* getLabel(int32_t axis);
791 static int32_t getAxisFromLabel(const char* label);
792
Siarhei Vishniakouc68fdec2020-10-22 14:58:14 -0500793 static std::string actionToString(int32_t action);
Siarhei Vishniakoud44dddf2020-03-25 16:16:40 -0700794
Jeff Brown5912f952013-07-01 19:10:31 -0700795protected:
796 int32_t mAction;
Michael Wright7b159c92015-05-14 14:48:03 +0100797 int32_t mActionButton;
Jeff Brown5912f952013-07-01 19:10:31 -0700798 int32_t mFlags;
799 int32_t mEdgeFlags;
800 int32_t mMetaState;
801 int32_t mButtonState;
Siarhei Vishniakou49e59222018-12-28 18:17:15 -0800802 MotionClassification mClassification;
chaviwfd9c1ed2020-07-01 10:57:59 -0700803 ui::Transform mTransform;
Jeff Brown5912f952013-07-01 19:10:31 -0700804 float mXPrecision;
805 float mYPrecision;
Garfield Tan937bb832019-07-25 17:48:31 -0700806 float mRawXCursorPosition;
807 float mRawYCursorPosition;
Evan Rosky84f07f02021-04-16 10:42:42 -0700808 int32_t mDisplayWidth;
809 int32_t mDisplayHeight;
Jeff Brown5912f952013-07-01 19:10:31 -0700810 nsecs_t mDownTime;
811 Vector<PointerProperties> mPointerProperties;
Siarhei Vishniakou46a27742020-09-09 13:57:28 -0500812 std::vector<nsecs_t> mSampleEventTimes;
Jeff Brown5912f952013-07-01 19:10:31 -0700813 Vector<PointerCoords> mSamplePointerCoords;
814};
815
816/*
Siarhei Vishniakou7feb2ea2019-11-25 15:11:23 -0800817 * Focus events.
818 */
819class FocusEvent : public InputEvent {
820public:
821 virtual ~FocusEvent() {}
822
823 virtual int32_t getType() const override { return AINPUT_EVENT_TYPE_FOCUS; }
824
825 inline bool getHasFocus() const { return mHasFocus; }
826
827 inline bool getInTouchMode() const { return mInTouchMode; }
828
Garfield Tan4cc839f2020-01-24 11:26:14 -0800829 void initialize(int32_t id, bool hasFocus, bool inTouchMode);
Siarhei Vishniakou7feb2ea2019-11-25 15:11:23 -0800830
831 void initialize(const FocusEvent& from);
832
833protected:
834 bool mHasFocus;
835 bool mInTouchMode;
836};
837
Prabir Pradhan3f37b7b2020-11-10 16:50:18 -0800838/*
839 * Capture events.
840 */
841class CaptureEvent : public InputEvent {
842public:
843 virtual ~CaptureEvent() {}
844
845 virtual int32_t getType() const override { return AINPUT_EVENT_TYPE_CAPTURE; }
846
847 inline bool getPointerCaptureEnabled() const { return mPointerCaptureEnabled; }
848
849 void initialize(int32_t id, bool pointerCaptureEnabled);
850
851 void initialize(const CaptureEvent& from);
852
853protected:
854 bool mPointerCaptureEnabled;
855};
856
arthurhung7632c332020-12-30 16:58:01 +0800857/*
858 * Drag events.
859 */
860class DragEvent : public InputEvent {
861public:
862 virtual ~DragEvent() {}
863
864 virtual int32_t getType() const override { return AINPUT_EVENT_TYPE_DRAG; }
865
866 inline bool isExiting() const { return mIsExiting; }
867
868 inline float getX() const { return mX; }
869
870 inline float getY() const { return mY; }
871
872 void initialize(int32_t id, float x, float y, bool isExiting);
873
874 void initialize(const DragEvent& from);
875
876protected:
877 bool mIsExiting;
878 float mX, mY;
879};
880
Siarhei Vishniakou54d3e182020-01-15 17:38:38 -0800881/**
882 * Base class for verified events.
883 * Do not create a VerifiedInputEvent explicitly.
884 * Use helper functions to create them from InputEvents.
885 */
886struct __attribute__((__packed__)) VerifiedInputEvent {
887 enum class Type : int32_t {
888 KEY = AINPUT_EVENT_TYPE_KEY,
889 MOTION = AINPUT_EVENT_TYPE_MOTION,
890 };
891
892 Type type;
893 int32_t deviceId;
894 nsecs_t eventTimeNanos;
895 uint32_t source;
896 int32_t displayId;
897};
898
899/**
900 * Same as KeyEvent, but only contains the data that can be verified.
901 * If you update this class, you must also update VerifiedKeyEvent.java
902 */
903struct __attribute__((__packed__)) VerifiedKeyEvent : public VerifiedInputEvent {
904 int32_t action;
905 nsecs_t downTimeNanos;
906 int32_t flags;
907 int32_t keyCode;
908 int32_t scanCode;
909 int32_t metaState;
910 int32_t repeatCount;
911};
912
913/**
914 * Same as MotionEvent, but only contains the data that can be verified.
915 * If you update this class, you must also update VerifiedMotionEvent.java
916 */
917struct __attribute__((__packed__)) VerifiedMotionEvent : public VerifiedInputEvent {
918 float rawX;
919 float rawY;
920 int32_t actionMasked;
921 nsecs_t downTimeNanos;
922 int32_t flags;
923 int32_t metaState;
924 int32_t buttonState;
925};
926
927VerifiedKeyEvent verifiedKeyEventFromKeyEvent(const KeyEvent& event);
928VerifiedMotionEvent verifiedMotionEventFromMotionEvent(const MotionEvent& event);
929
Siarhei Vishniakou7feb2ea2019-11-25 15:11:23 -0800930/*
Jeff Brown5912f952013-07-01 19:10:31 -0700931 * Input event factory.
932 */
933class InputEventFactoryInterface {
934protected:
935 virtual ~InputEventFactoryInterface() { }
936
937public:
938 InputEventFactoryInterface() { }
939
940 virtual KeyEvent* createKeyEvent() = 0;
941 virtual MotionEvent* createMotionEvent() = 0;
Siarhei Vishniakou7feb2ea2019-11-25 15:11:23 -0800942 virtual FocusEvent* createFocusEvent() = 0;
Prabir Pradhan3f37b7b2020-11-10 16:50:18 -0800943 virtual CaptureEvent* createCaptureEvent() = 0;
arthurhung7632c332020-12-30 16:58:01 +0800944 virtual DragEvent* createDragEvent() = 0;
Jeff Brown5912f952013-07-01 19:10:31 -0700945};
946
947/*
948 * A simple input event factory implementation that uses a single preallocated instance
949 * of each type of input event that are reused for each request.
950 */
951class PreallocatedInputEventFactory : public InputEventFactoryInterface {
952public:
953 PreallocatedInputEventFactory() { }
954 virtual ~PreallocatedInputEventFactory() { }
955
Siarhei Vishniakou727a44e2019-11-23 12:59:16 -0800956 virtual KeyEvent* createKeyEvent() override { return &mKeyEvent; }
957 virtual MotionEvent* createMotionEvent() override { return &mMotionEvent; }
Siarhei Vishniakou7feb2ea2019-11-25 15:11:23 -0800958 virtual FocusEvent* createFocusEvent() override { return &mFocusEvent; }
Prabir Pradhan3f37b7b2020-11-10 16:50:18 -0800959 virtual CaptureEvent* createCaptureEvent() override { return &mCaptureEvent; }
arthurhung7632c332020-12-30 16:58:01 +0800960 virtual DragEvent* createDragEvent() override { return &mDragEvent; }
Jeff Brown5912f952013-07-01 19:10:31 -0700961
962private:
963 KeyEvent mKeyEvent;
964 MotionEvent mMotionEvent;
Siarhei Vishniakou7feb2ea2019-11-25 15:11:23 -0800965 FocusEvent mFocusEvent;
Prabir Pradhan3f37b7b2020-11-10 16:50:18 -0800966 CaptureEvent mCaptureEvent;
arthurhung7632c332020-12-30 16:58:01 +0800967 DragEvent mDragEvent;
Jeff Brown5912f952013-07-01 19:10:31 -0700968};
969
970/*
971 * An input event factory implementation that maintains a pool of input events.
972 */
973class PooledInputEventFactory : public InputEventFactoryInterface {
974public:
Chih-Hung Hsiehf43b02c2018-12-20 15:45:56 -0800975 explicit PooledInputEventFactory(size_t maxPoolSize = 20);
Jeff Brown5912f952013-07-01 19:10:31 -0700976 virtual ~PooledInputEventFactory();
977
Siarhei Vishniakou727a44e2019-11-23 12:59:16 -0800978 virtual KeyEvent* createKeyEvent() override;
979 virtual MotionEvent* createMotionEvent() override;
Siarhei Vishniakou7feb2ea2019-11-25 15:11:23 -0800980 virtual FocusEvent* createFocusEvent() override;
Prabir Pradhan3f37b7b2020-11-10 16:50:18 -0800981 virtual CaptureEvent* createCaptureEvent() override;
arthurhung7632c332020-12-30 16:58:01 +0800982 virtual DragEvent* createDragEvent() override;
Jeff Brown5912f952013-07-01 19:10:31 -0700983
984 void recycle(InputEvent* event);
985
986private:
987 const size_t mMaxPoolSize;
988
Siarhei Vishniakou727a44e2019-11-23 12:59:16 -0800989 std::queue<std::unique_ptr<KeyEvent>> mKeyEventPool;
990 std::queue<std::unique_ptr<MotionEvent>> mMotionEventPool;
Siarhei Vishniakou7feb2ea2019-11-25 15:11:23 -0800991 std::queue<std::unique_ptr<FocusEvent>> mFocusEventPool;
Prabir Pradhan3f37b7b2020-11-10 16:50:18 -0800992 std::queue<std::unique_ptr<CaptureEvent>> mCaptureEventPool;
arthurhung7632c332020-12-30 16:58:01 +0800993 std::queue<std::unique_ptr<DragEvent>> mDragEventPool;
Jeff Brown5912f952013-07-01 19:10:31 -0700994};
995
996} // namespace android
997
998#endif // _LIBINPUT_INPUT_H