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