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