1e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
2e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Copyright (C) 2010 The Android Open Source Project
3e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *
4e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Licensed under the Apache License, Version 2.0 (the "License");
5e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * you may not use this file except in compliance with the License.
6e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * You may obtain a copy of the License at
7e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *
8e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *      http://www.apache.org/licenses/LICENSE-2.0
9e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *
10e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Unless required by applicable law or agreed to in writing, software
11e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * distributed under the License is distributed on an "AS IS" BASIS,
12e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * See the License for the specific language governing permissions and
14e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * limitations under the License.
15e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
16e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
17e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian#ifndef _ANDROID_INPUT_H
18e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian#define _ANDROID_INPUT_H
19e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
20e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/******************************************************************
21e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *
22e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * IMPORTANT NOTICE:
23e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *
24e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *   This file is part of Android's set of stable system headers
25e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *   exposed by the Android NDK (Native Development Kit).
26e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *
27e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *   Third-party source AND binary code relies on the definitions
28e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *   here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES.
29e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *
30e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *   - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES)
31e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *   - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS
32e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *   - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY
33e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *   - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES
34e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
35e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
36e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
37e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Structures and functions to receive and process input events in
38e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * native code.
39e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *
40e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * NOTE: These functions MUST be implemented by /system/lib/libui.so
41e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
42e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
43e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian#include <stdint.h>
44e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian#include <sys/types.h>
45e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian#include <android/keycodes.h>
46e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian#include <android/looper.h>
47e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
48e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian#ifdef __cplusplus
49e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianextern "C" {
50e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian#endif
51e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
52e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
53e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Key states (may be returned by queries about the current state of a
54e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * particular key code, scan code or switch).
55e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
56e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianenum {
57e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* The key state is unknown or the requested key itself is not supported. */
58e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AKEY_STATE_UNKNOWN = -1,
59e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
60e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* The key is up. */
61e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AKEY_STATE_UP = 0,
62e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
63e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* The key is down. */
64e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AKEY_STATE_DOWN = 1,
65e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
66e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* The key is down but is a virtual key press that is being emulated by the system. */
67e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AKEY_STATE_VIRTUAL = 2
68e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian};
69e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
70e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
71e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Meta key / modifer state.
72e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
73e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianenum {
74e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* No meta keys are pressed. */
75e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMETA_NONE = 0,
76e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
77e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* This mask is used to check whether one of the ALT meta keys is pressed. */
78e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMETA_ALT_ON = 0x02,
79e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
80e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* This mask is used to check whether the left ALT meta key is pressed. */
81e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMETA_ALT_LEFT_ON = 0x10,
82e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
83e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* This mask is used to check whether the right ALT meta key is pressed. */
84e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMETA_ALT_RIGHT_ON = 0x20,
85e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
86e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* This mask is used to check whether one of the SHIFT meta keys is pressed. */
87e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMETA_SHIFT_ON = 0x01,
88e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
89e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* This mask is used to check whether the left SHIFT meta key is pressed. */
90e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMETA_SHIFT_LEFT_ON = 0x40,
91e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
92e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* This mask is used to check whether the right SHIFT meta key is pressed. */
93e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMETA_SHIFT_RIGHT_ON = 0x80,
94e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
95e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* This mask is used to check whether the SYM meta key is pressed. */
96e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMETA_SYM_ON = 0x04,
97e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
98e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* This mask is used to check whether the FUNCTION meta key is pressed. */
99e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMETA_FUNCTION_ON = 0x08,
100e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
101e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* This mask is used to check whether one of the CTRL meta keys is pressed. */
102e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMETA_CTRL_ON = 0x1000,
103e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
104e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* This mask is used to check whether the left CTRL meta key is pressed. */
105e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMETA_CTRL_LEFT_ON = 0x2000,
106e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
107e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* This mask is used to check whether the right CTRL meta key is pressed. */
108e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMETA_CTRL_RIGHT_ON = 0x4000,
109e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
110e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* This mask is used to check whether one of the META meta keys is pressed. */
111e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMETA_META_ON = 0x10000,
112e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
113e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* This mask is used to check whether the left META meta key is pressed. */
114e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMETA_META_LEFT_ON = 0x20000,
115e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
116e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* This mask is used to check whether the right META meta key is pressed. */
117e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMETA_META_RIGHT_ON = 0x40000,
118e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
119e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* This mask is used to check whether the CAPS LOCK meta key is on. */
120e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMETA_CAPS_LOCK_ON = 0x100000,
121e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
122e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* This mask is used to check whether the NUM LOCK meta key is on. */
123e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMETA_NUM_LOCK_ON = 0x200000,
124e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
125e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* This mask is used to check whether the SCROLL LOCK meta key is on. */
126e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMETA_SCROLL_LOCK_ON = 0x400000,
127e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian};
128e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
129e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
130e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Input events.
131e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *
132e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Input events are opaque structures.  Use the provided accessors functions to
133e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * read their properties.
134e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
135e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianstruct AInputEvent;
136e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopiantypedef struct AInputEvent AInputEvent;
137e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
138e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
139e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Input event types.
140e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
141e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianenum {
142e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* Indicates that the input event is a key event. */
143e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_EVENT_TYPE_KEY = 1,
144e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
145e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* Indicates that the input event is a motion event. */
146e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_EVENT_TYPE_MOTION = 2
147e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian};
148e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
149e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
150e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Key event actions.
151e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
152e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianenum {
153e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* The key has been pressed down. */
154e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AKEY_EVENT_ACTION_DOWN = 0,
155e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
156e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* The key has been released. */
157e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AKEY_EVENT_ACTION_UP = 1,
158e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
159e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* Multiple duplicate key events have occurred in a row, or a complex string is
160e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * being delivered.  The repeat_count property of the key event contains the number
161e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * of times the given key code should be executed.
162e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     */
163e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AKEY_EVENT_ACTION_MULTIPLE = 2
164e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian};
165e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
166e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
167e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Key event flags.
168e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
169e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianenum {
170e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* This mask is set if the device woke because of this key event. */
171e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AKEY_EVENT_FLAG_WOKE_HERE = 0x1,
172e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
173e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* This mask is set if the key event was generated by a software keyboard. */
174e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AKEY_EVENT_FLAG_SOFT_KEYBOARD = 0x2,
175e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
176e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* This mask is set if we don't want the key event to cause us to leave touch mode. */
177e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AKEY_EVENT_FLAG_KEEP_TOUCH_MODE = 0x4,
178e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
179e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* This mask is set if an event was known to come from a trusted part
180e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * of the system.  That is, the event is known to come from the user,
181e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * and could not have been spoofed by a third party component. */
182e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AKEY_EVENT_FLAG_FROM_SYSTEM = 0x8,
183e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
184e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* This mask is used for compatibility, to identify enter keys that are
185e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * coming from an IME whose enter key has been auto-labelled "next" or
186e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * "done".  This allows TextView to dispatch these as normal enter keys
187e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * for old applications, but still do the appropriate action when
188e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * receiving them. */
189e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AKEY_EVENT_FLAG_EDITOR_ACTION = 0x10,
190e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
191e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* When associated with up key events, this indicates that the key press
192e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * has been canceled.  Typically this is used with virtual touch screen
193e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * keys, where the user can slide from the virtual key area on to the
194e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * display: in that case, the application will receive a canceled up
195e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * event and should not perform the action normally associated with the
196e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * key.  Note that for this to work, the application can not perform an
197e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * action for a key until it receives an up or the long press timeout has
198e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * expired. */
199e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AKEY_EVENT_FLAG_CANCELED = 0x20,
200e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
201e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* This key event was generated by a virtual (on-screen) hard key area.
202e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * Typically this is an area of the touchscreen, outside of the regular
203e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * display, dedicated to "hardware" buttons. */
204e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY = 0x40,
205e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
206e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* This flag is set for the first key repeat that occurs after the
207e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * long press timeout. */
208e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AKEY_EVENT_FLAG_LONG_PRESS = 0x80,
209e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
210e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* Set when a key event has AKEY_EVENT_FLAG_CANCELED set because a long
211e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * press action was executed while it was down. */
212e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AKEY_EVENT_FLAG_CANCELED_LONG_PRESS = 0x100,
213e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
214e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* Set for AKEY_EVENT_ACTION_UP when this event's key code is still being
215e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * tracked from its initial down.  That is, somebody requested that tracking
216e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * started on the key down and a long press has not caused
217e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * the tracking to be canceled. */
218e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AKEY_EVENT_FLAG_TRACKING = 0x200,
219e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
220e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* Set when a key event has been synthesized to implement default behavior
221e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * for an event that the application did not handle.
222e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * Fallback key events are generated by unhandled trackball motions
223e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * (to emulate a directional keypad) and by certain unhandled key presses
224e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * that are declared in the key map (such as special function numeric keypad
225e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * keys when numlock is off). */
226e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AKEY_EVENT_FLAG_FALLBACK = 0x400,
227e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian};
228e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
229e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
230e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Motion event actions.
231e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
232e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
233e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Bit shift for the action bits holding the pointer index as
234e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * defined by AMOTION_EVENT_ACTION_POINTER_INDEX_MASK.
235e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
236e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian#define AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT 8
237e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
238e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianenum {
239e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* Bit mask of the parts of the action code that are the action itself.
240e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     */
241e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_ACTION_MASK = 0xff,
242e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
243e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* Bits in the action code that represent a pointer index, used with
244e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * AMOTION_EVENT_ACTION_POINTER_DOWN and AMOTION_EVENT_ACTION_POINTER_UP.  Shifting
245e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * down by AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT provides the actual pointer
246e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * index where the data for the pointer going up or down can be found.
247e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     */
248e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_ACTION_POINTER_INDEX_MASK  = 0xff00,
249e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
250e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* A pressed gesture has started, the motion contains the initial starting location.
251e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     */
252e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_ACTION_DOWN = 0,
253e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
254e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* A pressed gesture has finished, the motion contains the final release location
255e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * as well as any intermediate points since the last down or move event.
256e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     */
257e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_ACTION_UP = 1,
258e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
259e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* A change has happened during a press gesture (between AMOTION_EVENT_ACTION_DOWN and
260e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * AMOTION_EVENT_ACTION_UP).  The motion contains the most recent point, as well as
261e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * any intermediate points since the last down or move event.
262e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     */
263e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_ACTION_MOVE = 2,
264e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
265e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* The current gesture has been aborted.
266e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * You will not receive any more points in it.  You should treat this as
267e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * an up event, but not perform any action that you normally would.
268e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     */
269e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_ACTION_CANCEL = 3,
270e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
271e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* A movement has happened outside of the normal bounds of the UI element.
272e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * This does not provide a full gesture, but only the initial location of the movement/touch.
273e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     */
274e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_ACTION_OUTSIDE = 4,
275e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
276e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* A non-primary pointer has gone down.
277e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed.
278e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     */
279e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_ACTION_POINTER_DOWN = 5,
280e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
281e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* A non-primary pointer has gone up.
282e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed.
283e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     */
284e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_ACTION_POINTER_UP = 6,
285e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
286e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* A change happened but the pointer is not down (unlike AMOTION_EVENT_ACTION_MOVE).
287e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * The motion contains the most recent point, as well as any intermediate points since
288e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * the last hover move event.
289e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     */
290e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_ACTION_HOVER_MOVE = 7,
291e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
292e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* The motion event contains relative vertical and/or horizontal scroll offsets.
293e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * Use getAxisValue to retrieve the information from AMOTION_EVENT_AXIS_VSCROLL
294e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * and AMOTION_EVENT_AXIS_HSCROLL.
295e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * The pointer may or may not be down when this event is dispatched.
296e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * This action is always delivered to the winder under the pointer, which
297e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * may not be the window currently touched.
298e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     */
299e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_ACTION_SCROLL = 8,
300e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
301e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* The pointer is not down but has entered the boundaries of a window or view.
302e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     */
303e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_ACTION_HOVER_ENTER = 9,
304e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
305e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* The pointer is not down but has exited the boundaries of a window or view.
306e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     */
307e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_ACTION_HOVER_EXIT = 10,
308e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian};
309e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
310e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
311e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Motion event flags.
312e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
313e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianenum {
314e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* This flag indicates that the window that received this motion event is partly
315e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * or wholly obscured by another visible window above it.  This flag is set to true
316e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * even if the event did not directly pass through the obscured area.
317e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * A security sensitive application can check this flag to identify situations in which
318e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * a malicious application may have covered up part of its content for the purpose
319e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * of misleading the user or hijacking touches.  An appropriate response might be
320e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * to drop the suspect touches or to take additional precautions to confirm the user's
321e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     * actual intent.
322e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian     */
323e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED = 0x1,
324e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian};
325e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
326e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
327e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Motion event edge touch flags.
328e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
329e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianenum {
330e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* No edges intersected */
331e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_EDGE_FLAG_NONE = 0,
332e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
333e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* Flag indicating the motion event intersected the top edge of the screen. */
334e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_EDGE_FLAG_TOP = 0x01,
335e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
336e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* Flag indicating the motion event intersected the bottom edge of the screen. */
337e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_EDGE_FLAG_BOTTOM = 0x02,
338e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
339e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* Flag indicating the motion event intersected the left edge of the screen. */
340e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_EDGE_FLAG_LEFT = 0x04,
341e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
342e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    /* Flag indicating the motion event intersected the right edge of the screen. */
343e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_EDGE_FLAG_RIGHT = 0x08
344e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian};
345e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
346e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
347e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Constants that identify each individual axis of a motion event.
348e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Refer to the documentation on the MotionEvent class for descriptions of each axis.
349e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
350e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianenum {
351e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_X = 0,
352e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_Y = 1,
353e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_PRESSURE = 2,
354e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_SIZE = 3,
355e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_TOUCH_MAJOR = 4,
356e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_TOUCH_MINOR = 5,
357e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_TOOL_MAJOR = 6,
358e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_TOOL_MINOR = 7,
359e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_ORIENTATION = 8,
360e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_VSCROLL = 9,
361e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_HSCROLL = 10,
362e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_Z = 11,
363e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_RX = 12,
364e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_RY = 13,
365e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_RZ = 14,
366e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_HAT_X = 15,
367e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_HAT_Y = 16,
368e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_LTRIGGER = 17,
369e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_RTRIGGER = 18,
370e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_THROTTLE = 19,
371e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_RUDDER = 20,
372e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_WHEEL = 21,
373e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_GAS = 22,
374e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_BRAKE = 23,
375e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_DISTANCE = 24,
376e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_TILT = 25,
377e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_GENERIC_1 = 32,
378e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_GENERIC_2 = 33,
379e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_GENERIC_3 = 34,
380e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_GENERIC_4 = 35,
381e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_GENERIC_5 = 36,
382e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_GENERIC_6 = 37,
383e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_GENERIC_7 = 38,
384e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_GENERIC_8 = 39,
385e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_GENERIC_9 = 40,
386e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_GENERIC_10 = 41,
387e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_GENERIC_11 = 42,
388e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_GENERIC_12 = 43,
389e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_GENERIC_13 = 44,
390e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_GENERIC_14 = 45,
391e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_GENERIC_15 = 46,
392e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_AXIS_GENERIC_16 = 47,
393e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
394e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    // NOTE: If you add a new axis here you must also add it to several other files.
395e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    //       Refer to frameworks/base/core/java/android/view/MotionEvent.java for the full list.
396e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian};
397e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
398e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
399e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Constants that identify buttons that are associated with motion events.
400e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Refer to the documentation on the MotionEvent class for descriptions of each button.
401e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
402e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianenum {
403e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_BUTTON_PRIMARY = 1 << 0,
404e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_BUTTON_SECONDARY = 1 << 1,
405e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_BUTTON_TERTIARY = 1 << 2,
406e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_BUTTON_BACK = 1 << 3,
407e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_BUTTON_FORWARD = 1 << 4,
408e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian};
409e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
410e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
411e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Constants that identify tool types.
412e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Refer to the documentation on the MotionEvent class for descriptions of each tool type.
413e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
414e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianenum {
415e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_TOOL_TYPE_UNKNOWN = 0,
416e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_TOOL_TYPE_FINGER = 1,
417e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_TOOL_TYPE_STYLUS = 2,
418e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_TOOL_TYPE_MOUSE = 3,
419e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AMOTION_EVENT_TOOL_TYPE_ERASER = 4,
420e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian};
421e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
422e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
423e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Input sources.
424e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *
425e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Refer to the documentation on android.view.InputDevice for more details about input sources
426e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * and their correct interpretation.
427e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
428e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianenum {
429e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_SOURCE_CLASS_MASK = 0x000000ff,
430e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
431aadaca7169b847d855cf43d94f74800e9faadfc8Michael Wright    AINPUT_SOURCE_CLASS_NONE = 0x00000000,
432e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_SOURCE_CLASS_BUTTON = 0x00000001,
433e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_SOURCE_CLASS_POINTER = 0x00000002,
434e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_SOURCE_CLASS_NAVIGATION = 0x00000004,
435e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_SOURCE_CLASS_POSITION = 0x00000008,
436e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_SOURCE_CLASS_JOYSTICK = 0x00000010,
437e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian};
438e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
439e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianenum {
440e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_SOURCE_UNKNOWN = 0x00000000,
441e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
442e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_SOURCE_KEYBOARD = 0x00000100 | AINPUT_SOURCE_CLASS_BUTTON,
443e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_SOURCE_DPAD = 0x00000200 | AINPUT_SOURCE_CLASS_BUTTON,
444e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_SOURCE_GAMEPAD = 0x00000400 | AINPUT_SOURCE_CLASS_BUTTON,
445e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_SOURCE_TOUCHSCREEN = 0x00001000 | AINPUT_SOURCE_CLASS_POINTER,
446e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_SOURCE_MOUSE = 0x00002000 | AINPUT_SOURCE_CLASS_POINTER,
447e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_SOURCE_STYLUS = 0x00004000 | AINPUT_SOURCE_CLASS_POINTER,
448e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_SOURCE_TRACKBALL = 0x00010000 | AINPUT_SOURCE_CLASS_NAVIGATION,
449e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_SOURCE_TOUCHPAD = 0x00100000 | AINPUT_SOURCE_CLASS_POSITION,
450aadaca7169b847d855cf43d94f74800e9faadfc8Michael Wright    AINPUT_SOURCE_TOUCH_NAVIGATION = 0x00200000 | AINPUT_SOURCE_CLASS_NONE,
451e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_SOURCE_JOYSTICK = 0x01000000 | AINPUT_SOURCE_CLASS_JOYSTICK,
452e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
453e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_SOURCE_ANY = 0xffffff00,
454e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian};
455e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
456e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
457e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Keyboard types.
458e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *
459e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Refer to the documentation on android.view.InputDevice for more details.
460e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
461e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianenum {
462e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_KEYBOARD_TYPE_NONE = 0,
463e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC = 1,
464e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_KEYBOARD_TYPE_ALPHABETIC = 2,
465e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian};
466e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
467e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
468e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Constants used to retrieve information about the range of motion for a particular
469e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * coordinate of a motion event.
470e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *
471e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Refer to the documentation on android.view.InputDevice for more details about input sources
472e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * and their correct interpretation.
473e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *
474e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * DEPRECATION NOTICE: These constants are deprecated.  Use AMOTION_EVENT_AXIS_* constants instead.
475e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
476e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianenum {
477e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_MOTION_RANGE_X = AMOTION_EVENT_AXIS_X,
478e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_MOTION_RANGE_Y = AMOTION_EVENT_AXIS_Y,
479e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_MOTION_RANGE_PRESSURE = AMOTION_EVENT_AXIS_PRESSURE,
480e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_MOTION_RANGE_SIZE = AMOTION_EVENT_AXIS_SIZE,
481e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_MOTION_RANGE_TOUCH_MAJOR = AMOTION_EVENT_AXIS_TOUCH_MAJOR,
482e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_MOTION_RANGE_TOUCH_MINOR = AMOTION_EVENT_AXIS_TOUCH_MINOR,
483e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_MOTION_RANGE_TOOL_MAJOR = AMOTION_EVENT_AXIS_TOOL_MAJOR,
484e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_MOTION_RANGE_TOOL_MINOR = AMOTION_EVENT_AXIS_TOOL_MINOR,
485e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian    AINPUT_MOTION_RANGE_ORIENTATION = AMOTION_EVENT_AXIS_ORIENTATION,
486e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian} __attribute__ ((deprecated));
487e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
488e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
489e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
490e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Input event accessors.
491e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *
492e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Note that most functions can only be used on input events that are of a given type.
493e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Calling these functions on input events of other types will yield undefined behavior.
494e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
495e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
496e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*** Accessors for all input events. ***/
497e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
498e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the input event type. */
499e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint32_t AInputEvent_getType(const AInputEvent* event);
500e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
501e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the id for the device that an input event came from.
502e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *
503e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Input events can be generated by multiple different input devices.
504e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Use the input device id to obtain information about the input
505e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * device that was responsible for generating a particular event.
506e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *
507e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * An input device id of 0 indicates that the event didn't come from a physical device;
508e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * other numbers are arbitrary and you shouldn't depend on the values.
509e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Use the provided input device query API to obtain information about input devices.
510e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
511e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint32_t AInputEvent_getDeviceId(const AInputEvent* event);
512e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
513e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the input event source. */
514e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint32_t AInputEvent_getSource(const AInputEvent* event);
515e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
516e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*** Accessors for key events only. ***/
517e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
518e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the key event action. */
519e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint32_t AKeyEvent_getAction(const AInputEvent* key_event);
520e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
521e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the key event flags. */
522e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint32_t AKeyEvent_getFlags(const AInputEvent* key_event);
523e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
524e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the key code of the key event.
525e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * This is the physical key that was pressed, not the Unicode character. */
526e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint32_t AKeyEvent_getKeyCode(const AInputEvent* key_event);
527e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
528e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the hardware key id of this key event.
529e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * These values are not reliable and vary from device to device. */
530e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint32_t AKeyEvent_getScanCode(const AInputEvent* key_event);
531e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
532e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the meta key state. */
533e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint32_t AKeyEvent_getMetaState(const AInputEvent* key_event);
534e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
535e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the repeat count of the event.
536e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * For both key up an key down events, this is the number of times the key has
537e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * repeated with the first down starting at 0 and counting up from there.  For
538e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * multiple key events, this is the number of down/up pairs that have occurred. */
539e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint32_t AKeyEvent_getRepeatCount(const AInputEvent* key_event);
540e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
541e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the time of the most recent key down event, in the
542e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * java.lang.System.nanoTime() time base.  If this is a down event,
543e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * this will be the same as eventTime.
544e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Note that when chording keys, this value is the down time of the most recently
545e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * pressed key, which may not be the same physical key of this event. */
546e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint64_t AKeyEvent_getDownTime(const AInputEvent* key_event);
547e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
548e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the time this event occurred, in the
549e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * java.lang.System.nanoTime() time base. */
550e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint64_t AKeyEvent_getEventTime(const AInputEvent* key_event);
551e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
552e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*** Accessors for motion events only. ***/
553e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
554e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the combined motion event action code and pointer index. */
555e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint32_t AMotionEvent_getAction(const AInputEvent* motion_event);
556e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
557e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the motion event flags. */
558e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint32_t AMotionEvent_getFlags(const AInputEvent* motion_event);
559e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
560e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the state of any meta / modifier keys that were in effect when the
561e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * event was generated. */
562e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint32_t AMotionEvent_getMetaState(const AInputEvent* motion_event);
563e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
564e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the button state of all buttons that are pressed. */
565e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint32_t AMotionEvent_getButtonState(const AInputEvent* motion_event);
566e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
567e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get a bitfield indicating which edges, if any, were touched by this motion event.
568e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * For touch events, clients can use this to determine if the user's finger was
569e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * touching the edge of the display. */
570e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint32_t AMotionEvent_getEdgeFlags(const AInputEvent* motion_event);
571e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
572e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the time when the user originally pressed down to start a stream of
573e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * position events, in the java.lang.System.nanoTime() time base. */
574e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint64_t AMotionEvent_getDownTime(const AInputEvent* motion_event);
575e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
576e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the time when this specific event was generated,
577e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * in the java.lang.System.nanoTime() time base. */
578e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint64_t AMotionEvent_getEventTime(const AInputEvent* motion_event);
579e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
580e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the X coordinate offset.
581e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * For touch events on the screen, this is the delta that was added to the raw
582e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * screen coordinates to adjust for the absolute position of the containing windows
583e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * and views. */
584e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianfloat AMotionEvent_getXOffset(const AInputEvent* motion_event);
585e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
5868769436bba6b0601f6110f907324c7cfe51cae7aDavid Friedman/* Get the Y coordinate offset.
587e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * For touch events on the screen, this is the delta that was added to the raw
588e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * screen coordinates to adjust for the absolute position of the containing windows
589e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * and views. */
590e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianfloat AMotionEvent_getYOffset(const AInputEvent* motion_event);
591e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
592e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the precision of the X coordinates being reported.
593e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * You can multiply this number with an X coordinate sample to find the
594e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * actual hardware value of the X coordinate. */
595e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianfloat AMotionEvent_getXPrecision(const AInputEvent* motion_event);
596e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
597e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the precision of the Y coordinates being reported.
598e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * You can multiply this number with a Y coordinate sample to find the
599e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * actual hardware value of the Y coordinate. */
600e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianfloat AMotionEvent_getYPrecision(const AInputEvent* motion_event);
601e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
602e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the number of pointers of data contained in this event.
603e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Always >= 1. */
604e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopiansize_t AMotionEvent_getPointerCount(const AInputEvent* motion_event);
605e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
606e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the pointer identifier associated with a particular pointer
607e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * data index in this event.  The identifier tells you the actual pointer
608e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * number associated with the data, accounting for individual pointers
609e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * going up and down since the start of the current gesture. */
610e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint32_t AMotionEvent_getPointerId(const AInputEvent* motion_event, size_t pointer_index);
611e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
612e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the tool type of a pointer for the given pointer index.
613e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * The tool type indicates the type of tool used to make contact such as a
614e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * finger or stylus, if known. */
615e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint32_t AMotionEvent_getToolType(const AInputEvent* motion_event, size_t pointer_index);
616e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
617e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the original raw X coordinate of this event.
618e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * For touch events on the screen, this is the original location of the event
619e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * on the screen, before it had been adjusted for the containing window
620e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * and views. */
621e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianfloat AMotionEvent_getRawX(const AInputEvent* motion_event, size_t pointer_index);
622e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
623e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the original raw X coordinate of this event.
624e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * For touch events on the screen, this is the original location of the event
625e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * on the screen, before it had been adjusted for the containing window
626e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * and views. */
627e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianfloat AMotionEvent_getRawY(const AInputEvent* motion_event, size_t pointer_index);
628e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
629e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the current X coordinate of this event for the given pointer index.
630e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Whole numbers are pixels; the value may have a fraction for input devices
631e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * that are sub-pixel precise. */
632e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianfloat AMotionEvent_getX(const AInputEvent* motion_event, size_t pointer_index);
633e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
634e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the current Y coordinate of this event for the given pointer index.
635e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Whole numbers are pixels; the value may have a fraction for input devices
636e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * that are sub-pixel precise. */
637e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianfloat AMotionEvent_getY(const AInputEvent* motion_event, size_t pointer_index);
638e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
639e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the current pressure of this event for the given pointer index.
640e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure),
641e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * although values higher than 1 may be generated depending on the calibration of
642e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * the input device. */
643e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianfloat AMotionEvent_getPressure(const AInputEvent* motion_event, size_t pointer_index);
644e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
645e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the current scaled value of the approximate size for the given pointer index.
646e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * This represents some approximation of the area of the screen being
647e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * pressed; the actual value in pixels corresponding to the
648e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * touch is normalized with the device specific range of values
649e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * and scaled to a value between 0 and 1.  The value of size can be used to
650e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * determine fat touch events. */
651e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianfloat AMotionEvent_getSize(const AInputEvent* motion_event, size_t pointer_index);
652e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
653e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the current length of the major axis of an ellipse that describes the touch area
654e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * at the point of contact for the given pointer index. */
655e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianfloat AMotionEvent_getTouchMajor(const AInputEvent* motion_event, size_t pointer_index);
656e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
657e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the current length of the minor axis of an ellipse that describes the touch area
658e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * at the point of contact for the given pointer index. */
659e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianfloat AMotionEvent_getTouchMinor(const AInputEvent* motion_event, size_t pointer_index);
660e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
661e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the current length of the major axis of an ellipse that describes the size
662e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * of the approaching tool for the given pointer index.
663e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * The tool area represents the estimated size of the finger or pen that is
664e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * touching the device independent of its actual touch area at the point of contact. */
665e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianfloat AMotionEvent_getToolMajor(const AInputEvent* motion_event, size_t pointer_index);
666e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
667e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the current length of the minor axis of an ellipse that describes the size
668e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * of the approaching tool for the given pointer index.
669e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * The tool area represents the estimated size of the finger or pen that is
670e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * touching the device independent of its actual touch area at the point of contact. */
671e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianfloat AMotionEvent_getToolMinor(const AInputEvent* motion_event, size_t pointer_index);
672e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
673e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the current orientation of the touch area and tool area in radians clockwise from
674e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * vertical for the given pointer index.
675e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * An angle of 0 degrees indicates that the major axis of contact is oriented
676e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * upwards, is perfectly circular or is of unknown orientation.  A positive angle
677e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * indicates that the major axis of contact is oriented to the right.  A negative angle
678e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * indicates that the major axis of contact is oriented to the left.
679e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
680e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * (finger pointing fully right). */
681e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianfloat AMotionEvent_getOrientation(const AInputEvent* motion_event, size_t pointer_index);
682e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
683e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the value of the request axis for the given pointer index. */
684e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianfloat AMotionEvent_getAxisValue(const AInputEvent* motion_event,
685e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian        int32_t axis, size_t pointer_index);
686e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
687e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the number of historical points in this event.  These are movements that
688e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * have occurred between this event and the previous event.  This only applies
689e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * to AMOTION_EVENT_ACTION_MOVE events -- all other actions will have a size of 0.
690e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Historical samples are indexed from oldest to newest. */
691e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopiansize_t AMotionEvent_getHistorySize(const AInputEvent* motion_event);
692e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
693e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the time that a historical movement occurred between this event and
694e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * the previous event, in the java.lang.System.nanoTime() time base. */
69526c24162817a1986c2afbff15dbe896b0cbcc01dAndrew Hsiehint64_t AMotionEvent_getHistoricalEventTime(const AInputEvent* motion_event,
696e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian        size_t history_index);
697e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
698e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the historical raw X coordinate of this event for the given pointer index that
699e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * occurred between this event and the previous motion event.
700e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * For touch events on the screen, this is the original location of the event
701e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * on the screen, before it had been adjusted for the containing window
702e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * and views.
703e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Whole numbers are pixels; the value may have a fraction for input devices
704e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * that are sub-pixel precise. */
705e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianfloat AMotionEvent_getHistoricalRawX(const AInputEvent* motion_event, size_t pointer_index,
706e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian        size_t history_index);
707e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
708e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the historical raw Y coordinate of this event for the given pointer index that
709e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * occurred between this event and the previous motion event.
710e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * For touch events on the screen, this is the original location of the event
711e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * on the screen, before it had been adjusted for the containing window
712e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * and views.
713e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Whole numbers are pixels; the value may have a fraction for input devices
714e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * that are sub-pixel precise. */
715e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianfloat AMotionEvent_getHistoricalRawY(const AInputEvent* motion_event, size_t pointer_index,
716e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian        size_t history_index);
717e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
718e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the historical X coordinate of this event for the given pointer index that
719e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * occurred between this event and the previous motion event.
720e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Whole numbers are pixels; the value may have a fraction for input devices
721e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * that are sub-pixel precise. */
72226c24162817a1986c2afbff15dbe896b0cbcc01dAndrew Hsiehfloat AMotionEvent_getHistoricalX(const AInputEvent* motion_event, size_t pointer_index,
723e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian        size_t history_index);
724e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
725e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the historical Y coordinate of this event for the given pointer index that
726e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * occurred between this event and the previous motion event.
727e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Whole numbers are pixels; the value may have a fraction for input devices
728e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * that are sub-pixel precise. */
72926c24162817a1986c2afbff15dbe896b0cbcc01dAndrew Hsiehfloat AMotionEvent_getHistoricalY(const AInputEvent* motion_event, size_t pointer_index,
730e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian        size_t history_index);
731e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
732e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the historical pressure of this event for the given pointer index that
733e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * occurred between this event and the previous motion event.
734e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure),
735e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * although values higher than 1 may be generated depending on the calibration of
736e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * the input device. */
73726c24162817a1986c2afbff15dbe896b0cbcc01dAndrew Hsiehfloat AMotionEvent_getHistoricalPressure(const AInputEvent* motion_event, size_t pointer_index,
738e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian        size_t history_index);
739e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
740e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the current scaled value of the approximate size for the given pointer index that
741e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * occurred between this event and the previous motion event.
742e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * This represents some approximation of the area of the screen being
743e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * pressed; the actual value in pixels corresponding to the
744e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * touch is normalized with the device specific range of values
745e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * and scaled to a value between 0 and 1.  The value of size can be used to
746e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * determine fat touch events. */
74726c24162817a1986c2afbff15dbe896b0cbcc01dAndrew Hsiehfloat AMotionEvent_getHistoricalSize(const AInputEvent* motion_event, size_t pointer_index,
748e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian        size_t history_index);
749e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
750e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the historical length of the major axis of an ellipse that describes the touch area
751e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * at the point of contact for the given pointer index that
752e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * occurred between this event and the previous motion event. */
753e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianfloat AMotionEvent_getHistoricalTouchMajor(const AInputEvent* motion_event, size_t pointer_index,
754e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian        size_t history_index);
755e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
756e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the historical length of the minor axis of an ellipse that describes the touch area
757e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * at the point of contact for the given pointer index that
758e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * occurred between this event and the previous motion event. */
759e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianfloat AMotionEvent_getHistoricalTouchMinor(const AInputEvent* motion_event, size_t pointer_index,
760e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian        size_t history_index);
761e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
762e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the historical length of the major axis of an ellipse that describes the size
763e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * of the approaching tool for the given pointer index that
764e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * occurred between this event and the previous motion event.
765e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * The tool area represents the estimated size of the finger or pen that is
766e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * touching the device independent of its actual touch area at the point of contact. */
767e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianfloat AMotionEvent_getHistoricalToolMajor(const AInputEvent* motion_event, size_t pointer_index,
768e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian        size_t history_index);
769e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
770e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the historical length of the minor axis of an ellipse that describes the size
771e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * of the approaching tool for the given pointer index that
772e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * occurred between this event and the previous motion event.
773e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * The tool area represents the estimated size of the finger or pen that is
774e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * touching the device independent of its actual touch area at the point of contact. */
775e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianfloat AMotionEvent_getHistoricalToolMinor(const AInputEvent* motion_event, size_t pointer_index,
776e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian        size_t history_index);
777e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
778e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the historical orientation of the touch area and tool area in radians clockwise from
779e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * vertical for the given pointer index that
780e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * occurred between this event and the previous motion event.
781e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * An angle of 0 degrees indicates that the major axis of contact is oriented
782e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * upwards, is perfectly circular or is of unknown orientation.  A positive angle
783e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * indicates that the major axis of contact is oriented to the right.  A negative angle
784e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * indicates that the major axis of contact is oriented to the left.
785e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
786e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * (finger pointing fully right). */
787e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianfloat AMotionEvent_getHistoricalOrientation(const AInputEvent* motion_event, size_t pointer_index,
788e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian        size_t history_index);
789e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
790e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/* Get the historical value of the request axis for the given pointer index
791e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * that occurred between this event and the previous motion event. */
792e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianfloat AMotionEvent_getHistoricalAxisValue(const AInputEvent* motion_event,
793e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian        int32_t axis, size_t pointer_index, size_t history_index);
794e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
795e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
796e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
797e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Input queue
798e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian *
799e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * An input queue is the facility through which you retrieve input
800e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * events.
801e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
802e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianstruct AInputQueue;
803e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopiantypedef struct AInputQueue AInputQueue;
804e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
805e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
806e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Add this input queue to a looper for processing.  See
807e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * ALooper_addFd() for information on the ident, callback, and data params.
808e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
809e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianvoid AInputQueue_attachLooper(AInputQueue* queue, ALooper* looper,
810e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian        int ident, ALooper_callbackFunc callback, void* data);
811e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
812e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
813e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Remove the input queue from the looper it is currently attached to.
814e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
815e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianvoid AInputQueue_detachLooper(AInputQueue* queue);
816e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
817e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
818e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Returns true if there are one or more events available in the
819e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * input queue.  Returns 1 if the queue has events; 0 if
820e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * it does not have events; and a negative value if there is an error.
821e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
822e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint32_t AInputQueue_hasEvents(AInputQueue* queue);
823e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
824e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
825e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Returns the next available event from the queue.  Returns a negative
826e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * value if no events are available or an error has occurred.
827e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
828e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint32_t AInputQueue_getEvent(AInputQueue* queue, AInputEvent** outEvent);
829e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
830e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
831e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Sends the key for standard pre-dispatching -- that is, possibly deliver
832e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * it to the current IME to be consumed before the app.  Returns 0 if it
833e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * was not pre-dispatched, meaning you can process it right now.  If non-zero
834e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * is returned, you must abandon the current event processing and allow the
835e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * event to appear again in the event queue (if it does not get consumed during
836e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * pre-dispatching).
837e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
838e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianint32_t AInputQueue_preDispatchEvent(AInputQueue* queue, AInputEvent* event);
839e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
840e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian/*
841e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * Report that dispatching has finished with the given event.
842e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian * This must be called after receiving an event with AInputQueue_get_event().
843e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian */
844e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopianvoid AInputQueue_finishEvent(AInputQueue* queue, AInputEvent* event, int handled);
845e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
846e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian#ifdef __cplusplus
847e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian}
848e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian#endif
849e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian
850e1c61d3cc8458ce9a15d8109f728e60f5248939dMathias Agopian#endif // _ANDROID_INPUT_H
851