Cody Heiner | 166a5af | 2023-07-07 12:25:00 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2023 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 | #pragma once |
| 18 | |
| 19 | #include <android/input.h> |
| 20 | #include <attestation/HmacKeyManager.h> |
Cody Heiner | 166a5af | 2023-07-07 12:25:00 -0700 | [diff] [blame] | 21 | #include <input/Input.h> |
Paul Ramirez | 7dfaa32 | 2024-08-21 17:44:45 +0000 | [diff] [blame] | 22 | #include <input/InputTransport.h> |
| 23 | #include <ui/LogicalDisplayId.h> |
Paul Ramirez | 8f87ade | 2024-10-01 15:45:39 +0000 | [diff] [blame] | 24 | #include <ui/Transform.h> |
Cody Heiner | 166a5af | 2023-07-07 12:25:00 -0700 | [diff] [blame] | 25 | #include <utils/Timers.h> // for nsecs_t, systemTime |
| 26 | |
| 27 | #include <vector> |
| 28 | |
| 29 | namespace android { |
| 30 | |
| 31 | // An arbitrary device id. |
| 32 | static constexpr uint32_t DEFAULT_DEVICE_ID = 1; |
| 33 | |
| 34 | // The default policy flags to use for event injection by tests. |
| 35 | static constexpr uint32_t DEFAULT_POLICY_FLAGS = POLICY_FLAG_FILTERED | POLICY_FLAG_PASS_TO_USER; |
| 36 | |
| 37 | class PointerBuilder { |
| 38 | public: |
| 39 | PointerBuilder(int32_t id, ToolType toolType) { |
| 40 | mProperties.clear(); |
| 41 | mProperties.id = id; |
| 42 | mProperties.toolType = toolType; |
| 43 | mCoords.clear(); |
| 44 | } |
| 45 | |
| 46 | PointerBuilder& x(float x) { return axis(AMOTION_EVENT_AXIS_X, x); } |
| 47 | |
| 48 | PointerBuilder& y(float y) { return axis(AMOTION_EVENT_AXIS_Y, y); } |
| 49 | |
Paul Ramirez | 7dfaa32 | 2024-08-21 17:44:45 +0000 | [diff] [blame] | 50 | PointerBuilder& isResampled(bool isResampled) { |
| 51 | mCoords.isResampled = isResampled; |
| 52 | return *this; |
| 53 | } |
| 54 | |
Cody Heiner | 166a5af | 2023-07-07 12:25:00 -0700 | [diff] [blame] | 55 | PointerBuilder& axis(int32_t axis, float value) { |
| 56 | mCoords.setAxisValue(axis, value); |
| 57 | return *this; |
| 58 | } |
| 59 | |
| 60 | PointerProperties buildProperties() const { return mProperties; } |
| 61 | |
| 62 | PointerCoords buildCoords() const { return mCoords; } |
| 63 | |
| 64 | private: |
| 65 | PointerProperties mProperties; |
| 66 | PointerCoords mCoords; |
| 67 | }; |
| 68 | |
Paul Ramirez | 7dfaa32 | 2024-08-21 17:44:45 +0000 | [diff] [blame] | 69 | class InputMessageBuilder { |
| 70 | public: |
| 71 | InputMessageBuilder(InputMessage::Type type, uint32_t seq) : mType{type}, mSeq{seq} {} |
| 72 | |
| 73 | InputMessageBuilder& eventId(int32_t eventId) { |
| 74 | mEventId = eventId; |
| 75 | return *this; |
| 76 | } |
| 77 | |
| 78 | InputMessageBuilder& eventTime(nsecs_t eventTime) { |
| 79 | mEventTime = eventTime; |
| 80 | return *this; |
| 81 | } |
| 82 | |
| 83 | InputMessageBuilder& deviceId(DeviceId deviceId) { |
| 84 | mDeviceId = deviceId; |
| 85 | return *this; |
| 86 | } |
| 87 | |
| 88 | InputMessageBuilder& source(int32_t source) { |
| 89 | mSource = source; |
| 90 | return *this; |
| 91 | } |
| 92 | |
| 93 | InputMessageBuilder& displayId(ui::LogicalDisplayId displayId) { |
| 94 | mDisplayId = displayId; |
| 95 | return *this; |
| 96 | } |
| 97 | |
Paul Ramirez | 8f87ade | 2024-10-01 15:45:39 +0000 | [diff] [blame] | 98 | InputMessageBuilder& hmac(const std::array<uint8_t, 32>& hmac) { |
| 99 | mHmac = hmac; |
| 100 | return *this; |
| 101 | } |
| 102 | |
Paul Ramirez | 7dfaa32 | 2024-08-21 17:44:45 +0000 | [diff] [blame] | 103 | InputMessageBuilder& action(int32_t action) { |
| 104 | mAction = action; |
| 105 | return *this; |
| 106 | } |
| 107 | |
Paul Ramirez | 8f87ade | 2024-10-01 15:45:39 +0000 | [diff] [blame] | 108 | InputMessageBuilder& actionButton(int32_t actionButton) { |
| 109 | mActionButton = actionButton; |
| 110 | return *this; |
| 111 | } |
| 112 | |
| 113 | InputMessageBuilder& flags(int32_t flags) { |
| 114 | mFlags = flags; |
| 115 | return *this; |
| 116 | } |
| 117 | |
| 118 | InputMessageBuilder& metaState(int32_t metaState) { |
| 119 | mMetaState = metaState; |
| 120 | return *this; |
| 121 | } |
| 122 | |
| 123 | InputMessageBuilder& buttonState(int32_t buttonState) { |
| 124 | mButtonState = buttonState; |
| 125 | return *this; |
| 126 | } |
| 127 | |
| 128 | InputMessageBuilder& classification(MotionClassification classification) { |
| 129 | mClassification = classification; |
| 130 | return *this; |
| 131 | } |
| 132 | |
| 133 | InputMessageBuilder& edgeFlags(int32_t edgeFlags) { |
| 134 | mEdgeFlags = edgeFlags; |
| 135 | return *this; |
| 136 | } |
| 137 | |
Paul Ramirez | 7dfaa32 | 2024-08-21 17:44:45 +0000 | [diff] [blame] | 138 | InputMessageBuilder& downTime(nsecs_t downTime) { |
| 139 | mDownTime = downTime; |
| 140 | return *this; |
| 141 | } |
| 142 | |
Paul Ramirez | 8f87ade | 2024-10-01 15:45:39 +0000 | [diff] [blame] | 143 | InputMessageBuilder& transform(const ui::Transform& transform) { |
| 144 | mTransform = transform; |
| 145 | return *this; |
| 146 | } |
| 147 | |
| 148 | InputMessageBuilder& xPrecision(float xPrecision) { |
| 149 | mXPrecision = xPrecision; |
| 150 | return *this; |
| 151 | } |
| 152 | |
| 153 | InputMessageBuilder& yPrecision(float yPrecision) { |
| 154 | mYPrecision = yPrecision; |
| 155 | return *this; |
| 156 | } |
| 157 | |
| 158 | InputMessageBuilder& xCursorPosition(float xCursorPosition) { |
| 159 | mXCursorPosition = xCursorPosition; |
| 160 | return *this; |
| 161 | } |
| 162 | |
| 163 | InputMessageBuilder& yCursorPosition(float yCursorPosition) { |
| 164 | mYCursorPosition = yCursorPosition; |
| 165 | return *this; |
| 166 | } |
| 167 | |
| 168 | InputMessageBuilder& rawTransform(const ui::Transform& rawTransform) { |
| 169 | mRawTransform = rawTransform; |
| 170 | return *this; |
| 171 | } |
| 172 | |
Paul Ramirez | 7dfaa32 | 2024-08-21 17:44:45 +0000 | [diff] [blame] | 173 | InputMessageBuilder& pointer(PointerBuilder pointerBuilder) { |
| 174 | mPointers.push_back(pointerBuilder); |
| 175 | return *this; |
| 176 | } |
| 177 | |
| 178 | InputMessage build() const { |
| 179 | InputMessage message{}; |
| 180 | // Header |
| 181 | message.header.type = mType; |
| 182 | message.header.seq = mSeq; |
| 183 | // Body |
| 184 | message.body.motion.eventId = mEventId; |
| 185 | message.body.motion.pointerCount = mPointers.size(); |
| 186 | message.body.motion.eventTime = mEventTime; |
| 187 | message.body.motion.deviceId = mDeviceId; |
| 188 | message.body.motion.source = mSource; |
| 189 | message.body.motion.displayId = mDisplayId.val(); |
Paul Ramirez | 8f87ade | 2024-10-01 15:45:39 +0000 | [diff] [blame] | 190 | message.body.motion.hmac = std::move(mHmac); |
Paul Ramirez | 7dfaa32 | 2024-08-21 17:44:45 +0000 | [diff] [blame] | 191 | message.body.motion.action = mAction; |
Paul Ramirez | 8f87ade | 2024-10-01 15:45:39 +0000 | [diff] [blame] | 192 | message.body.motion.actionButton = mActionButton; |
| 193 | message.body.motion.flags = mFlags; |
| 194 | message.body.motion.metaState = mMetaState; |
| 195 | message.body.motion.buttonState = mButtonState; |
| 196 | message.body.motion.edgeFlags = mEdgeFlags; |
Paul Ramirez | 7dfaa32 | 2024-08-21 17:44:45 +0000 | [diff] [blame] | 197 | message.body.motion.downTime = mDownTime; |
Paul Ramirez | 8f87ade | 2024-10-01 15:45:39 +0000 | [diff] [blame] | 198 | message.body.motion.dsdx = mTransform.dsdx(); |
| 199 | message.body.motion.dtdx = mTransform.dtdx(); |
| 200 | message.body.motion.dtdy = mTransform.dtdy(); |
| 201 | message.body.motion.dsdy = mTransform.dsdy(); |
| 202 | message.body.motion.tx = mTransform.ty(); |
| 203 | message.body.motion.ty = mTransform.tx(); |
| 204 | message.body.motion.xPrecision = mXPrecision; |
| 205 | message.body.motion.yPrecision = mYPrecision; |
| 206 | message.body.motion.xCursorPosition = mXCursorPosition; |
| 207 | message.body.motion.yCursorPosition = mYCursorPosition; |
| 208 | message.body.motion.dsdxRaw = mRawTransform.dsdx(); |
| 209 | message.body.motion.dtdxRaw = mRawTransform.dtdx(); |
| 210 | message.body.motion.dtdyRaw = mRawTransform.dtdy(); |
| 211 | message.body.motion.dsdyRaw = mRawTransform.dsdy(); |
| 212 | message.body.motion.txRaw = mRawTransform.ty(); |
| 213 | message.body.motion.tyRaw = mRawTransform.tx(); |
Paul Ramirez | 7dfaa32 | 2024-08-21 17:44:45 +0000 | [diff] [blame] | 214 | |
| 215 | for (size_t i = 0; i < mPointers.size(); ++i) { |
| 216 | message.body.motion.pointers[i].properties = mPointers[i].buildProperties(); |
| 217 | message.body.motion.pointers[i].coords = mPointers[i].buildCoords(); |
| 218 | } |
| 219 | return message; |
| 220 | } |
| 221 | |
| 222 | private: |
| 223 | const InputMessage::Type mType; |
| 224 | const uint32_t mSeq; |
| 225 | |
| 226 | int32_t mEventId{InputEvent::nextId()}; |
| 227 | nsecs_t mEventTime{systemTime(SYSTEM_TIME_MONOTONIC)}; |
| 228 | DeviceId mDeviceId{DEFAULT_DEVICE_ID}; |
| 229 | int32_t mSource{AINPUT_SOURCE_TOUCHSCREEN}; |
| 230 | ui::LogicalDisplayId mDisplayId{ui::LogicalDisplayId::DEFAULT}; |
Paul Ramirez | 8f87ade | 2024-10-01 15:45:39 +0000 | [diff] [blame] | 231 | std::array<uint8_t, 32> mHmac{INVALID_HMAC}; |
Paul Ramirez | 7dfaa32 | 2024-08-21 17:44:45 +0000 | [diff] [blame] | 232 | int32_t mAction{AMOTION_EVENT_ACTION_MOVE}; |
Paul Ramirez | 8f87ade | 2024-10-01 15:45:39 +0000 | [diff] [blame] | 233 | int32_t mActionButton{0}; |
| 234 | int32_t mFlags{0}; |
| 235 | int32_t mMetaState{AMETA_NONE}; |
| 236 | int32_t mButtonState{0}; |
| 237 | MotionClassification mClassification{MotionClassification::NONE}; |
| 238 | int32_t mEdgeFlags{0}; |
Paul Ramirez | 7dfaa32 | 2024-08-21 17:44:45 +0000 | [diff] [blame] | 239 | nsecs_t mDownTime{mEventTime}; |
Paul Ramirez | 8f87ade | 2024-10-01 15:45:39 +0000 | [diff] [blame] | 240 | ui::Transform mTransform{}; |
| 241 | float mXPrecision{1.0f}; |
| 242 | float mYPrecision{1.0f}; |
| 243 | float mXCursorPosition{AMOTION_EVENT_INVALID_CURSOR_POSITION}; |
| 244 | float mYCursorPosition{AMOTION_EVENT_INVALID_CURSOR_POSITION}; |
| 245 | ui::Transform mRawTransform{}; |
Paul Ramirez | 7dfaa32 | 2024-08-21 17:44:45 +0000 | [diff] [blame] | 246 | std::vector<PointerBuilder> mPointers; |
| 247 | }; |
| 248 | |
Cody Heiner | 166a5af | 2023-07-07 12:25:00 -0700 | [diff] [blame] | 249 | class MotionEventBuilder { |
| 250 | public: |
| 251 | MotionEventBuilder(int32_t action, int32_t source) { |
| 252 | mAction = action; |
Siarhei Vishniakou | 67b101b | 2024-10-12 00:42:44 +0000 | [diff] [blame] | 253 | if (mAction == AMOTION_EVENT_ACTION_CANCEL) { |
| 254 | mFlags |= AMOTION_EVENT_FLAG_CANCELED; |
| 255 | } |
Cody Heiner | 166a5af | 2023-07-07 12:25:00 -0700 | [diff] [blame] | 256 | mSource = source; |
| 257 | mEventTime = systemTime(SYSTEM_TIME_MONOTONIC); |
| 258 | mDownTime = mEventTime; |
| 259 | } |
| 260 | |
| 261 | MotionEventBuilder& deviceId(int32_t deviceId) { |
| 262 | mDeviceId = deviceId; |
| 263 | return *this; |
| 264 | } |
| 265 | |
| 266 | MotionEventBuilder& downTime(nsecs_t downTime) { |
| 267 | mDownTime = downTime; |
| 268 | return *this; |
| 269 | } |
| 270 | |
| 271 | MotionEventBuilder& eventTime(nsecs_t eventTime) { |
| 272 | mEventTime = eventTime; |
| 273 | return *this; |
| 274 | } |
| 275 | |
Linnan Li | 13bf76a | 2024-05-05 19:18:02 +0800 | [diff] [blame] | 276 | MotionEventBuilder& displayId(ui::LogicalDisplayId displayId) { |
Cody Heiner | 166a5af | 2023-07-07 12:25:00 -0700 | [diff] [blame] | 277 | mDisplayId = displayId; |
| 278 | return *this; |
| 279 | } |
| 280 | |
| 281 | MotionEventBuilder& actionButton(int32_t actionButton) { |
| 282 | mActionButton = actionButton; |
| 283 | return *this; |
| 284 | } |
| 285 | |
| 286 | MotionEventBuilder& buttonState(int32_t buttonState) { |
| 287 | mButtonState = buttonState; |
| 288 | return *this; |
| 289 | } |
| 290 | |
| 291 | MotionEventBuilder& rawXCursorPosition(float rawXCursorPosition) { |
| 292 | mRawXCursorPosition = rawXCursorPosition; |
| 293 | return *this; |
| 294 | } |
| 295 | |
| 296 | MotionEventBuilder& rawYCursorPosition(float rawYCursorPosition) { |
| 297 | mRawYCursorPosition = rawYCursorPosition; |
| 298 | return *this; |
| 299 | } |
| 300 | |
| 301 | MotionEventBuilder& pointer(PointerBuilder pointer) { |
| 302 | mPointers.push_back(pointer); |
| 303 | return *this; |
| 304 | } |
| 305 | |
| 306 | MotionEventBuilder& addFlag(uint32_t flags) { |
| 307 | mFlags |= flags; |
| 308 | return *this; |
| 309 | } |
| 310 | |
Prabir Pradhan | bf9b0a8 | 2024-02-29 02:23:50 +0000 | [diff] [blame] | 311 | MotionEventBuilder& transform(ui::Transform t) { |
| 312 | mTransform = t; |
| 313 | return *this; |
| 314 | } |
| 315 | |
| 316 | MotionEventBuilder& rawTransform(ui::Transform t) { |
| 317 | mRawTransform = t; |
| 318 | return *this; |
| 319 | } |
| 320 | |
Siarhei Vishniakou | 9d0d65e | 2024-08-02 12:10:05 -0700 | [diff] [blame] | 321 | MotionEvent build() const { |
Cody Heiner | 166a5af | 2023-07-07 12:25:00 -0700 | [diff] [blame] | 322 | std::vector<PointerProperties> pointerProperties; |
| 323 | std::vector<PointerCoords> pointerCoords; |
| 324 | for (const PointerBuilder& pointer : mPointers) { |
| 325 | pointerProperties.push_back(pointer.buildProperties()); |
| 326 | pointerCoords.push_back(pointer.buildCoords()); |
| 327 | } |
| 328 | |
Siarhei Vishniakou | 9d0d65e | 2024-08-02 12:10:05 -0700 | [diff] [blame] | 329 | auto [xCursorPosition, yCursorPosition] = |
| 330 | std::make_pair(mRawXCursorPosition, mRawYCursorPosition); |
Cody Heiner | 166a5af | 2023-07-07 12:25:00 -0700 | [diff] [blame] | 331 | // Set mouse cursor position for the most common cases to avoid boilerplate. |
| 332 | if (mSource == AINPUT_SOURCE_MOUSE && |
Siarhei Vishniakou | 9d0d65e | 2024-08-02 12:10:05 -0700 | [diff] [blame] | 333 | !MotionEvent::isValidCursorPosition(xCursorPosition, yCursorPosition)) { |
| 334 | xCursorPosition = pointerCoords[0].getX(); |
| 335 | yCursorPosition = pointerCoords[0].getY(); |
Cody Heiner | 166a5af | 2023-07-07 12:25:00 -0700 | [diff] [blame] | 336 | } |
| 337 | |
| 338 | MotionEvent event; |
Cody Heiner | 166a5af | 2023-07-07 12:25:00 -0700 | [diff] [blame] | 339 | event.initialize(InputEvent::nextId(), mDeviceId, mSource, mDisplayId, INVALID_HMAC, |
| 340 | mAction, mActionButton, mFlags, /*edgeFlags=*/0, AMETA_NONE, mButtonState, |
Prabir Pradhan | bf9b0a8 | 2024-02-29 02:23:50 +0000 | [diff] [blame] | 341 | MotionClassification::NONE, mTransform, |
Siarhei Vishniakou | 9d0d65e | 2024-08-02 12:10:05 -0700 | [diff] [blame] | 342 | /*xPrecision=*/0, /*yPrecision=*/0, xCursorPosition, yCursorPosition, |
| 343 | mRawTransform, mDownTime, mEventTime, mPointers.size(), |
| 344 | pointerProperties.data(), pointerCoords.data()); |
Cody Heiner | 166a5af | 2023-07-07 12:25:00 -0700 | [diff] [blame] | 345 | return event; |
| 346 | } |
| 347 | |
| 348 | private: |
| 349 | int32_t mAction; |
| 350 | int32_t mDeviceId{DEFAULT_DEVICE_ID}; |
| 351 | int32_t mSource; |
| 352 | nsecs_t mDownTime; |
| 353 | nsecs_t mEventTime; |
Siarhei Vishniakou | cfbee53 | 2024-05-10 13:41:35 -0700 | [diff] [blame] | 354 | ui::LogicalDisplayId mDisplayId{ui::LogicalDisplayId::DEFAULT}; |
Cody Heiner | 166a5af | 2023-07-07 12:25:00 -0700 | [diff] [blame] | 355 | int32_t mActionButton{0}; |
| 356 | int32_t mButtonState{0}; |
| 357 | int32_t mFlags{0}; |
| 358 | float mRawXCursorPosition{AMOTION_EVENT_INVALID_CURSOR_POSITION}; |
| 359 | float mRawYCursorPosition{AMOTION_EVENT_INVALID_CURSOR_POSITION}; |
Prabir Pradhan | bf9b0a8 | 2024-02-29 02:23:50 +0000 | [diff] [blame] | 360 | ui::Transform mTransform; |
| 361 | ui::Transform mRawTransform; |
Cody Heiner | 166a5af | 2023-07-07 12:25:00 -0700 | [diff] [blame] | 362 | |
| 363 | std::vector<PointerBuilder> mPointers; |
| 364 | }; |
| 365 | |
Prabir Pradhan | b0dad3a | 2023-11-02 20:52:47 +0000 | [diff] [blame] | 366 | class KeyEventBuilder { |
| 367 | public: |
| 368 | KeyEventBuilder(int32_t action, int32_t source) { |
| 369 | mAction = action; |
| 370 | mSource = source; |
| 371 | mEventTime = systemTime(SYSTEM_TIME_MONOTONIC); |
| 372 | mDownTime = mEventTime; |
| 373 | } |
| 374 | |
| 375 | KeyEventBuilder(const KeyEvent& event) { |
| 376 | mAction = event.getAction(); |
| 377 | mDeviceId = event.getDeviceId(); |
| 378 | mSource = event.getSource(); |
| 379 | mDownTime = event.getDownTime(); |
| 380 | mEventTime = event.getEventTime(); |
| 381 | mDisplayId = event.getDisplayId(); |
| 382 | mFlags = event.getFlags(); |
| 383 | mKeyCode = event.getKeyCode(); |
| 384 | mScanCode = event.getScanCode(); |
| 385 | mMetaState = event.getMetaState(); |
| 386 | mRepeatCount = event.getRepeatCount(); |
| 387 | } |
| 388 | |
| 389 | KeyEventBuilder& deviceId(int32_t deviceId) { |
| 390 | mDeviceId = deviceId; |
| 391 | return *this; |
| 392 | } |
| 393 | |
| 394 | KeyEventBuilder& downTime(nsecs_t downTime) { |
| 395 | mDownTime = downTime; |
| 396 | return *this; |
| 397 | } |
| 398 | |
| 399 | KeyEventBuilder& eventTime(nsecs_t eventTime) { |
| 400 | mEventTime = eventTime; |
| 401 | return *this; |
| 402 | } |
| 403 | |
Linnan Li | 13bf76a | 2024-05-05 19:18:02 +0800 | [diff] [blame] | 404 | KeyEventBuilder& displayId(ui::LogicalDisplayId displayId) { |
Prabir Pradhan | b0dad3a | 2023-11-02 20:52:47 +0000 | [diff] [blame] | 405 | mDisplayId = displayId; |
| 406 | return *this; |
| 407 | } |
| 408 | |
| 409 | KeyEventBuilder& policyFlags(int32_t policyFlags) { |
| 410 | mPolicyFlags = policyFlags; |
| 411 | return *this; |
| 412 | } |
| 413 | |
| 414 | KeyEventBuilder& addFlag(uint32_t flags) { |
| 415 | mFlags |= flags; |
| 416 | return *this; |
| 417 | } |
| 418 | |
| 419 | KeyEventBuilder& keyCode(int32_t keyCode) { |
| 420 | mKeyCode = keyCode; |
| 421 | return *this; |
| 422 | } |
| 423 | |
| 424 | KeyEventBuilder& repeatCount(int32_t repeatCount) { |
| 425 | mRepeatCount = repeatCount; |
| 426 | return *this; |
| 427 | } |
| 428 | |
| 429 | KeyEvent build() const { |
| 430 | KeyEvent event{}; |
| 431 | event.initialize(InputEvent::nextId(), mDeviceId, mSource, mDisplayId, INVALID_HMAC, |
| 432 | mAction, mFlags, mKeyCode, mScanCode, mMetaState, mRepeatCount, mDownTime, |
| 433 | mEventTime); |
| 434 | return event; |
| 435 | } |
| 436 | |
| 437 | private: |
| 438 | int32_t mAction; |
| 439 | int32_t mDeviceId = DEFAULT_DEVICE_ID; |
| 440 | uint32_t mSource; |
| 441 | nsecs_t mDownTime; |
| 442 | nsecs_t mEventTime; |
Siarhei Vishniakou | cfbee53 | 2024-05-10 13:41:35 -0700 | [diff] [blame] | 443 | ui::LogicalDisplayId mDisplayId{ui::LogicalDisplayId::DEFAULT}; |
Prabir Pradhan | b0dad3a | 2023-11-02 20:52:47 +0000 | [diff] [blame] | 444 | uint32_t mPolicyFlags = DEFAULT_POLICY_FLAGS; |
| 445 | int32_t mFlags{0}; |
| 446 | int32_t mKeyCode{AKEYCODE_UNKNOWN}; |
| 447 | int32_t mScanCode{0}; |
| 448 | int32_t mMetaState{AMETA_NONE}; |
| 449 | int32_t mRepeatCount{0}; |
| 450 | }; |
| 451 | |
Cody Heiner | 166a5af | 2023-07-07 12:25:00 -0700 | [diff] [blame] | 452 | } // namespace android |