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