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