1 package org.robolectric.shadows; 2 3 /** 4 * Java representation of framework native system headers Transliterated from oreo-mr1 (SDK 27) 5 * frameworks/native/include/android/Input.h 6 * 7 * @see <a 8 * href="https://android.googlesource.com/platform/frameworks/native/+/oreo-mr1-release/include/android/input.h">include/android/input.h</a> 9 */ 10 public class NativeAndroidInput { 11 12 /** 13 * Key states (may be returned by queries about the current state of a particular key code, scan 14 * code or switch). 15 */ 16 /** The key state is unknown or the requested key itself is not supported. */ 17 static final int AKEY_STATE_UNKNOWN = -1; 18 19 /** The key is up. */ 20 static final int AKEY_STATE_UP = 0; 21 22 /** The key is down. */ 23 static final int AKEY_STATE_DOWN = 1; 24 25 /** The key is down but is a virtual key press that is being emulated by the system. */ 26 static final int AKEY_STATE_VIRTUAL = 2; 27 28 /** Meta key / modifer state. */ 29 /** No meta keys are pressed. */ 30 static final int AMETA_NONE = 0; 31 32 /** This mask is used to check whether one of the ALT meta keys is pressed. */ 33 static final int AMETA_ALT_ON = 0x02; 34 35 /** This mask is used to check whether the left ALT meta key is pressed. */ 36 static final int AMETA_ALT_LEFT_ON = 0x10; 37 38 /** This mask is used to check whether the right ALT meta key is pressed. */ 39 static final int AMETA_ALT_RIGHT_ON = 0x20; 40 41 /** This mask is used to check whether one of the SHIFT meta keys is pressed. */ 42 static final int AMETA_SHIFT_ON = 0x01; 43 44 /** This mask is used to check whether the left SHIFT meta key is pressed. */ 45 static final int AMETA_SHIFT_LEFT_ON = 0x40; 46 47 /** This mask is used to check whether the right SHIFT meta key is pressed. */ 48 static final int AMETA_SHIFT_RIGHT_ON = 0x80; 49 50 /** This mask is used to check whether the SYM meta key is pressed. */ 51 static final int AMETA_SYM_ON = 0x04; 52 53 /** This mask is used to check whether the FUNCTION meta key is pressed. */ 54 static final int AMETA_FUNCTION_ON = 0x08; 55 56 /** This mask is used to check whether one of the CTRL meta keys is pressed. */ 57 static final int AMETA_CTRL_ON = 0x1000; 58 59 /** This mask is used to check whether the left CTRL meta key is pressed. */ 60 static final int AMETA_CTRL_LEFT_ON = 0x2000; 61 62 /** This mask is used to check whether the right CTRL meta key is pressed. */ 63 static final int AMETA_CTRL_RIGHT_ON = 0x4000; 64 65 /** This mask is used to check whether one of the META meta keys is pressed. */ 66 static final int AMETA_META_ON = 0x10000; 67 68 /** This mask is used to check whether the left META meta key is pressed. */ 69 static final int AMETA_META_LEFT_ON = 0x20000; 70 71 /** This mask is used to check whether the right META meta key is pressed. */ 72 static final int AMETA_META_RIGHT_ON = 0x40000; 73 74 /** This mask is used to check whether the CAPS LOCK meta key is on. */ 75 static final int AMETA_CAPS_LOCK_ON = 0x100000; 76 77 /** This mask is used to check whether the NUM LOCK meta key is on. */ 78 static final int AMETA_NUM_LOCK_ON = 0x200000; 79 80 /** This mask is used to check whether the SCROLL LOCK meta key is on. */ 81 static final int AMETA_SCROLL_LOCK_ON = 0x400000; 82 83 /** Input event types. */ 84 /** Indicates that the input event is a key event. */ 85 static final int AINPUT_EVENT_TYPE_KEY = 1; 86 87 /** Indicates that the input event is a motion event. */ 88 static final int AINPUT_EVENT_TYPE_MOTION = 2; 89 90 /** Key event actions. */ 91 /** The key has been pressed down. */ 92 static final int AKEY_EVENT_ACTION_DOWN = 0; 93 94 /** The key has been released. */ 95 static final int AKEY_EVENT_ACTION_UP = 1; 96 97 /** 98 * Multiple duplicate key events have occurred in a row, or a complex string is being delivered. 99 * The repeat_count property of the key event contains the number of times the given key code 100 * should be executed. 101 */ 102 static final int AKEY_EVENT_ACTION_MULTIPLE = 2; 103 104 /** Key event flags. */ 105 106 /** This mask is set if the device woke because of this key event. */ 107 static final int AKEY_EVENT_FLAG_WOKE_HERE = 0x1; 108 109 /** This mask is set if the key event was generated by a software keyboard. */ 110 static final int AKEY_EVENT_FLAG_SOFT_KEYBOARD = 0x2; 111 112 /** This mask is set if we don't want the key event to cause us to leave touch mode. */ 113 static final int AKEY_EVENT_FLAG_KEEP_TOUCH_MODE = 0x4; 114 115 /** 116 * This mask is set if an event was known to come from a trusted part of the system. That is; the 117 * event is known to come from the user; and could not have been spoofed by a third party 118 * component. 119 */ 120 static final int AKEY_EVENT_FLAG_FROM_SYSTEM = 0x8; 121 122 /** 123 * This mask is used for compatibility; to identify enter keys that are coming from an IME whose 124 * enter key has been auto-labelled "next" or "done". This allows TextView to dispatch these as 125 * normal enter keys for old applications; but still do the appropriate action when receiving 126 * them. 127 */ 128 static final int AKEY_EVENT_FLAG_EDITOR_ACTION = 0x10; 129 130 /** 131 * When associated with up key events; this indicates that the key press has been canceled. 132 * Typically this is used with virtual touch screen keys; where the user can slide from the 133 * virtual key area on to the display: in that case; the application will receive a canceled up 134 * event and should not perform the action normally associated with the key. Note that for this to 135 * work; the application can not perform an action for a key until it receives an up or the long 136 * press timeout has expired. 137 */ 138 static final int AKEY_EVENT_FLAG_CANCELED = 0x20; 139 140 /** 141 * This key event was generated by a virtual (on-screen) hard key area. Typically this is an area 142 * of the touchscreen; outside of the regular display; dedicated to "hardware" buttons. 143 */ 144 static final int AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY = 0x40; 145 146 /** This flag is set for the first key repeat that occurs after the long press timeout. */ 147 static final int AKEY_EVENT_FLAG_LONG_PRESS = 0x80; 148 149 /** 150 * Set when a key event has AKEY_EVENT_FLAG_CANCELED set because a long press action was executed 151 * while it was down. 152 */ 153 static final int AKEY_EVENT_FLAG_CANCELED_LONG_PRESS = 0x100; 154 155 /** 156 * Set for AKEY_EVENT_ACTION_UP when this event's key code is still being tracked from its initial 157 * down. That is; somebody requested that tracking started on the key down and a long press has 158 * not caused the tracking to be canceled. 159 */ 160 static final int AKEY_EVENT_FLAG_TRACKING = 0x200; 161 162 /** 163 * Set when a key event has been synthesized to implement default behavior for an event that the 164 * application did not handle. Fallback key events are generated by unhandled trackball motions 165 * (to emulate a directional keypad) and by certain unhandled key presses that are declared in the 166 * key map (such as special function numeric keypad keys when numlock is off). 167 */ 168 static final int AKEY_EVENT_FLAG_FALLBACK = 0x400; 169 170 /** 171 * Bit shift for the action bits holding the pointer index as defined by 172 * AMOTION_EVENT_ACTION_POINTER_INDEX_MASK. 173 */ 174 static final int AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT = 8; 175 176 /** Motion event actions */ 177 178 /** Bit mask of the parts of the action code that are the action itself. */ 179 static final int AMOTION_EVENT_ACTION_MASK = 0xff; 180 181 /** 182 * Bits in the action code that represent a pointer index; used with 183 * AMOTION_EVENT_ACTION_POINTER_DOWN and AMOTION_EVENT_ACTION_POINTER_UP. Shifting down by 184 * AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT provides the actual pointer index where the data for 185 * the pointer going up or down can be found. 186 */ 187 static final int AMOTION_EVENT_ACTION_POINTER_INDEX_MASK = 0xff00; 188 189 /** A pressed gesture has started; the motion contains the initial starting location. */ 190 static final int AMOTION_EVENT_ACTION_DOWN = 0; 191 192 /** 193 * A pressed gesture has finished; the motion contains the final release location as well as any 194 * intermediate points since the last down or move event. 195 */ 196 static final int AMOTION_EVENT_ACTION_UP = 1; 197 198 /** 199 * A change has happened during a press gesture (between AMOTION_EVENT_ACTION_DOWN and 200 * AMOTION_EVENT_ACTION_UP). The motion contains the most recent point; as well as any 201 * intermediate points since the last down or move event. 202 */ 203 static final int AMOTION_EVENT_ACTION_MOVE = 2; 204 205 /** 206 * The current gesture has been aborted. You will not receive any more points in it. You should 207 * treat this as an up event; but not perform any action that you normally would. 208 */ 209 static final int AMOTION_EVENT_ACTION_CANCEL = 3; 210 211 /** 212 * A movement has happened outside of the normal bounds of the UI element. This does not provide a 213 * full gesture; but only the initial location of the movement/touch. 214 */ 215 static final int AMOTION_EVENT_ACTION_OUTSIDE = 4; 216 217 /** 218 * A non-primary pointer has gone down. The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK 219 * indicate which pointer changed. 220 */ 221 static final int AMOTION_EVENT_ACTION_POINTER_DOWN = 5; 222 223 /** 224 * A non-primary pointer has gone up. The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate 225 * which pointer changed. 226 */ 227 static final int AMOTION_EVENT_ACTION_POINTER_UP = 6; 228 229 /** 230 * A change happened but the pointer is not down (unlike AMOTION_EVENT_ACTION_MOVE). The motion 231 * contains the most recent point; as well as any intermediate points since the last hover move 232 * event. 233 */ 234 static final int AMOTION_EVENT_ACTION_HOVER_MOVE = 7; 235 236 /** 237 * The motion event contains relative vertical and/or horizontal scroll offsets. Use getAxisValue 238 * to retrieve the information from AMOTION_EVENT_AXIS_VSCROLL and AMOTION_EVENT_AXIS_HSCROLL. The 239 * pointer may or may not be down when this event is dispatched. This action is always delivered 240 * to the winder under the pointer; which may not be the window currently touched. 241 */ 242 static final int AMOTION_EVENT_ACTION_SCROLL = 8; 243 244 /** The pointer is not down but has entered the boundaries of a window or view. */ 245 static final int AMOTION_EVENT_ACTION_HOVER_ENTER = 9; 246 247 /** The pointer is not down but has exited the boundaries of a window or view. */ 248 static final int AMOTION_EVENT_ACTION_HOVER_EXIT = 10; 249 250 /* One or more buttons have been pressed. */ 251 static final int AMOTION_EVENT_ACTION_BUTTON_PRESS = 11; 252 /* One or more buttons have been released. */ 253 static final int AMOTION_EVENT_ACTION_BUTTON_RELEASE = 12; 254 255 /** Motion event flags. */ 256 /** 257 * This flag indicates that the window that received this motion event is partly or wholly 258 * obscured by another visible window above it. This flag is set to true even if the event did not 259 * directly pass through the obscured area. A security sensitive application can check this flag 260 * to identify situations in which a malicious application may have covered up part of its content 261 * for the purpose of misleading the user or hijacking touches. An appropriate response might be 262 * to drop the suspect touches or to take additional precautions to confirm the user's actual 263 * intent. 264 */ 265 static final int AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED = 0x1; 266 267 /** Motion event edge touch flags. */ 268 /** No edges intersected. */ 269 static final int AMOTION_EVENT_EDGE_FLAG_NONE = 0; 270 271 /** Flag indicating the motion event intersected the top edge of the screen. */ 272 static final int AMOTION_EVENT_EDGE_FLAG_TOP = 0x01; 273 274 /** Flag indicating the motion event intersected the bottom edge of the screen. */ 275 static final int AMOTION_EVENT_EDGE_FLAG_BOTTOM = 0x02; 276 277 /** Flag indicating the motion event intersected the left edge of the screen. */ 278 static final int AMOTION_EVENT_EDGE_FLAG_LEFT = 0x04; 279 280 /** Flag indicating the motion event intersected the right edge of the screen. */ 281 static final int AMOTION_EVENT_EDGE_FLAG_RIGHT = 0x08; 282 283 /** 284 * Constants that identify each individual axis of a motion event. 285 * 286 * @anchor AMOTION_EVENT_AXIS 287 */ 288 /** 289 * Axis constant: X axis of a motion event. 290 * 291 * <p>- For a touch screen, reports the absolute X screen position of the center of the touch 292 * contact area. The units are display pixels. - For a touch pad, reports the absolute X surface 293 * position of the center of the touch contact area. The units are device-dependent. - For a 294 * mouse, reports the absolute X screen position of the mouse pointer. The units are display 295 * pixels. - For a trackball, reports the relative horizontal displacement of the trackball. The 296 * value is normalized to a range from -1.0 (left) to 1.0 (right). - For a joystick, reports the 297 * absolute X position of the joystick. The value is normalized to a range from -1.0 (left) to 1.0 298 * (right). 299 */ 300 static final int AMOTION_EVENT_AXIS_X = 0; 301 302 /** 303 * Axis constant: Y axis of a motion event. 304 * 305 * <p>- For a touch screen; reports the absolute Y screen position of the center of the touch 306 * contact area. The units are display pixels. - For a touch pad; reports the absolute Y surface 307 * position of the center of the touch contact area. The units are device-dependent. - For a 308 * mouse; reports the absolute Y screen position of the mouse pointer. The units are display 309 * pixels. - For a trackball; reports the relative vertical displacement of the trackball. The 310 * value is normalized to a range from -1.0 (up) to 1.0 (down). - For a joystick; reports the 311 * absolute Y position of the joystick. The value is normalized to a range from -1.0 (up or far) 312 * to 1.0 (down or near). 313 */ 314 static final int AMOTION_EVENT_AXIS_Y = 1; 315 316 /** 317 * Axis constant: Pressure axis of a motion event. 318 * 319 * <p>- For a touch screen or touch pad; reports the approximate pressure applied to the surface 320 * by a finger or other tool. The value is normalized to a range from 0 (no pressure at all) to 1 321 * (normal pressure); although values higher than 1 may be generated depending on the calibration 322 * of the input device. - For a trackball; the value is set to 1 if the trackball button is 323 * pressed or 0 otherwise. - For a mouse; the value is set to 1 if the primary mouse button is 324 * pressed or 0 otherwise. 325 */ 326 static final int AMOTION_EVENT_AXIS_PRESSURE = 2; 327 328 /** 329 * Axis constant: Size axis of a motion event. 330 * 331 * <p>- For a touch screen or touch pad; reports the approximate size of the contact area in 332 * relation to the maximum detectable size for the device. The value is normalized to a range from 333 * 0 (smallest detectable size) to 1 (largest detectable size); although it is not a linear scale. 334 * This value is of limited use. To obtain calibrated size information; see {@link 335 * AMOTION_EVENT_AXIS_TOUCH_MAJOR} or {@link AMOTION_EVENT_AXIS_TOOL_MAJOR}. 336 */ 337 static final int AMOTION_EVENT_AXIS_SIZE = 3; 338 339 /** 340 * Axis constant: TouchMajor axis of a motion event. 341 * 342 * <p>- For a touch screen; reports the length of the major axis of an ellipse that represents the 343 * touch area at the point of contact. The units are display pixels. - For a touch pad; reports 344 * the length of the major axis of an ellipse that represents the touch area at the point of 345 * contact. The units are device-dependent. 346 */ 347 static final int AMOTION_EVENT_AXIS_TOUCH_MAJOR = 4; 348 349 /** 350 * Axis constant: TouchMinor axis of a motion event. 351 * 352 * <p>- For a touch screen; reports the length of the minor axis of an ellipse that represents the 353 * touch area at the point of contact. The units are display pixels. - For a touch pad; reports 354 * the length of the minor axis of an ellipse that represents the touch area at the point of 355 * contact. The units are device-dependent. 356 * 357 * <p>When the touch is circular; the major and minor axis lengths will be equal to one another. 358 */ 359 static final int AMOTION_EVENT_AXIS_TOUCH_MINOR = 5; 360 361 /** 362 * Axis constant: ToolMajor axis of a motion event. 363 * 364 * <p>- For a touch screen; reports the length of the major axis of an ellipse that represents the 365 * size of the approaching finger or tool used to make contact. - For a touch pad; reports the 366 * length of the major axis of an ellipse that represents the size of the approaching finger or 367 * tool used to make contact. The units are device-dependent. 368 * 369 * <p>When the touch is circular; the major and minor axis lengths will be equal to one another. 370 * 371 * <p>The tool size may be larger than the touch size since the tool may not be fully in contact 372 * with the touch sensor. 373 */ 374 static final int AMOTION_EVENT_AXIS_TOOL_MAJOR = 6; 375 376 /** 377 * Axis constant: ToolMinor axis of a motion event. 378 * 379 * <p>- For a touch screen; reports the length of the minor axis of an ellipse that represents the 380 * size of the approaching finger or tool used to make contact. - For a touch pad; reports the 381 * length of the minor axis of an ellipse that represents the size of the approaching finger or 382 * tool used to make contact. The units are device-dependent. 383 * 384 * <p>When the touch is circular; the major and minor axis lengths will be equal to one another. 385 * 386 * <p>The tool size may be larger than the touch size since the tool may not be fully in contact 387 * with the touch sensor. 388 */ 389 static final int AMOTION_EVENT_AXIS_TOOL_MINOR = 7; 390 391 /** 392 * Axis constant: Orientation axis of a motion event. 393 * 394 * <p>- For a touch screen or touch pad; reports the orientation of the finger or tool in radians 395 * relative to the vertical plane of the device. An angle of 0 radians indicates that the major 396 * axis of contact is oriented upwards; is perfectly circular or is of unknown orientation. A 397 * positive angle indicates that the major axis of contact is oriented to the right. A negative 398 * angle indicates that the major axis of contact is oriented to the left. The full range is from 399 * -PI/2 radians (finger pointing fully left) to PI/2 radians (finger pointing fully right). - For 400 * a stylus; the orientation indicates the direction in which the stylus is pointing in relation 401 * to the vertical axis of the current orientation of the screen. The range is from -PI radians to 402 * PI radians; where 0 is pointing up; -PI/2 radians is pointing left; -PI or PI radians is 403 * pointing down; and PI/2 radians is pointing right. See also {@link AMOTION_EVENT_AXIS_TILT}. 404 */ 405 static final int AMOTION_EVENT_AXIS_ORIENTATION = 8; 406 407 /** 408 * Axis constant: Vertical Scroll axis of a motion event. 409 * 410 * <p>- For a mouse; reports the relative movement of the vertical scroll wheel. The value is 411 * normalized to a range from -1.0 (down) to 1.0 (up). 412 * 413 * <p>This axis should be used to scroll views vertically. 414 */ 415 static final int AMOTION_EVENT_AXIS_VSCROLL = 9; 416 417 /** 418 * Axis constant: Horizontal Scroll axis of a motion event. 419 * 420 * <p>- For a mouse; reports the relative movement of the horizontal scroll wheel. The value is 421 * normalized to a range from -1.0 (left) to 1.0 (right). 422 * 423 * <p>This axis should be used to scroll views horizontally. 424 */ 425 static final int AMOTION_EVENT_AXIS_HSCROLL = 10; 426 427 /** 428 * Axis constant: Z axis of a motion event. 429 * 430 * <p>- For a joystick; reports the absolute Z position of the joystick. The value is normalized 431 * to a range from -1.0 (high) to 1.0 (low). <em>On game pads with two analog joysticks; this axis 432 * is often reinterpreted to report the absolute X position of the second joystick instead.</em> 433 */ 434 static final int AMOTION_EVENT_AXIS_Z = 11; 435 436 /** 437 * Axis constant: X Rotation axis of a motion event. 438 * 439 * <p>- For a joystick; reports the absolute rotation angle about the X axis. The value is 440 * normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise). 441 */ 442 static final int AMOTION_EVENT_AXIS_RX = 12; 443 444 /** 445 * Axis constant: Y Rotation axis of a motion event. 446 * 447 * <p>- For a joystick; reports the absolute rotation angle about the Y axis. The value is 448 * normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise). 449 */ 450 static final int AMOTION_EVENT_AXIS_RY = 13; 451 452 /** 453 * Axis constant: Z Rotation axis of a motion event. 454 * 455 * <p>- For a joystick; reports the absolute rotation angle about the Z axis. The value is 456 * normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise). On game pads with two 457 * analog joysticks; this axis is often reinterpreted to report the absolute Y position of the 458 * second joystick instead. 459 */ 460 static final int AMOTION_EVENT_AXIS_RZ = 14; 461 462 /** 463 * Axis constant: Hat X axis of a motion event. 464 * 465 * <p>- For a joystick; reports the absolute X position of the directional hat control. The value 466 * is normalized to a range from -1.0 (left) to 1.0 (right). 467 */ 468 static final int AMOTION_EVENT_AXIS_HAT_X = 15; 469 470 /** 471 * Axis constant: Hat Y axis of a motion event. 472 * 473 * <p>- For a joystick; reports the absolute Y position of the directional hat control. The value 474 * is normalized to a range from -1.0 (up) to 1.0 (down). 475 */ 476 static final int AMOTION_EVENT_AXIS_HAT_Y = 16; 477 478 /** 479 * Axis constant: Left Trigger axis of a motion event. 480 * 481 * <p>- For a joystick; reports the absolute position of the left trigger control. The value is 482 * normalized to a range from 0.0 (released) to 1.0 (fully pressed). 483 */ 484 static final int AMOTION_EVENT_AXIS_LTRIGGER = 17; 485 486 /** 487 * Axis constant: Right Trigger axis of a motion event. 488 * 489 * <p>- For a joystick; reports the absolute position of the right trigger control. The value is 490 * normalized to a range from 0.0 (released) to 1.0 (fully pressed). 491 */ 492 static final int AMOTION_EVENT_AXIS_RTRIGGER = 18; 493 494 /** 495 * Axis constant: Throttle axis of a motion event. 496 * 497 * <p>- For a joystick; reports the absolute position of the throttle control. The value is 498 * normalized to a range from 0.0 (fully open) to 1.0 (fully closed). 499 */ 500 static final int AMOTION_EVENT_AXIS_THROTTLE = 19; 501 502 /** 503 * Axis constant: Rudder axis of a motion event. 504 * 505 * <p>- For a joystick; reports the absolute position of the rudder control. The value is 506 * normalized to a range from -1.0 (turn left) to 1.0 (turn right). 507 */ 508 static final int AMOTION_EVENT_AXIS_RUDDER = 20; 509 510 /** 511 * Axis constant: Wheel axis of a motion event. 512 * 513 * <p>- For a joystick; reports the absolute position of the steering wheel control. The value is 514 * normalized to a range from -1.0 (turn left) to 1.0 (turn right). 515 */ 516 static final int AMOTION_EVENT_AXIS_WHEEL = 21; 517 518 /** 519 * Axis constant: Gas axis of a motion event. 520 * 521 * <p>- For a joystick; reports the absolute position of the gas (accelerator) control. The value 522 * is normalized to a range from 0.0 (no acceleration) to 1.0 (maximum acceleration). 523 */ 524 static final int AMOTION_EVENT_AXIS_GAS = 22; 525 526 /** 527 * Axis constant: Brake axis of a motion event. 528 * 529 * <p>- For a joystick; reports the absolute position of the brake control. The value is 530 * normalized to a range from 0.0 (no braking) to 1.0 (maximum braking). 531 */ 532 static final int AMOTION_EVENT_AXIS_BRAKE = 23; 533 534 /** 535 * Axis constant: Distance axis of a motion event. 536 * 537 * <p>- For a stylus; reports the distance of the stylus from the screen. A value of 0.0 indicates 538 * direct contact and larger values indicate increasing distance from the surface. 539 */ 540 static final int AMOTION_EVENT_AXIS_DISTANCE = 24; 541 542 /** 543 * Axis constant: Tilt axis of a motion event. 544 * 545 * <p>- For a stylus; reports the tilt angle of the stylus in radians where 0 radians indicates 546 * that the stylus is being held perpendicular to the surface; and PI/2 radians indicates that the 547 * stylus is being held flat against the surface. 548 */ 549 static final int AMOTION_EVENT_AXIS_TILT = 25; 550 551 /** 552 * Axis constant: Generic scroll axis of a motion event. 553 * 554 * <p>- This is used for scroll axis motion events that can't be classified as strictly vertical 555 * or horizontal. The movement of a rotating scroller is an example of this. 556 */ 557 static final int AMOTION_EVENT_AXIS_SCROLL = 26; 558 559 /** 560 * Axis constant: The movement of x position of a motion event. 561 * 562 * <p>- For a mouse; reports a difference of x position between the previous position. This is 563 * useful when pointer is captured; in that case the mouse pointer doesn't change the location but 564 * this axis reports the difference which allows the app to see how the mouse is moved. 565 */ 566 static final int AMOTION_EVENT_AXIS_RELATIVE_X = 27; 567 568 /** 569 * Axis constant: The movement of y position of a motion event. 570 * 571 * <p>Same as {@link RELATIVE_X}; but for y position. 572 */ 573 static final int AMOTION_EVENT_AXIS_RELATIVE_Y = 28; 574 575 /** 576 * Axis constant: Generic 1 axis of a motion event. The interpretation of a generic axis is 577 * device-specific. 578 */ 579 static final int AMOTION_EVENT_AXIS_GENERIC_1 = 32; 580 581 /** 582 * Axis constant: Generic 2 axis of a motion event. The interpretation of a generic axis is 583 * device-specific. 584 */ 585 static final int AMOTION_EVENT_AXIS_GENERIC_2 = 33; 586 587 /** 588 * Axis constant: Generic 3 axis of a motion event. The interpretation of a generic axis is 589 * device-specific. 590 */ 591 static final int AMOTION_EVENT_AXIS_GENERIC_3 = 34; 592 593 /** 594 * Axis constant: Generic 4 axis of a motion event. The interpretation of a generic axis is 595 * device-specific. 596 */ 597 static final int AMOTION_EVENT_AXIS_GENERIC_4 = 35; 598 599 /** 600 * Axis constant: Generic 5 axis of a motion event. The interpretation of a generic axis is 601 * device-specific. 602 */ 603 static final int AMOTION_EVENT_AXIS_GENERIC_5 = 36; 604 605 /** 606 * Axis constant: Generic 6 axis of a motion event. The interpretation of a generic axis is 607 * device-specific. 608 */ 609 static final int AMOTION_EVENT_AXIS_GENERIC_6 = 37; 610 611 /** 612 * Axis constant: Generic 7 axis of a motion event. The interpretation of a generic axis is 613 * device-specific. 614 */ 615 static final int AMOTION_EVENT_AXIS_GENERIC_7 = 38; 616 617 /** 618 * Axis constant: Generic 8 axis of a motion event. The interpretation of a generic axis is 619 * device-specific. 620 */ 621 static final int AMOTION_EVENT_AXIS_GENERIC_8 = 39; 622 623 /** 624 * Axis constant: Generic 9 axis of a motion event. The interpretation of a generic axis is 625 * device-specific. 626 */ 627 static final int AMOTION_EVENT_AXIS_GENERIC_9 = 40; 628 629 /** 630 * Axis constant: Generic 10 axis of a motion event. The interpretation of a generic axis is 631 * device-specific. 632 */ 633 static final int AMOTION_EVENT_AXIS_GENERIC_10 = 41; 634 635 /** 636 * Axis constant: Generic 11 axis of a motion event. The interpretation of a generic axis is 637 * device-specific. 638 */ 639 static final int AMOTION_EVENT_AXIS_GENERIC_11 = 42; 640 641 /** 642 * Axis constant: Generic 12 axis of a motion event. The interpretation of a generic axis is 643 * device-specific. 644 */ 645 static final int AMOTION_EVENT_AXIS_GENERIC_12 = 43; 646 647 /** 648 * Axis constant: Generic 13 axis of a motion event. The interpretation of a generic axis is 649 * device-specific. 650 */ 651 static final int AMOTION_EVENT_AXIS_GENERIC_13 = 44; 652 653 /** 654 * Axis constant: Generic 14 axis of a motion event. The interpretation of a generic axis is 655 * device-specific. 656 */ 657 static final int AMOTION_EVENT_AXIS_GENERIC_14 = 45; 658 659 /** 660 * Axis constant: Generic 15 axis of a motion event. The interpretation of a generic axis is 661 * device-specific. 662 */ 663 static final int AMOTION_EVENT_AXIS_GENERIC_15 = 46; 664 665 /** 666 * Axis constant: Generic 16 axis of a motion event. The interpretation of a generic axis is 667 * device-specific. 668 */ 669 static final int AMOTION_EVENT_AXIS_GENERIC_16 = 47; 670 671 // NOTE: If you add a new axis here you must also add it to several other files. 672 // Refer to frameworks/base/core/java/android/view/MotionEvent.java for the full list. 673 674 /** 675 * Constants that identify buttons that are associated with motion events. Refer to the 676 * documentation on the MotionEvent class for descriptions of each button. 677 */ 678 /** primary */ 679 static final int AMOTION_EVENT_BUTTON_PRIMARY = 1 << 0; 680 681 /** secondary */ 682 static final int AMOTION_EVENT_BUTTON_SECONDARY = 1 << 1; 683 684 /** tertiary */ 685 static final int AMOTION_EVENT_BUTTON_TERTIARY = 1 << 2; 686 687 /** back */ 688 static final int AMOTION_EVENT_BUTTON_BACK = 1 << 3; 689 690 /** forward */ 691 static final int AMOTION_EVENT_BUTTON_FORWARD = 1 << 4; 692 693 static final int AMOTION_EVENT_BUTTON_STYLUS_PRIMARY = 1 << 5; 694 static final int AMOTION_EVENT_BUTTON_STYLUS_SECONDARY = 1 << 6; 695 696 /** 697 * Constants that identify tool types. Refer to the documentation on the MotionEvent class for 698 * descriptions of each tool type. 699 */ 700 /** unknown */ 701 static final int AMOTION_EVENT_TOOL_TYPE_UNKNOWN = 0; 702 703 /** finger */ 704 static final int AMOTION_EVENT_TOOL_TYPE_FINGER = 1; 705 706 /** stylus */ 707 static final int AMOTION_EVENT_TOOL_TYPE_STYLUS = 2; 708 709 /** mouse */ 710 static final int AMOTION_EVENT_TOOL_TYPE_MOUSE = 3; 711 712 /** eraser */ 713 static final int AMOTION_EVENT_TOOL_TYPE_ERASER = 4; 714 715 /** 716 * Input source masks. 717 * 718 * <p>Refer to the documentation on android.view.InputDevice for more details about input sources 719 * and their correct interpretation. 720 */ 721 /** mask */ 722 static final int AINPUT_SOURCE_CLASS_MASK = 0x000000ff; 723 724 /** none */ 725 static final int AINPUT_SOURCE_CLASS_NONE = 0x00000000; 726 727 /** button */ 728 static final int AINPUT_SOURCE_CLASS_BUTTON = 0x00000001; 729 730 /** pointer */ 731 static final int AINPUT_SOURCE_CLASS_POINTER = 0x00000002; 732 733 /** navigation */ 734 static final int AINPUT_SOURCE_CLASS_NAVIGATION = 0x00000004; 735 736 /** position */ 737 static final int AINPUT_SOURCE_CLASS_POSITION = 0x00000008; 738 739 /** joystick */ 740 static final int AINPUT_SOURCE_CLASS_JOYSTICK = 0x00000010; 741 742 /** Input sources. */ 743 /** unknown */ 744 static final int AINPUT_SOURCE_UNKNOWN = 0x00000000; 745 746 /** keyboard */ 747 static final int AINPUT_SOURCE_KEYBOARD = 0x00000100 | AINPUT_SOURCE_CLASS_BUTTON; 748 749 /** dpad */ 750 static final int AINPUT_SOURCE_DPAD = 0x00000200 | AINPUT_SOURCE_CLASS_BUTTON; 751 752 /** gamepad */ 753 static final int AINPUT_SOURCE_GAMEPAD = 0x00000400 | AINPUT_SOURCE_CLASS_BUTTON; 754 755 /** touchscreen */ 756 static final int AINPUT_SOURCE_TOUCHSCREEN = 0x00001000 | AINPUT_SOURCE_CLASS_POINTER; 757 758 /** mouse */ 759 static final int AINPUT_SOURCE_MOUSE = 0x00002000 | AINPUT_SOURCE_CLASS_POINTER; 760 761 /** stylus */ 762 static final int AINPUT_SOURCE_STYLUS = 0x00004000 | AINPUT_SOURCE_CLASS_POINTER; 763 764 /** bluetooth stylus */ 765 static final int AINPUT_SOURCE_BLUETOOTH_STYLUS = 0x00008000 | AINPUT_SOURCE_STYLUS; 766 767 /** trackball */ 768 static final int AINPUT_SOURCE_TRACKBALL = 0x00010000 | AINPUT_SOURCE_CLASS_NAVIGATION; 769 770 /** mouse relative */ 771 static final int AINPUT_SOURCE_MOUSE_RELATIVE = 0x00020000 | AINPUT_SOURCE_CLASS_NAVIGATION; 772 773 /** touchpad */ 774 static final int AINPUT_SOURCE_TOUCHPAD = 0x00100000 | AINPUT_SOURCE_CLASS_POSITION; 775 776 /** navigation */ 777 static final int AINPUT_SOURCE_TOUCH_NAVIGATION = 0x00200000 | AINPUT_SOURCE_CLASS_NONE; 778 779 /** joystick */ 780 static final int AINPUT_SOURCE_JOYSTICK = 0x01000000 | AINPUT_SOURCE_CLASS_JOYSTICK; 781 782 /** rotary encoder */ 783 static final int AINPUT_SOURCE_ROTARY_ENCODER = 0x00400000 | AINPUT_SOURCE_CLASS_NONE; 784 785 /** any */ 786 static final int AINPUT_SOURCE_ANY = 0xffffff00; 787 788 /** 789 * Keyboard types. 790 * 791 * <p>Refer to the documentation on android.view.InputDevice for more details. 792 */ 793 /** none */ 794 static final int AINPUT_KEYBOARD_TYPE_NONE = 0; 795 796 /** non alphabetic */ 797 static final int AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC = 1; 798 799 /** alphabetic */ 800 static final int AINPUT_KEYBOARD_TYPE_ALPHABETIC = 2; 801 802 // /** 803 // * Constants used to retrieve information about the range of motion for a particular 804 // * coordinate of a motion event. 805 // * 806 // * Refer to the documentation on android.view.InputDevice for more details about input sources 807 // * and their correct interpretation. 808 // * 809 // * @deprecated These constants are deprecated. Use {@link AMOTION_EVENT_AXIS 810 // AMOTION_EVENT_AXIS_*} constants instead. 811 // */ 812 // /** x */ 813 // AINPUT_MOTION_RANGE_X = AMOTION_EVENT_AXIS_X; 814 // /** y */ 815 // AINPUT_MOTION_RANGE_Y = AMOTION_EVENT_AXIS_Y; 816 // /** pressure */ 817 // AINPUT_MOTION_RANGE_PRESSURE = AMOTION_EVENT_AXIS_PRESSURE; 818 // /** size */ 819 // AINPUT_MOTION_RANGE_SIZE = AMOTION_EVENT_AXIS_SIZE; 820 // /** touch major */ 821 // AINPUT_MOTION_RANGE_TOUCH_MAJOR = AMOTION_EVENT_AXIS_TOUCH_MAJOR; 822 // /** touch minor */ 823 // AINPUT_MOTION_RANGE_TOUCH_MINOR = AMOTION_EVENT_AXIS_TOUCH_MINOR; 824 // /** tool major */ 825 // AINPUT_MOTION_RANGE_TOOL_MAJOR = AMOTION_EVENT_AXIS_TOOL_MAJOR; 826 // /** tool minor */ 827 // AINPUT_MOTION_RANGE_TOOL_MINOR = AMOTION_EVENT_AXIS_TOOL_MINOR; 828 // /** orientation */ 829 // AINPUT_MOTION_RANGE_ORIENTATION = AMOTION_EVENT_AXIS_ORIENTATION; 830 // }; 831 // /** 832 // * Input event accessors. 833 // * 834 // * Note that most functions can only be used on input events that are of a given type. 835 // * Calling these functions on input events of other types will yield undefined behavior. 836 // */ 837 // /*** Accessors for all input events. ***/ 838 // /** Get the input event type. */ 839 // int32_t AInputEvent_getType(const AInputEvent* event); 840 // /** Get the id for the device that an input event came from. 841 // * 842 // * Input events can be generated by multiple different input devices. 843 // * Use the input device id to obtain information about the input 844 // * device that was responsible for generating a particular event. 845 // * 846 // * An input device id of 0 indicates that the event didn't come from a physical device; 847 // * other numbers are arbitrary and you shouldn't depend on the values. 848 // * Use the provided input device query API to obtain information about input devices. 849 // */ 850 // int32_t AInputEvent_getDeviceId(const AInputEvent* event); 851 // /** Get the input event source. */ 852 // int32_t AInputEvent_getSource(const AInputEvent* event); 853 // /*** Accessors for key events only. ***/ 854 // /** Get the key event action. */ 855 // int32_t AKeyEvent_getAction(const AInputEvent* key_event); 856 // /** Get the key event flags. */ 857 // int32_t AKeyEvent_getFlags(const AInputEvent* key_event); 858 // /** 859 // * Get the key code of the key event. 860 // * This is the physical key that was pressed, not the Unicode character. 861 // */ 862 // int32_t AKeyEvent_getKeyCode(const AInputEvent* key_event); 863 // /** 864 // * Get the hardware key id of this key event. 865 // * These values are not reliable and vary from device to device. 866 // */ 867 // int32_t AKeyEvent_getScanCode(const AInputEvent* key_event); 868 // /** Get the meta key state. */ 869 // int32_t AKeyEvent_getMetaState(const AInputEvent* key_event); 870 // /** 871 // * Get the repeat count of the event. 872 // * For both key up an key down events, this is the number of times the key has 873 // * repeated with the first down starting at 0 and counting up from there. For 874 // * multiple key events, this is the number of down/up pairs that have occurred. 875 // */ 876 // int32_t AKeyEvent_getRepeatCount(const AInputEvent* key_event); 877 // /** 878 // * Get the time of the most recent key down event, in the 879 // * java.lang.System.nanoTime() time base. If this is a down event, 880 // * this will be the same as eventTime. 881 // * Note that when chording keys, this value is the down time of the most recently 882 // * pressed key, which may not be the same physical key of this event. 883 // */ 884 // int64_t AKeyEvent_getDownTime(const AInputEvent* key_event); 885 // /** 886 // * Get the time this event occurred, in the 887 // * java.lang.System.nanoTime() time base. 888 // */ 889 // int64_t AKeyEvent_getEventTime(const AInputEvent* key_event); 890 // /*** Accessors for motion events only. ***/ 891 // /** Get the combined motion event action code and pointer index. */ 892 // int32_t AMotionEvent_getAction(const AInputEvent* motion_event); 893 // /** Get the motion event flags. */ 894 // int32_t AMotionEvent_getFlags(const AInputEvent* motion_event); 895 // /** 896 // * Get the state of any meta / modifier keys that were in effect when the 897 // * event was generated. 898 // */ 899 // int32_t AMotionEvent_getMetaState(const AInputEvent* motion_event); 900 // #if __ANDROID_API__ >= 14 901 // /** Get the button state of all buttons that are pressed. */ 902 // int32_t AMotionEvent_getButtonState(const AInputEvent* motion_event); 903 // #endif 904 // /** 905 // * Get a bitfield indicating which edges, if any, were touched by this motion event. 906 // * For touch events, clients can use this to determine if the user's finger was 907 // * touching the edge of the display. 908 // */ 909 // int32_t AMotionEvent_getEdgeFlags(const AInputEvent* motion_event); 910 // /** 911 // * Get the time when the user originally pressed down to start a stream of 912 // * position events, in the java.lang.System.nanoTime() time base. 913 // */ 914 // int64_t AMotionEvent_getDownTime(const AInputEvent* motion_event); 915 // /** 916 // * Get the time when this specific event was generated, 917 // * in the java.lang.System.nanoTime() time base. 918 // */ 919 // int64_t AMotionEvent_getEventTime(const AInputEvent* motion_event); 920 // /** 921 // * Get the X coordinate offset. 922 // * For touch events on the screen, this is the delta that was added to the raw 923 // * screen coordinates to adjust for the absolute position of the containing windows 924 // * and views. 925 // */ 926 // float AMotionEvent_getXOffset(const AInputEvent* motion_event); 927 // /** 928 // * Get the Y coordinate offset. 929 // * For touch events on the screen, this is the delta that was added to the raw 930 // * screen coordinates to adjust for the absolute position of the containing windows 931 // * and views. 932 // */ 933 // float AMotionEvent_getYOffset(const AInputEvent* motion_event); 934 // /** 935 // * Get the precision of the X coordinates being reported. 936 // * You can multiply this number with an X coordinate sample to find the 937 // * actual hardware value of the X coordinate. 938 // */ 939 // float AMotionEvent_getXPrecision(const AInputEvent* motion_event); 940 // /** 941 // * Get the precision of the Y coordinates being reported. 942 // * You can multiply this number with a Y coordinate sample to find the 943 // * actual hardware value of the Y coordinate. 944 // */ 945 // float AMotionEvent_getYPrecision(const AInputEvent* motion_event); 946 // /** 947 // * Get the number of pointers of data contained in this event. 948 // * Always >= 1. 949 // */ 950 // size_t AMotionEvent_getPointerCount(const AInputEvent* motion_event); 951 // /** 952 // * Get the pointer identifier associated with a particular pointer 953 // * data index in this event. The identifier tells you the actual pointer 954 // * number associated with the data, accounting for individual pointers 955 // * going up and down since the start of the current gesture. 956 // */ 957 // int32_t AMotionEvent_getPointerId(const AInputEvent* motion_event, size_t pointer_index); 958 // #if __ANDROID_API__ >= 14 959 // /** 960 // * Get the tool type of a pointer for the given pointer index. 961 // * The tool type indicates the type of tool used to make contact such as a 962 // * finger or stylus, if known. 963 // */ 964 // int32_t AMotionEvent_getToolType(const AInputEvent* motion_event, size_t pointer_index); 965 // #endif 966 // /** 967 // * Get the original raw X coordinate of this event. 968 // * For touch events on the screen, this is the original location of the event 969 // * on the screen, before it had been adjusted for the containing window 970 // * and views. 971 // */ 972 // float AMotionEvent_getRawX(const AInputEvent* motion_event, size_t pointer_index); 973 // /** 974 // * Get the original raw X coordinate of this event. 975 // * For touch events on the screen, this is the original location of the event 976 // * on the screen, before it had been adjusted for the containing window 977 // * and views. 978 // */ 979 // float AMotionEvent_getRawY(const AInputEvent* motion_event, size_t pointer_index); 980 // /** 981 // * Get the current X coordinate of this event for the given pointer index. 982 // * Whole numbers are pixels; the value may have a fraction for input devices 983 // * that are sub-pixel precise. 984 // */ 985 // float AMotionEvent_getX(const AInputEvent* motion_event, size_t pointer_index); 986 // /** 987 // * Get the current Y coordinate of this event for the given pointer index. 988 // * Whole numbers are pixels; the value may have a fraction for input devices 989 // * that are sub-pixel precise. 990 // */ 991 // float AMotionEvent_getY(const AInputEvent* motion_event, size_t pointer_index); 992 // /** 993 // * Get the current pressure of this event for the given pointer index. 994 // * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure), 995 // * although values higher than 1 may be generated depending on the calibration of 996 // * the input device. 997 // */ 998 // float AMotionEvent_getPressure(const AInputEvent* motion_event, size_t pointer_index); 999 // /** 1000 // * Get the current scaled value of the approximate size for the given pointer index. 1001 // * This represents some approximation of the area of the screen being 1002 // * pressed; the actual value in pixels corresponding to the 1003 // * touch is normalized with the device specific range of values 1004 // * and scaled to a value between 0 and 1. The value of size can be used to 1005 // * determine fat touch events. 1006 // */ 1007 // float AMotionEvent_getSize(const AInputEvent* motion_event, size_t pointer_index); 1008 // /** 1009 // * Get the current length of the major axis of an ellipse that describes the touch area 1010 // * at the point of contact for the given pointer index. 1011 // */ 1012 // float AMotionEvent_getTouchMajor(const AInputEvent* motion_event, size_t pointer_index); 1013 // /** 1014 // * Get the current length of the minor axis of an ellipse that describes the touch area 1015 // * at the point of contact for the given pointer index. 1016 // */ 1017 // float AMotionEvent_getTouchMinor(const AInputEvent* motion_event, size_t pointer_index); 1018 // /** 1019 // * Get the current length of the major axis of an ellipse that describes the size 1020 // * of the approaching tool for the given pointer index. 1021 // * The tool area represents the estimated size of the finger or pen that is 1022 // * touching the device independent of its actual touch area at the point of contact. 1023 // */ 1024 // float AMotionEvent_getToolMajor(const AInputEvent* motion_event, size_t pointer_index); 1025 // /** 1026 // * Get the current length of the minor axis of an ellipse that describes the size 1027 // * of the approaching tool for the given pointer index. 1028 // * The tool area represents the estimated size of the finger or pen that is 1029 // * touching the device independent of its actual touch area at the point of contact. 1030 // */ 1031 // float AMotionEvent_getToolMinor(const AInputEvent* motion_event, size_t pointer_index); 1032 // /** 1033 // * Get the current orientation of the touch area and tool area in radians clockwise from 1034 // * vertical for the given pointer index. 1035 // * An angle of 0 degrees indicates that the major axis of contact is oriented 1036 // * upwards, is perfectly circular or is of unknown orientation. A positive angle 1037 // * indicates that the major axis of contact is oriented to the right. A negative angle 1038 // * indicates that the major axis of contact is oriented to the left. 1039 // * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians 1040 // * (finger pointing fully right). 1041 // */ 1042 // float AMotionEvent_getOrientation(const AInputEvent* motion_event, size_t pointer_index); 1043 // #if __ANDROID_API__ >= 13 1044 // /** Get the value of the request axis for the given pointer index. */ 1045 // float AMotionEvent_getAxisValue(const AInputEvent* motion_event, 1046 // int32_t axis, size_t pointer_index); 1047 // #endif 1048 // /** 1049 // * Get the number of historical points in this event. These are movements that 1050 // * have occurred between this event and the previous event. This only applies 1051 // * to AMOTION_EVENT_ACTION_MOVE events -- all other actions will have a size of 0. 1052 // * Historical samples are indexed from oldest to newest. 1053 // */ 1054 // size_t AMotionEvent_getHistorySize(const AInputEvent* motion_event); 1055 // /** 1056 // * Get the time that a historical movement occurred between this event and 1057 // * the previous event, in the java.lang.System.nanoTime() time base. 1058 // */ 1059 // int64_t AMotionEvent_getHistoricalEventTime(const AInputEvent* motion_event, 1060 // size_t history_index); 1061 // /** 1062 // * Get the historical raw X coordinate of this event for the given pointer index that 1063 // * occurred between this event and the previous motion event. 1064 // * For touch events on the screen, this is the original location of the event 1065 // * on the screen, before it had been adjusted for the containing window 1066 // * and views. 1067 // * Whole numbers are pixels; the value may have a fraction for input devices 1068 // * that are sub-pixel precise. 1069 // */ 1070 // float AMotionEvent_getHistoricalRawX(const AInputEvent* motion_event, size_t pointer_index, 1071 // size_t history_index); 1072 // /** 1073 // * Get the historical raw Y coordinate of this event for the given pointer index that 1074 // * occurred between this event and the previous motion event. 1075 // * For touch events on the screen, this is the original location of the event 1076 // * on the screen, before it had been adjusted for the containing window 1077 // * and views. 1078 // * Whole numbers are pixels; the value may have a fraction for input devices 1079 // * that are sub-pixel precise. 1080 // */ 1081 // float AMotionEvent_getHistoricalRawY(const AInputEvent* motion_event, size_t pointer_index, 1082 // size_t history_index); 1083 // /** 1084 // * Get the historical X coordinate of this event for the given pointer index that 1085 // * occurred between this event and the previous motion event. 1086 // * Whole numbers are pixels; the value may have a fraction for input devices 1087 // * that are sub-pixel precise. 1088 // */ 1089 // float AMotionEvent_getHistoricalX(const AInputEvent* motion_event, size_t pointer_index, 1090 // size_t history_index); 1091 // /** 1092 // * Get the historical Y coordinate of this event for the given pointer index that 1093 // * occurred between this event and the previous motion event. 1094 // * Whole numbers are pixels; the value may have a fraction for input devices 1095 // * that are sub-pixel precise. 1096 // */ 1097 // float AMotionEvent_getHistoricalY(const AInputEvent* motion_event, size_t pointer_index, 1098 // size_t history_index); 1099 // /** 1100 // * Get the historical pressure of this event for the given pointer index that 1101 // * occurred between this event and the previous motion event. 1102 // * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure), 1103 // * although values higher than 1 may be generated depending on the calibration of 1104 // * the input device. 1105 // */ 1106 // float AMotionEvent_getHistoricalPressure(const AInputEvent* motion_event, size_t 1107 // pointer_index, 1108 // size_t history_index); 1109 // /** 1110 // * Get the current scaled value of the approximate size for the given pointer index that 1111 // * occurred between this event and the previous motion event. 1112 // * This represents some approximation of the area of the screen being 1113 // * pressed; the actual value in pixels corresponding to the 1114 // * touch is normalized with the device specific range of values 1115 // * and scaled to a value between 0 and 1. The value of size can be used to 1116 // * determine fat touch events. 1117 // */ 1118 // float AMotionEvent_getHistoricalSize(const AInputEvent* motion_event, size_t pointer_index, 1119 // size_t history_index); 1120 // /** 1121 // * Get the historical length of the major axis of an ellipse that describes the touch area 1122 // * at the point of contact for the given pointer index that 1123 // * occurred between this event and the previous motion event. 1124 // */ 1125 // float AMotionEvent_getHistoricalTouchMajor(const AInputEvent* motion_event, size_t 1126 // pointer_index, 1127 // size_t history_index); 1128 // /** 1129 // * Get the historical length of the minor axis of an ellipse that describes the touch area 1130 // * at the point of contact for the given pointer index that 1131 // * occurred between this event and the previous motion event. 1132 // */ 1133 // float AMotionEvent_getHistoricalTouchMinor(const AInputEvent* motion_event, size_t 1134 // pointer_index, 1135 // size_t history_index); 1136 // /** 1137 // * Get the historical length of the major axis of an ellipse that describes the size 1138 // * of the approaching tool for the given pointer index that 1139 // * occurred between this event and the previous motion event. 1140 // * The tool area represents the estimated size of the finger or pen that is 1141 // * touching the device independent of its actual touch area at the point of contact. 1142 // */ 1143 // float AMotionEvent_getHistoricalToolMajor(const AInputEvent* motion_event, size_t 1144 // pointer_index, 1145 // size_t history_index); 1146 // /** 1147 // * Get the historical length of the minor axis of an ellipse that describes the size 1148 // * of the approaching tool for the given pointer index that 1149 // * occurred between this event and the previous motion event. 1150 // * The tool area represents the estimated size of the finger or pen that is 1151 // * touching the device independent of its actual touch area at the point of contact. 1152 // */ 1153 // float AMotionEvent_getHistoricalToolMinor(const AInputEvent* motion_event, size_t 1154 // pointer_index, 1155 // size_t history_index); 1156 // /** 1157 // * Get the historical orientation of the touch area and tool area in radians clockwise from 1158 // * vertical for the given pointer index that 1159 // * occurred between this event and the previous motion event. 1160 // * An angle of 0 degrees indicates that the major axis of contact is oriented 1161 // * upwards, is perfectly circular or is of unknown orientation. A positive angle 1162 // * indicates that the major axis of contact is oriented to the right. A negative angle 1163 // * indicates that the major axis of contact is oriented to the left. 1164 // * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians 1165 // * (finger pointing fully right). 1166 // */ 1167 // float AMotionEvent_getHistoricalOrientation(const AInputEvent* motion_event, size_t 1168 // pointer_index, 1169 // size_t history_index); 1170 // #if __ANDROID_API__ >= 13 1171 // /** 1172 // * Get the historical value of the request axis for the given pointer index 1173 // * that occurred between this event and the previous motion event. 1174 // */ 1175 // float AMotionEvent_getHistoricalAxisValue(const AInputEvent* motion_event, 1176 // int32_t axis, size_t pointer_index, size_t history_index); 1177 // #endif 1178 // struct AInputQueue; 1179 // /** 1180 // * Input queue 1181 // * 1182 // * An input queue is the facility through which you retrieve input 1183 // * events. 1184 // */ 1185 // typedef struct AInputQueue AInputQueue; 1186 // /** 1187 // * Add this input queue to a looper for processing. See 1188 // * ALooper_addFd() for information on the ident, callback, and data params. 1189 // */ 1190 // void AInputQueue_attachLooper(AInputQueue* queue, ALooper* looper, 1191 // int ident, ALooper_callbackFunc callback, void* data); 1192 // /** 1193 // * Remove the input queue from the looper it is currently attached to. 1194 // */ 1195 // void AInputQueue_detachLooper(AInputQueue* queue); 1196 // /** 1197 // * Returns true if there are one or more events available in the 1198 // * input queue. Returns 1 if the queue has events; 0 if 1199 // * it does not have events; and a negative value if there is an error. 1200 // */ 1201 // int32_t AInputQueue_hasEvents(AInputQueue* queue); 1202 // /** 1203 // * Returns the next available event from the queue. Returns a negative 1204 // * value if no events are available or an error has occurred. 1205 // */ 1206 // int32_t AInputQueue_getEvent(AInputQueue* queue, AInputEvent** outEvent); 1207 // /** 1208 // * Sends the key for standard pre-dispatching -- that is, possibly deliver 1209 // * it to the current IME to be consumed before the app. Returns 0 if it 1210 // * was not pre-dispatched, meaning you can process it right now. If non-zero 1211 // * is returned, you must abandon the current event processing and allow the 1212 // * event to appear again in the event queue (if it does not get consumed during 1213 // * pre-dispatching). 1214 // */ 1215 // int32_t AInputQueue_preDispatchEvent(AInputQueue* queue, AInputEvent* event); 1216 // /** 1217 // * Report that dispatching has finished with the given event. 1218 // * This must be called after receiving an event with AInputQueue_get_event(). 1219 // */ 1220 // void AInputQueue_finishEvent(AInputQueue* queue, AInputEvent* event, int handled); 1221 // #ifdef __cplusplus 1222 // } 1223 // #endif 1224 // #endif // _ANDROID_INPUT_H 1225 // /** @} */ 1226 } 1227