development
修訂 | e9c29dc997e5e3fe881464939fd7133c08ff1016 (tree) |
---|---|
時間 | 2011-02-10 16:58:52 |
作者 | David 'Digit' Turner <digit@goog...> |
Commiter | Android Git Automerger |
am 729ad212: am aa276460: ndk: Add headers and libraries for API level 11 (Honeycomb)
* commit '729ad2126b092307ff9f4c67cce64170114527ea':
@@ -0,0 +1,153 @@ | ||
1 | +AAssetDir_close | |
2 | +AAssetDir_getNextFileName | |
3 | +AAssetDir_rewind | |
4 | +AAssetManager_fromJava | |
5 | +AAssetManager_open | |
6 | +AAssetManager_openDir | |
7 | +AAsset_close | |
8 | +AAsset_getBuffer | |
9 | +AAsset_getLength | |
10 | +AAsset_getLength64 | |
11 | +AAsset_getRemainingLength | |
12 | +AAsset_getRemainingLength64 | |
13 | +AAsset_isAllocated | |
14 | +AAsset_openFileDescriptor | |
15 | +AAsset_openFileDescriptor64 | |
16 | +AAsset_read | |
17 | +AAsset_seek | |
18 | +AAsset_seek64 | |
19 | +AConfiguration_copy | |
20 | +AConfiguration_delete | |
21 | +AConfiguration_diff | |
22 | +AConfiguration_fromAssetManager | |
23 | +AConfiguration_getCountry | |
24 | +AConfiguration_getDensity | |
25 | +AConfiguration_getKeyboard | |
26 | +AConfiguration_getKeysHidden | |
27 | +AConfiguration_getLanguage | |
28 | +AConfiguration_getMcc | |
29 | +AConfiguration_getMnc | |
30 | +AConfiguration_getNavHidden | |
31 | +AConfiguration_getNavigation | |
32 | +AConfiguration_getOrientation | |
33 | +AConfiguration_getScreenLong | |
34 | +AConfiguration_getScreenSize | |
35 | +AConfiguration_getSdkVersion | |
36 | +AConfiguration_getTouchscreen | |
37 | +AConfiguration_getUiModeNight | |
38 | +AConfiguration_getUiModeType | |
39 | +AConfiguration_isBetterThan | |
40 | +AConfiguration_match | |
41 | +AConfiguration_new | |
42 | +AConfiguration_setCountry | |
43 | +AConfiguration_setDensity | |
44 | +AConfiguration_setKeyboard | |
45 | +AConfiguration_setKeysHidden | |
46 | +AConfiguration_setLanguage | |
47 | +AConfiguration_setMcc | |
48 | +AConfiguration_setMnc | |
49 | +AConfiguration_setNavHidden | |
50 | +AConfiguration_setNavigation | |
51 | +AConfiguration_setOrientation | |
52 | +AConfiguration_setScreenLong | |
53 | +AConfiguration_setScreenSize | |
54 | +AConfiguration_setSdkVersion | |
55 | +AConfiguration_setTouchscreen | |
56 | +AConfiguration_setUiModeNight | |
57 | +AConfiguration_setUiModeType | |
58 | +AInputEvent_getDeviceId | |
59 | +AInputEvent_getSource | |
60 | +AInputEvent_getType | |
61 | +AInputQueue_attachLooper | |
62 | +AInputQueue_detachLooper | |
63 | +AInputQueue_finishEvent | |
64 | +AInputQueue_getEvent | |
65 | +AInputQueue_hasEvents | |
66 | +AInputQueue_preDispatchEvent | |
67 | +AKeyEvent_getAction | |
68 | +AKeyEvent_getDownTime | |
69 | +AKeyEvent_getEventTime | |
70 | +AKeyEvent_getFlags | |
71 | +AKeyEvent_getKeyCode | |
72 | +AKeyEvent_getMetaState | |
73 | +AKeyEvent_getRepeatCount | |
74 | +AKeyEvent_getScanCode | |
75 | +ALooper_acquire | |
76 | +ALooper_addFd | |
77 | +ALooper_forThread | |
78 | +ALooper_pollAll | |
79 | +ALooper_pollOnce | |
80 | +ALooper_prepare | |
81 | +ALooper_release | |
82 | +ALooper_removeFd | |
83 | +ALooper_wake | |
84 | +AMotionEvent_getAction | |
85 | +AMotionEvent_getDownTime | |
86 | +AMotionEvent_getEdgeFlags | |
87 | +AMotionEvent_getEventTime | |
88 | +AMotionEvent_getFlags | |
89 | +AMotionEvent_getHistoricalEventTime | |
90 | +AMotionEvent_getHistoricalPressure | |
91 | +AMotionEvent_getHistoricalSize | |
92 | +AMotionEvent_getHistoricalX | |
93 | +AMotionEvent_getHistoricalY | |
94 | +AMotionEvent_getHistorySize | |
95 | +AMotionEvent_getMetaState | |
96 | +AMotionEvent_getOrientation | |
97 | +AMotionEvent_getPointerCount | |
98 | +AMotionEvent_getPointerId | |
99 | +AMotionEvent_getPressure | |
100 | +AMotionEvent_getRawX | |
101 | +AMotionEvent_getRawY | |
102 | +AMotionEvent_getSize | |
103 | +AMotionEvent_getToolMajor | |
104 | +AMotionEvent_getToolMinor | |
105 | +AMotionEvent_getTouchMajor | |
106 | +AMotionEvent_getTouchMinor | |
107 | +AMotionEvent_getX | |
108 | +AMotionEvent_getXOffset | |
109 | +AMotionEvent_getXPrecision | |
110 | +AMotionEvent_getY | |
111 | +AMotionEvent_getYOffset | |
112 | +AMotionEvent_getYPrecision | |
113 | +ANativeActivity_finish | |
114 | +ANativeActivity_hideSoftInput | |
115 | +ANativeActivity_setWindowFlags | |
116 | +ANativeActivity_setWindowFormat | |
117 | +ANativeActivity_showSoftInput | |
118 | +ANativeWindow_acquire | |
119 | +ANativeWindow_fromSurface | |
120 | +ANativeWindow_getFormat | |
121 | +ANativeWindow_getHeight | |
122 | +ANativeWindow_getWidth | |
123 | +ANativeWindow_lock | |
124 | +ANativeWindow_release | |
125 | +ANativeWindow_setBuffersGeometry | |
126 | +ANativeWindow_unlockAndPost | |
127 | +AObbInfo_delete | |
128 | +AObbInfo_getFlags | |
129 | +AObbInfo_getPackageName | |
130 | +AObbInfo_getVersion | |
131 | +AObbScanner_getObbInfo | |
132 | +ASensorEventQueue_disableSensor | |
133 | +ASensorEventQueue_enableSensor | |
134 | +ASensorEventQueue_getEvents | |
135 | +ASensorEventQueue_hasEvents | |
136 | +ASensorEventQueue_setEventRate | |
137 | +ASensorManager_createEventQueue | |
138 | +ASensorManager_destroyEventQueue | |
139 | +ASensorManager_getDefaultSensor | |
140 | +ASensorManager_getInstance | |
141 | +ASensorManager_getSensorList | |
142 | +ASensor_getMinDelay | |
143 | +ASensor_getName | |
144 | +ASensor_getResolution | |
145 | +ASensor_getType | |
146 | +ASensor_getVendor | |
147 | +AStorageManager_delete | |
148 | +AStorageManager_getMountedObbPath | |
149 | +AStorageManager_isObbMounted | |
150 | +AStorageManager_mountObb | |
151 | +AStorageManager_new | |
152 | +AStorageManager_unmountObb | |
153 | + |
@@ -0,0 +1,175 @@ | ||
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 | + | |
17 | + | |
18 | +#ifndef ANDROID_ASSET_MANAGER_H | |
19 | +#define ANDROID_ASSET_MANAGER_H | |
20 | + | |
21 | +#ifdef __cplusplus | |
22 | +extern "C" { | |
23 | +#endif | |
24 | + | |
25 | +struct AAssetManager; | |
26 | +typedef struct AAssetManager AAssetManager; | |
27 | + | |
28 | +struct AAssetDir; | |
29 | +typedef struct AAssetDir AAssetDir; | |
30 | + | |
31 | +struct AAsset; | |
32 | +typedef struct AAsset AAsset; | |
33 | + | |
34 | +/* Available modes for opening assets */ | |
35 | +enum { | |
36 | + AASSET_MODE_UNKNOWN = 0, | |
37 | + AASSET_MODE_RANDOM = 1, | |
38 | + AASSET_MODE_STREAMING = 2, | |
39 | + AASSET_MODE_BUFFER = 3 | |
40 | +}; | |
41 | + | |
42 | + | |
43 | +/** | |
44 | + * Open the named directory within the asset hierarchy. The directory can then | |
45 | + * be inspected with the AAssetDir functions. To open the top-level directory, | |
46 | + * pass in "" as the dirName. | |
47 | + * | |
48 | + * The object returned here should be freed by calling AAssetDir_close(). | |
49 | + */ | |
50 | +AAssetDir* AAssetManager_openDir(AAssetManager* mgr, const char* dirName); | |
51 | + | |
52 | +/** | |
53 | + * Open an asset. | |
54 | + * | |
55 | + * The object returned here should be freed by calling AAsset_close(). | |
56 | + */ | |
57 | +AAsset* AAssetManager_open(AAssetManager* mgr, const char* filename, int mode); | |
58 | + | |
59 | +/** | |
60 | + * Iterate over the files in an asset directory. A NULL string is returned | |
61 | + * when all the file names have been returned. | |
62 | + * | |
63 | + * The returned file name is suitable for passing to AAssetManager_open(). | |
64 | + * | |
65 | + * The string returned here is owned by the AssetDir implementation and is not | |
66 | + * guaranteed to remain valid if any other calls are made on this AAssetDir | |
67 | + * instance. | |
68 | + */ | |
69 | +const char* AAssetDir_getNextFileName(AAssetDir* assetDir); | |
70 | + | |
71 | +/** | |
72 | + * Reset the iteration state of AAssetDir_getNextFileName() to the beginning. | |
73 | + */ | |
74 | +void AAssetDir_rewind(AAssetDir* assetDir); | |
75 | + | |
76 | +/** | |
77 | + * Close an opened AAssetDir, freeing any related resources. | |
78 | + */ | |
79 | +void AAssetDir_close(AAssetDir* assetDir); | |
80 | + | |
81 | +/** | |
82 | + * Attempt to read 'count' bytes of data from the current offset. | |
83 | + * | |
84 | + * Returns the number of bytes read, zero on EOF, or < 0 on error. | |
85 | + */ | |
86 | +int AAsset_read(AAsset* asset, void* buf, size_t count); | |
87 | + | |
88 | +/** | |
89 | + * Seek to the specified offset within the asset data. 'whence' uses the | |
90 | + * same constants as lseek()/fseek(). | |
91 | + * | |
92 | + * Returns the new position on success, or (off_t) -1 on error. | |
93 | + */ | |
94 | +off_t AAsset_seek(AAsset* asset, off_t offset, int whence); | |
95 | + | |
96 | +/** | |
97 | + * Seek to the specified offset within the asset data. 'whence' uses the | |
98 | + * same constants as lseek()/fseek(). | |
99 | + * | |
100 | + * Uses 64-bit data type for large files as opposed to the 32-bit type used | |
101 | + * by AAsset_seek. | |
102 | + * | |
103 | + * Returns the new position on success, or (off64_t) -1 on error. | |
104 | + */ | |
105 | +off64_t AAsset_seek64(AAsset* asset, off64_t offset, int whence); | |
106 | + | |
107 | +/** | |
108 | + * Close the asset, freeing all associated resources. | |
109 | + */ | |
110 | +void AAsset_close(AAsset* asset); | |
111 | + | |
112 | +/** | |
113 | + * Get a pointer to a buffer holding the entire contents of the assset. | |
114 | + * | |
115 | + * Returns NULL on failure. | |
116 | + */ | |
117 | +const void* AAsset_getBuffer(AAsset* asset); | |
118 | + | |
119 | +/** | |
120 | + * Report the total size of the asset data. | |
121 | + */ | |
122 | +off_t AAsset_getLength(AAsset* asset); | |
123 | + | |
124 | +/** | |
125 | + * Report the total size of the asset data. Reports the size using a 64-bit | |
126 | + * number insted of 32-bit as AAsset_getLength. | |
127 | + */ | |
128 | +off64_t AAsset_getLength64(AAsset* asset); | |
129 | + | |
130 | +/** | |
131 | + * Report the total amount of asset data that can be read from the current position. | |
132 | + */ | |
133 | +off_t AAsset_getRemainingLength(AAsset* asset); | |
134 | + | |
135 | +/** | |
136 | + * Report the total amount of asset data that can be read from the current position. | |
137 | + * | |
138 | + * Uses a 64-bit number instead of a 32-bit number as AAsset_getRemainingLength does. | |
139 | + */ | |
140 | +off64_t AAsset_getRemainingLength64(AAsset* asset); | |
141 | + | |
142 | +/** | |
143 | + * Open a new file descriptor that can be used to read the asset data. If the | |
144 | + * start or length cannot be represented by a 32-bit number, it will be | |
145 | + * truncated. If the file is large, use AAsset_openFileDescriptor64 instead. | |
146 | + * | |
147 | + * Returns < 0 if direct fd access is not possible (for example, if the asset is | |
148 | + * compressed). | |
149 | + */ | |
150 | +int AAsset_openFileDescriptor(AAsset* asset, off_t* outStart, off_t* outLength); | |
151 | + | |
152 | +/** | |
153 | + * Open a new file descriptor that can be used to read the asset data. | |
154 | + * | |
155 | + * Uses a 64-bit number for the offset and length instead of 32-bit instead of | |
156 | + * as AAsset_openFileDescriptor does. | |
157 | + * | |
158 | + * Returns < 0 if direct fd access is not possible (for example, if the asset is | |
159 | + * compressed). | |
160 | + */ | |
161 | +int AAsset_openFileDescriptor64(AAsset* asset, off64_t* outStart, off64_t* outLength); | |
162 | + | |
163 | +/** | |
164 | + * Returns whether this asset's internal buffer is allocated in ordinary RAM (i.e. not | |
165 | + * mmapped). | |
166 | + */ | |
167 | +int AAsset_isAllocated(AAsset* asset); | |
168 | + | |
169 | + | |
170 | + | |
171 | +#ifdef __cplusplus | |
172 | +}; | |
173 | +#endif | |
174 | + | |
175 | +#endif // ANDROID_ASSET_MANAGER_H |
@@ -0,0 +1,724 @@ | ||
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 | + | |
17 | +#ifndef _ANDROID_INPUT_H | |
18 | +#define _ANDROID_INPUT_H | |
19 | + | |
20 | +/****************************************************************** | |
21 | + * | |
22 | + * IMPORTANT NOTICE: | |
23 | + * | |
24 | + * This file is part of Android's set of stable system headers | |
25 | + * exposed by the Android NDK (Native Development Kit). | |
26 | + * | |
27 | + * Third-party source AND binary code relies on the definitions | |
28 | + * here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES. | |
29 | + * | |
30 | + * - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES) | |
31 | + * - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS | |
32 | + * - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY | |
33 | + * - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES | |
34 | + */ | |
35 | + | |
36 | +/* | |
37 | + * Structures and functions to receive and process input events in | |
38 | + * native code. | |
39 | + * | |
40 | + * NOTE: These functions MUST be implemented by /system/lib/libui.so | |
41 | + */ | |
42 | + | |
43 | +#include <stdint.h> | |
44 | +#include <sys/types.h> | |
45 | +#include <android/keycodes.h> | |
46 | +#include <android/looper.h> | |
47 | + | |
48 | +#ifdef __cplusplus | |
49 | +extern "C" { | |
50 | +#endif | |
51 | + | |
52 | +/* | |
53 | + * Key states (may be returned by queries about the current state of a | |
54 | + * particular key code, scan code or switch). | |
55 | + */ | |
56 | +enum { | |
57 | + /* The key state is unknown or the requested key itself is not supported. */ | |
58 | + AKEY_STATE_UNKNOWN = -1, | |
59 | + | |
60 | + /* The key is up. */ | |
61 | + AKEY_STATE_UP = 0, | |
62 | + | |
63 | + /* The key is down. */ | |
64 | + AKEY_STATE_DOWN = 1, | |
65 | + | |
66 | + /* The key is down but is a virtual key press that is being emulated by the system. */ | |
67 | + AKEY_STATE_VIRTUAL = 2 | |
68 | +}; | |
69 | + | |
70 | +/* | |
71 | + * Meta key / modifer state. | |
72 | + */ | |
73 | +enum { | |
74 | + /* No meta keys are pressed. */ | |
75 | + AMETA_NONE = 0, | |
76 | + | |
77 | + /* This mask is used to check whether one of the ALT meta keys is pressed. */ | |
78 | + AMETA_ALT_ON = 0x02, | |
79 | + | |
80 | + /* This mask is used to check whether the left ALT meta key is pressed. */ | |
81 | + AMETA_ALT_LEFT_ON = 0x10, | |
82 | + | |
83 | + /* This mask is used to check whether the right ALT meta key is pressed. */ | |
84 | + AMETA_ALT_RIGHT_ON = 0x20, | |
85 | + | |
86 | + /* This mask is used to check whether one of the SHIFT meta keys is pressed. */ | |
87 | + AMETA_SHIFT_ON = 0x01, | |
88 | + | |
89 | + /* This mask is used to check whether the left SHIFT meta key is pressed. */ | |
90 | + AMETA_SHIFT_LEFT_ON = 0x40, | |
91 | + | |
92 | + /* This mask is used to check whether the right SHIFT meta key is pressed. */ | |
93 | + AMETA_SHIFT_RIGHT_ON = 0x80, | |
94 | + | |
95 | + /* This mask is used to check whether the SYM meta key is pressed. */ | |
96 | + AMETA_SYM_ON = 0x04, | |
97 | + | |
98 | + /* This mask is used to check whether the FUNCTION meta key is pressed. */ | |
99 | + AMETA_FUNCTION_ON = 0x08, | |
100 | + | |
101 | + /* This mask is used to check whether one of the CTRL meta keys is pressed. */ | |
102 | + AMETA_CTRL_ON = 0x1000, | |
103 | + | |
104 | + /* This mask is used to check whether the left CTRL meta key is pressed. */ | |
105 | + AMETA_CTRL_LEFT_ON = 0x2000, | |
106 | + | |
107 | + /* This mask is used to check whether the right CTRL meta key is pressed. */ | |
108 | + AMETA_CTRL_RIGHT_ON = 0x4000, | |
109 | + | |
110 | + /* This mask is used to check whether one of the META meta keys is pressed. */ | |
111 | + AMETA_META_ON = 0x10000, | |
112 | + | |
113 | + /* This mask is used to check whether the left META meta key is pressed. */ | |
114 | + AMETA_META_LEFT_ON = 0x20000, | |
115 | + | |
116 | + /* This mask is used to check whether the right META meta key is pressed. */ | |
117 | + AMETA_META_RIGHT_ON = 0x40000, | |
118 | + | |
119 | + /* This mask is used to check whether the CAPS LOCK meta key is on. */ | |
120 | + AMETA_CAPS_LOCK_ON = 0x100000, | |
121 | + | |
122 | + /* This mask is used to check whether the NUM LOCK meta key is on. */ | |
123 | + AMETA_NUM_LOCK_ON = 0x200000, | |
124 | + | |
125 | + /* This mask is used to check whether the SCROLL LOCK meta key is on. */ | |
126 | + AMETA_SCROLL_LOCK_ON = 0x400000, | |
127 | +}; | |
128 | + | |
129 | +/* | |
130 | + * Input events. | |
131 | + * | |
132 | + * Input events are opaque structures. Use the provided accessors functions to | |
133 | + * read their properties. | |
134 | + */ | |
135 | +struct AInputEvent; | |
136 | +typedef struct AInputEvent AInputEvent; | |
137 | + | |
138 | +/* | |
139 | + * Input event types. | |
140 | + */ | |
141 | +enum { | |
142 | + /* Indicates that the input event is a key event. */ | |
143 | + AINPUT_EVENT_TYPE_KEY = 1, | |
144 | + | |
145 | + /* Indicates that the input event is a motion event. */ | |
146 | + AINPUT_EVENT_TYPE_MOTION = 2 | |
147 | +}; | |
148 | + | |
149 | +/* | |
150 | + * Key event actions. | |
151 | + */ | |
152 | +enum { | |
153 | + /* The key has been pressed down. */ | |
154 | + AKEY_EVENT_ACTION_DOWN = 0, | |
155 | + | |
156 | + /* The key has been released. */ | |
157 | + AKEY_EVENT_ACTION_UP = 1, | |
158 | + | |
159 | + /* Multiple duplicate key events have occurred in a row, or a complex string is | |
160 | + * being delivered. The repeat_count property of the key event contains the number | |
161 | + * of times the given key code should be executed. | |
162 | + */ | |
163 | + AKEY_EVENT_ACTION_MULTIPLE = 2 | |
164 | +}; | |
165 | + | |
166 | +/* | |
167 | + * Key event flags. | |
168 | + */ | |
169 | +enum { | |
170 | + /* This mask is set if the device woke because of this key event. */ | |
171 | + AKEY_EVENT_FLAG_WOKE_HERE = 0x1, | |
172 | + | |
173 | + /* This mask is set if the key event was generated by a software keyboard. */ | |
174 | + AKEY_EVENT_FLAG_SOFT_KEYBOARD = 0x2, | |
175 | + | |
176 | + /* This mask is set if we don't want the key event to cause us to leave touch mode. */ | |
177 | + AKEY_EVENT_FLAG_KEEP_TOUCH_MODE = 0x4, | |
178 | + | |
179 | + /* This mask is set if an event was known to come from a trusted part | |
180 | + * of the system. That is, the event is known to come from the user, | |
181 | + * and could not have been spoofed by a third party component. */ | |
182 | + AKEY_EVENT_FLAG_FROM_SYSTEM = 0x8, | |
183 | + | |
184 | + /* This mask is used for compatibility, to identify enter keys that are | |
185 | + * coming from an IME whose enter key has been auto-labelled "next" or | |
186 | + * "done". This allows TextView to dispatch these as normal enter keys | |
187 | + * for old applications, but still do the appropriate action when | |
188 | + * receiving them. */ | |
189 | + AKEY_EVENT_FLAG_EDITOR_ACTION = 0x10, | |
190 | + | |
191 | + /* When associated with up key events, this indicates that the key press | |
192 | + * has been canceled. Typically this is used with virtual touch screen | |
193 | + * keys, where the user can slide from the virtual key area on to the | |
194 | + * display: in that case, the application will receive a canceled up | |
195 | + * event and should not perform the action normally associated with the | |
196 | + * key. Note that for this to work, the application can not perform an | |
197 | + * action for a key until it receives an up or the long press timeout has | |
198 | + * expired. */ | |
199 | + AKEY_EVENT_FLAG_CANCELED = 0x20, | |
200 | + | |
201 | + /* This key event was generated by a virtual (on-screen) hard key area. | |
202 | + * Typically this is an area of the touchscreen, outside of the regular | |
203 | + * display, dedicated to "hardware" buttons. */ | |
204 | + AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY = 0x40, | |
205 | + | |
206 | + /* This flag is set for the first key repeat that occurs after the | |
207 | + * long press timeout. */ | |
208 | + AKEY_EVENT_FLAG_LONG_PRESS = 0x80, | |
209 | + | |
210 | + /* Set when a key event has AKEY_EVENT_FLAG_CANCELED set because a long | |
211 | + * press action was executed while it was down. */ | |
212 | + AKEY_EVENT_FLAG_CANCELED_LONG_PRESS = 0x100, | |
213 | + | |
214 | + /* Set for AKEY_EVENT_ACTION_UP when this event's key code is still being | |
215 | + * tracked from its initial down. That is, somebody requested that tracking | |
216 | + * started on the key down and a long press has not caused | |
217 | + * the tracking to be canceled. */ | |
218 | + AKEY_EVENT_FLAG_TRACKING = 0x200, | |
219 | + | |
220 | + /* Set when a key event has been synthesized to implement default behavior | |
221 | + * for an event that the application did not handle. | |
222 | + * Fallback key events are generated by unhandled trackball motions | |
223 | + * (to emulate a directional keypad) and by certain unhandled key presses | |
224 | + * that are declared in the key map (such as special function numeric keypad | |
225 | + * keys when numlock is off). */ | |
226 | + AKEY_EVENT_FLAG_FALLBACK = 0x400, | |
227 | +}; | |
228 | + | |
229 | +/* | |
230 | + * Motion event actions. | |
231 | + */ | |
232 | + | |
233 | +/* Bit shift for the action bits holding the pointer index as | |
234 | + * defined by AMOTION_EVENT_ACTION_POINTER_INDEX_MASK. | |
235 | + */ | |
236 | +#define AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT 8 | |
237 | + | |
238 | +enum { | |
239 | + /* Bit mask of the parts of the action code that are the action itself. | |
240 | + */ | |
241 | + AMOTION_EVENT_ACTION_MASK = 0xff, | |
242 | + | |
243 | + /* Bits in the action code that represent a pointer index, used with | |
244 | + * AMOTION_EVENT_ACTION_POINTER_DOWN and AMOTION_EVENT_ACTION_POINTER_UP. Shifting | |
245 | + * down by AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT provides the actual pointer | |
246 | + * index where the data for the pointer going up or down can be found. | |
247 | + */ | |
248 | + AMOTION_EVENT_ACTION_POINTER_INDEX_MASK = 0xff00, | |
249 | + | |
250 | + /* A pressed gesture has started, the motion contains the initial starting location. | |
251 | + */ | |
252 | + AMOTION_EVENT_ACTION_DOWN = 0, | |
253 | + | |
254 | + /* A pressed gesture has finished, the motion contains the final release location | |
255 | + * as well as any intermediate points since the last down or move event. | |
256 | + */ | |
257 | + AMOTION_EVENT_ACTION_UP = 1, | |
258 | + | |
259 | + /* A change has happened during a press gesture (between AMOTION_EVENT_ACTION_DOWN and | |
260 | + * AMOTION_EVENT_ACTION_UP). The motion contains the most recent point, as well as | |
261 | + * any intermediate points since the last down or move event. | |
262 | + */ | |
263 | + AMOTION_EVENT_ACTION_MOVE = 2, | |
264 | + | |
265 | + /* The current gesture has been aborted. | |
266 | + * You will not receive any more points in it. You should treat this as | |
267 | + * an up event, but not perform any action that you normally would. | |
268 | + */ | |
269 | + AMOTION_EVENT_ACTION_CANCEL = 3, | |
270 | + | |
271 | + /* A movement has happened outside of the normal bounds of the UI element. | |
272 | + * This does not provide a full gesture, but only the initial location of the movement/touch. | |
273 | + */ | |
274 | + AMOTION_EVENT_ACTION_OUTSIDE = 4, | |
275 | + | |
276 | + /* A non-primary pointer has gone down. | |
277 | + * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed. | |
278 | + */ | |
279 | + AMOTION_EVENT_ACTION_POINTER_DOWN = 5, | |
280 | + | |
281 | + /* A non-primary pointer has gone up. | |
282 | + * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed. | |
283 | + */ | |
284 | + AMOTION_EVENT_ACTION_POINTER_UP = 6 | |
285 | +}; | |
286 | + | |
287 | +/* | |
288 | + * Motion event flags. | |
289 | + */ | |
290 | +enum { | |
291 | + /* This flag indicates that the window that received this motion event is partly | |
292 | + * or wholly obscured by another visible window above it. This flag is set to true | |
293 | + * even if the event did not directly pass through the obscured area. | |
294 | + * A security sensitive application can check this flag to identify situations in which | |
295 | + * a malicious application may have covered up part of its content for the purpose | |
296 | + * of misleading the user or hijacking touches. An appropriate response might be | |
297 | + * to drop the suspect touches or to take additional precautions to confirm the user's | |
298 | + * actual intent. | |
299 | + */ | |
300 | + AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED = 0x1, | |
301 | +}; | |
302 | + | |
303 | +/* | |
304 | + * Motion event edge touch flags. | |
305 | + */ | |
306 | +enum { | |
307 | + /* No edges intersected */ | |
308 | + AMOTION_EVENT_EDGE_FLAG_NONE = 0, | |
309 | + | |
310 | + /* Flag indicating the motion event intersected the top edge of the screen. */ | |
311 | + AMOTION_EVENT_EDGE_FLAG_TOP = 0x01, | |
312 | + | |
313 | + /* Flag indicating the motion event intersected the bottom edge of the screen. */ | |
314 | + AMOTION_EVENT_EDGE_FLAG_BOTTOM = 0x02, | |
315 | + | |
316 | + /* Flag indicating the motion event intersected the left edge of the screen. */ | |
317 | + AMOTION_EVENT_EDGE_FLAG_LEFT = 0x04, | |
318 | + | |
319 | + /* Flag indicating the motion event intersected the right edge of the screen. */ | |
320 | + AMOTION_EVENT_EDGE_FLAG_RIGHT = 0x08 | |
321 | +}; | |
322 | + | |
323 | +/* | |
324 | + * Input sources. | |
325 | + * | |
326 | + * Refer to the documentation on android.view.InputDevice for more details about input sources | |
327 | + * and their correct interpretation. | |
328 | + */ | |
329 | +enum { | |
330 | + AINPUT_SOURCE_CLASS_MASK = 0x000000ff, | |
331 | + | |
332 | + AINPUT_SOURCE_CLASS_BUTTON = 0x00000001, | |
333 | + AINPUT_SOURCE_CLASS_POINTER = 0x00000002, | |
334 | + AINPUT_SOURCE_CLASS_NAVIGATION = 0x00000004, | |
335 | + AINPUT_SOURCE_CLASS_POSITION = 0x00000008, | |
336 | +}; | |
337 | + | |
338 | +enum { | |
339 | + AINPUT_SOURCE_UNKNOWN = 0x00000000, | |
340 | + | |
341 | + AINPUT_SOURCE_KEYBOARD = 0x00000100 | AINPUT_SOURCE_CLASS_BUTTON, | |
342 | + AINPUT_SOURCE_DPAD = 0x00000200 | AINPUT_SOURCE_CLASS_BUTTON, | |
343 | + AINPUT_SOURCE_TOUCHSCREEN = 0x00001000 | AINPUT_SOURCE_CLASS_POINTER, | |
344 | + AINPUT_SOURCE_MOUSE = 0x00002000 | AINPUT_SOURCE_CLASS_POINTER, | |
345 | + AINPUT_SOURCE_TRACKBALL = 0x00010000 | AINPUT_SOURCE_CLASS_NAVIGATION, | |
346 | + AINPUT_SOURCE_TOUCHPAD = 0x00100000 | AINPUT_SOURCE_CLASS_POSITION, | |
347 | + | |
348 | + AINPUT_SOURCE_ANY = 0xffffff00, | |
349 | +}; | |
350 | + | |
351 | +/* | |
352 | + * Keyboard types. | |
353 | + * | |
354 | + * Refer to the documentation on android.view.InputDevice for more details. | |
355 | + */ | |
356 | +enum { | |
357 | + AINPUT_KEYBOARD_TYPE_NONE = 0, | |
358 | + AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC = 1, | |
359 | + AINPUT_KEYBOARD_TYPE_ALPHABETIC = 2, | |
360 | +}; | |
361 | + | |
362 | +/* | |
363 | + * Constants used to retrieve information about the range of motion for a particular | |
364 | + * coordinate of a motion event. | |
365 | + * | |
366 | + * Refer to the documentation on android.view.InputDevice for more details about input sources | |
367 | + * and their correct interpretation. | |
368 | + */ | |
369 | +enum { | |
370 | + AINPUT_MOTION_RANGE_X = 0, | |
371 | + AINPUT_MOTION_RANGE_Y = 1, | |
372 | + AINPUT_MOTION_RANGE_PRESSURE = 2, | |
373 | + AINPUT_MOTION_RANGE_SIZE = 3, | |
374 | + AINPUT_MOTION_RANGE_TOUCH_MAJOR = 4, | |
375 | + AINPUT_MOTION_RANGE_TOUCH_MINOR = 5, | |
376 | + AINPUT_MOTION_RANGE_TOOL_MAJOR = 6, | |
377 | + AINPUT_MOTION_RANGE_TOOL_MINOR = 7, | |
378 | + AINPUT_MOTION_RANGE_ORIENTATION = 8, | |
379 | +}; | |
380 | + | |
381 | + | |
382 | +/* | |
383 | + * Input event accessors. | |
384 | + * | |
385 | + * Note that most functions can only be used on input events that are of a given type. | |
386 | + * Calling these functions on input events of other types will yield undefined behavior. | |
387 | + */ | |
388 | + | |
389 | +/*** Accessors for all input events. ***/ | |
390 | + | |
391 | +/* Get the input event type. */ | |
392 | +int32_t AInputEvent_getType(const AInputEvent* event); | |
393 | + | |
394 | +/* Get the id for the device that an input event came from. | |
395 | + * | |
396 | + * Input events can be generated by multiple different input devices. | |
397 | + * Use the input device id to obtain information about the input | |
398 | + * device that was responsible for generating a particular event. | |
399 | + * | |
400 | + * An input device id of 0 indicates that the event didn't come from a physical device; | |
401 | + * other numbers are arbitrary and you shouldn't depend on the values. | |
402 | + * Use the provided input device query API to obtain information about input devices. | |
403 | + */ | |
404 | +int32_t AInputEvent_getDeviceId(const AInputEvent* event); | |
405 | + | |
406 | +/* Get the input event source. */ | |
407 | +int32_t AInputEvent_getSource(const AInputEvent* event); | |
408 | + | |
409 | +/*** Accessors for key events only. ***/ | |
410 | + | |
411 | +/* Get the key event action. */ | |
412 | +int32_t AKeyEvent_getAction(const AInputEvent* key_event); | |
413 | + | |
414 | +/* Get the key event flags. */ | |
415 | +int32_t AKeyEvent_getFlags(const AInputEvent* key_event); | |
416 | + | |
417 | +/* Get the key code of the key event. | |
418 | + * This is the physical key that was pressed, not the Unicode character. */ | |
419 | +int32_t AKeyEvent_getKeyCode(const AInputEvent* key_event); | |
420 | + | |
421 | +/* Get the hardware key id of this key event. | |
422 | + * These values are not reliable and vary from device to device. */ | |
423 | +int32_t AKeyEvent_getScanCode(const AInputEvent* key_event); | |
424 | + | |
425 | +/* Get the meta key state. */ | |
426 | +int32_t AKeyEvent_getMetaState(const AInputEvent* key_event); | |
427 | + | |
428 | +/* Get the repeat count of the event. | |
429 | + * For both key up an key down events, this is the number of times the key has | |
430 | + * repeated with the first down starting at 0 and counting up from there. For | |
431 | + * multiple key events, this is the number of down/up pairs that have occurred. */ | |
432 | +int32_t AKeyEvent_getRepeatCount(const AInputEvent* key_event); | |
433 | + | |
434 | +/* Get the time of the most recent key down event, in the | |
435 | + * java.lang.System.nanoTime() time base. If this is a down event, | |
436 | + * this will be the same as eventTime. | |
437 | + * Note that when chording keys, this value is the down time of the most recently | |
438 | + * pressed key, which may not be the same physical key of this event. */ | |
439 | +int64_t AKeyEvent_getDownTime(const AInputEvent* key_event); | |
440 | + | |
441 | +/* Get the time this event occurred, in the | |
442 | + * java.lang.System.nanoTime() time base. */ | |
443 | +int64_t AKeyEvent_getEventTime(const AInputEvent* key_event); | |
444 | + | |
445 | +/*** Accessors for motion events only. ***/ | |
446 | + | |
447 | +/* Get the combined motion event action code and pointer index. */ | |
448 | +int32_t AMotionEvent_getAction(const AInputEvent* motion_event); | |
449 | + | |
450 | +/* Get the motion event flags. */ | |
451 | +int32_t AMotionEvent_getFlags(const AInputEvent* motion_event); | |
452 | + | |
453 | +/* Get the state of any meta / modifier keys that were in effect when the | |
454 | + * event was generated. */ | |
455 | +int32_t AMotionEvent_getMetaState(const AInputEvent* motion_event); | |
456 | + | |
457 | +/* Get a bitfield indicating which edges, if any, were touched by this motion event. | |
458 | + * For touch events, clients can use this to determine if the user's finger was | |
459 | + * touching the edge of the display. */ | |
460 | +int32_t AMotionEvent_getEdgeFlags(const AInputEvent* motion_event); | |
461 | + | |
462 | +/* Get the time when the user originally pressed down to start a stream of | |
463 | + * position events, in the java.lang.System.nanoTime() time base. */ | |
464 | +int64_t AMotionEvent_getDownTime(const AInputEvent* motion_event); | |
465 | + | |
466 | +/* Get the time when this specific event was generated, | |
467 | + * in the java.lang.System.nanoTime() time base. */ | |
468 | +int64_t AMotionEvent_getEventTime(const AInputEvent* motion_event); | |
469 | + | |
470 | +/* Get the X coordinate offset. | |
471 | + * For touch events on the screen, this is the delta that was added to the raw | |
472 | + * screen coordinates to adjust for the absolute position of the containing windows | |
473 | + * and views. */ | |
474 | +float AMotionEvent_getXOffset(const AInputEvent* motion_event); | |
475 | + | |
476 | +/* Get the precision of the Y coordinates being reported. | |
477 | + * For touch events on the screen, this is the delta that was added to the raw | |
478 | + * screen coordinates to adjust for the absolute position of the containing windows | |
479 | + * and views. */ | |
480 | +float AMotionEvent_getYOffset(const AInputEvent* motion_event); | |
481 | + | |
482 | +/* Get the precision of the X coordinates being reported. | |
483 | + * You can multiply this number with an X coordinate sample to find the | |
484 | + * actual hardware value of the X coordinate. */ | |
485 | +float AMotionEvent_getXPrecision(const AInputEvent* motion_event); | |
486 | + | |
487 | +/* Get the precision of the Y coordinates being reported. | |
488 | + * You can multiply this number with a Y coordinate sample to find the | |
489 | + * actual hardware value of the Y coordinate. */ | |
490 | +float AMotionEvent_getYPrecision(const AInputEvent* motion_event); | |
491 | + | |
492 | +/* Get the number of pointers of data contained in this event. | |
493 | + * Always >= 1. */ | |
494 | +size_t AMotionEvent_getPointerCount(const AInputEvent* motion_event); | |
495 | + | |
496 | +/* Get the pointer identifier associated with a particular pointer | |
497 | + * data index is this event. The identifier tells you the actual pointer | |
498 | + * number associated with the data, accounting for individual pointers | |
499 | + * going up and down since the start of the current gesture. */ | |
500 | +int32_t AMotionEvent_getPointerId(const AInputEvent* motion_event, size_t pointer_index); | |
501 | + | |
502 | +/* Get the original raw X coordinate of this event. | |
503 | + * For touch events on the screen, this is the original location of the event | |
504 | + * on the screen, before it had been adjusted for the containing window | |
505 | + * and views. */ | |
506 | +float AMotionEvent_getRawX(const AInputEvent* motion_event, size_t pointer_index); | |
507 | + | |
508 | +/* Get the original raw X coordinate of this event. | |
509 | + * For touch events on the screen, this is the original location of the event | |
510 | + * on the screen, before it had been adjusted for the containing window | |
511 | + * and views. */ | |
512 | +float AMotionEvent_getRawY(const AInputEvent* motion_event, size_t pointer_index); | |
513 | + | |
514 | +/* Get the current X coordinate of this event for the given pointer index. | |
515 | + * Whole numbers are pixels; the value may have a fraction for input devices | |
516 | + * that are sub-pixel precise. */ | |
517 | +float AMotionEvent_getX(const AInputEvent* motion_event, size_t pointer_index); | |
518 | + | |
519 | +/* Get the current Y coordinate of this event for the given pointer index. | |
520 | + * Whole numbers are pixels; the value may have a fraction for input devices | |
521 | + * that are sub-pixel precise. */ | |
522 | +float AMotionEvent_getY(const AInputEvent* motion_event, size_t pointer_index); | |
523 | + | |
524 | +/* Get the current pressure of this event for the given pointer index. | |
525 | + * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure), | |
526 | + * however values higher than 1 may be generated depending on the calibration of | |
527 | + * the input device. */ | |
528 | +float AMotionEvent_getPressure(const AInputEvent* motion_event, size_t pointer_index); | |
529 | + | |
530 | +/* Get the current scaled value of the approximate size for the given pointer index. | |
531 | + * This represents some approximation of the area of the screen being | |
532 | + * pressed; the actual value in pixels corresponding to the | |
533 | + * touch is normalized with the device specific range of values | |
534 | + * and scaled to a value between 0 and 1. The value of size can be used to | |
535 | + * determine fat touch events. */ | |
536 | +float AMotionEvent_getSize(const AInputEvent* motion_event, size_t pointer_index); | |
537 | + | |
538 | +/* Get the current length of the major axis of an ellipse that describes the touch area | |
539 | + * at the point of contact for the given pointer index. */ | |
540 | +float AMotionEvent_getTouchMajor(const AInputEvent* motion_event, size_t pointer_index); | |
541 | + | |
542 | +/* Get the current length of the minor axis of an ellipse that describes the touch area | |
543 | + * at the point of contact for the given pointer index. */ | |
544 | +float AMotionEvent_getTouchMinor(const AInputEvent* motion_event, size_t pointer_index); | |
545 | + | |
546 | +/* Get the current length of the major axis of an ellipse that describes the size | |
547 | + * of the approaching tool for the given pointer index. | |
548 | + * The tool area represents the estimated size of the finger or pen that is | |
549 | + * touching the device independent of its actual touch area at the point of contact. */ | |
550 | +float AMotionEvent_getToolMajor(const AInputEvent* motion_event, size_t pointer_index); | |
551 | + | |
552 | +/* Get the current length of the minor axis of an ellipse that describes the size | |
553 | + * of the approaching tool for the given pointer index. | |
554 | + * The tool area represents the estimated size of the finger or pen that is | |
555 | + * touching the device independent of its actual touch area at the point of contact. */ | |
556 | +float AMotionEvent_getToolMinor(const AInputEvent* motion_event, size_t pointer_index); | |
557 | + | |
558 | +/* Get the current orientation of the touch area and tool area in radians clockwise from | |
559 | + * vertical for the given pointer index. | |
560 | + * An angle of 0 degrees indicates that the major axis of contact is oriented | |
561 | + * upwards, is perfectly circular or is of unknown orientation. A positive angle | |
562 | + * indicates that the major axis of contact is oriented to the right. A negative angle | |
563 | + * indicates that the major axis of contact is oriented to the left. | |
564 | + * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians | |
565 | + * (finger pointing fully right). */ | |
566 | +float AMotionEvent_getOrientation(const AInputEvent* motion_event, size_t pointer_index); | |
567 | + | |
568 | +/* Get the number of historical points in this event. These are movements that | |
569 | + * have occurred between this event and the previous event. This only applies | |
570 | + * to AMOTION_EVENT_ACTION_MOVE events -- all other actions will have a size of 0. | |
571 | + * Historical samples are indexed from oldest to newest. */ | |
572 | +size_t AMotionEvent_getHistorySize(const AInputEvent* motion_event); | |
573 | + | |
574 | +/* Get the time that a historical movement occurred between this event and | |
575 | + * the previous event, in the java.lang.System.nanoTime() time base. */ | |
576 | +int64_t AMotionEvent_getHistoricalEventTime(AInputEvent* motion_event, | |
577 | + size_t history_index); | |
578 | + | |
579 | +/* Get the historical raw X coordinate of this event for the given pointer index that | |
580 | + * occurred between this event and the previous motion event. | |
581 | + * For touch events on the screen, this is the original location of the event | |
582 | + * on the screen, before it had been adjusted for the containing window | |
583 | + * and views. | |
584 | + * Whole numbers are pixels; the value may have a fraction for input devices | |
585 | + * that are sub-pixel precise. */ | |
586 | +float AMotionEvent_getHistoricalRawX(const AInputEvent* motion_event, size_t pointer_index); | |
587 | + | |
588 | +/* Get the historical raw Y coordinate of this event for the given pointer index that | |
589 | + * occurred between this event and the previous motion event. | |
590 | + * For touch events on the screen, this is the original location of the event | |
591 | + * on the screen, before it had been adjusted for the containing window | |
592 | + * and views. | |
593 | + * Whole numbers are pixels; the value may have a fraction for input devices | |
594 | + * that are sub-pixel precise. */ | |
595 | +float AMotionEvent_getHistoricalRawY(const AInputEvent* motion_event, size_t pointer_index); | |
596 | + | |
597 | +/* Get the historical X coordinate of this event for the given pointer index that | |
598 | + * occurred between this event and the previous motion event. | |
599 | + * Whole numbers are pixels; the value may have a fraction for input devices | |
600 | + * that are sub-pixel precise. */ | |
601 | +float AMotionEvent_getHistoricalX(AInputEvent* motion_event, size_t pointer_index, | |
602 | + size_t history_index); | |
603 | + | |
604 | +/* Get the historical Y coordinate of this event for the given pointer index that | |
605 | + * occurred between this event and the previous motion event. | |
606 | + * Whole numbers are pixels; the value may have a fraction for input devices | |
607 | + * that are sub-pixel precise. */ | |
608 | +float AMotionEvent_getHistoricalY(AInputEvent* motion_event, size_t pointer_index, | |
609 | + size_t history_index); | |
610 | + | |
611 | +/* Get the historical pressure of this event for the given pointer index that | |
612 | + * occurred between this event and the previous motion event. | |
613 | + * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure), | |
614 | + * however values higher than 1 may be generated depending on the calibration of | |
615 | + * the input device. */ | |
616 | +float AMotionEvent_getHistoricalPressure(AInputEvent* motion_event, size_t pointer_index, | |
617 | + size_t history_index); | |
618 | + | |
619 | +/* Get the current scaled value of the approximate size for the given pointer index that | |
620 | + * occurred between this event and the previous motion event. | |
621 | + * This represents some approximation of the area of the screen being | |
622 | + * pressed; the actual value in pixels corresponding to the | |
623 | + * touch is normalized with the device specific range of values | |
624 | + * and scaled to a value between 0 and 1. The value of size can be used to | |
625 | + * determine fat touch events. */ | |
626 | +float AMotionEvent_getHistoricalSize(AInputEvent* motion_event, size_t pointer_index, | |
627 | + size_t history_index); | |
628 | + | |
629 | +/* Get the historical length of the major axis of an ellipse that describes the touch area | |
630 | + * at the point of contact for the given pointer index that | |
631 | + * occurred between this event and the previous motion event. */ | |
632 | +float AMotionEvent_getHistoricalTouchMajor(const AInputEvent* motion_event, size_t pointer_index, | |
633 | + size_t history_index); | |
634 | + | |
635 | +/* Get the historical length of the minor axis of an ellipse that describes the touch area | |
636 | + * at the point of contact for the given pointer index that | |
637 | + * occurred between this event and the previous motion event. */ | |
638 | +float AMotionEvent_getHistoricalTouchMinor(const AInputEvent* motion_event, size_t pointer_index, | |
639 | + size_t history_index); | |
640 | + | |
641 | +/* Get the historical length of the major axis of an ellipse that describes the size | |
642 | + * of the approaching tool for the given pointer index that | |
643 | + * occurred between this event and the previous motion event. | |
644 | + * The tool area represents the estimated size of the finger or pen that is | |
645 | + * touching the device independent of its actual touch area at the point of contact. */ | |
646 | +float AMotionEvent_getHistoricalToolMajor(const AInputEvent* motion_event, size_t pointer_index, | |
647 | + size_t history_index); | |
648 | + | |
649 | +/* Get the historical length of the minor axis of an ellipse that describes the size | |
650 | + * of the approaching tool for the given pointer index that | |
651 | + * occurred between this event and the previous motion event. | |
652 | + * The tool area represents the estimated size of the finger or pen that is | |
653 | + * touching the device independent of its actual touch area at the point of contact. */ | |
654 | +float AMotionEvent_getHistoricalToolMinor(const AInputEvent* motion_event, size_t pointer_index, | |
655 | + size_t history_index); | |
656 | + | |
657 | +/* Get the historical orientation of the touch area and tool area in radians clockwise from | |
658 | + * vertical for the given pointer index that | |
659 | + * occurred between this event and the previous motion event. | |
660 | + * An angle of 0 degrees indicates that the major axis of contact is oriented | |
661 | + * upwards, is perfectly circular or is of unknown orientation. A positive angle | |
662 | + * indicates that the major axis of contact is oriented to the right. A negative angle | |
663 | + * indicates that the major axis of contact is oriented to the left. | |
664 | + * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians | |
665 | + * (finger pointing fully right). */ | |
666 | +float AMotionEvent_getHistoricalOrientation(const AInputEvent* motion_event, size_t pointer_index, | |
667 | + size_t history_index); | |
668 | + | |
669 | + | |
670 | +/* | |
671 | + * Input queue | |
672 | + * | |
673 | + * An input queue is the facility through which you retrieve input | |
674 | + * events. | |
675 | + */ | |
676 | +struct AInputQueue; | |
677 | +typedef struct AInputQueue AInputQueue; | |
678 | + | |
679 | +/* | |
680 | + * Add this input queue to a looper for processing. See | |
681 | + * ALooper_addFd() for information on the ident, callback, and data params. | |
682 | + */ | |
683 | +void AInputQueue_attachLooper(AInputQueue* queue, ALooper* looper, | |
684 | + int ident, ALooper_callbackFunc callback, void* data); | |
685 | + | |
686 | +/* | |
687 | + * Remove the input queue from the looper it is currently attached to. | |
688 | + */ | |
689 | +void AInputQueue_detachLooper(AInputQueue* queue); | |
690 | + | |
691 | +/* | |
692 | + * Returns true if there are one or more events available in the | |
693 | + * input queue. Returns 1 if the queue has events; 0 if | |
694 | + * it does not have events; and a negative value if there is an error. | |
695 | + */ | |
696 | +int32_t AInputQueue_hasEvents(AInputQueue* queue); | |
697 | + | |
698 | +/* | |
699 | + * Returns the next available event from the queue. Returns a negative | |
700 | + * value if no events are available or an error has occurred. | |
701 | + */ | |
702 | +int32_t AInputQueue_getEvent(AInputQueue* queue, AInputEvent** outEvent); | |
703 | + | |
704 | +/* | |
705 | + * Sends the key for standard pre-dispatching -- that is, possibly deliver | |
706 | + * it to the current IME to be consumed before the app. Returns 0 if it | |
707 | + * was not pre-dispatched, meaning you can process it right now. If non-zero | |
708 | + * is returned, you must abandon the current event processing and allow the | |
709 | + * event to appear again in the event queue (if it does not get consumed during | |
710 | + * pre-dispatching). | |
711 | + */ | |
712 | +int32_t AInputQueue_preDispatchEvent(AInputQueue* queue, AInputEvent* event); | |
713 | + | |
714 | +/* | |
715 | + * Report that dispatching has finished with the given event. | |
716 | + * This must be called after receiving an event with AInputQueue_get_event(). | |
717 | + */ | |
718 | +void AInputQueue_finishEvent(AInputQueue* queue, AInputEvent* event, int handled); | |
719 | + | |
720 | +#ifdef __cplusplus | |
721 | +} | |
722 | +#endif | |
723 | + | |
724 | +#endif // _ANDROID_INPUT_H |
@@ -0,0 +1,243 @@ | ||
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 | + | |
17 | +#ifndef _ANDROID_KEYCODES_H | |
18 | +#define _ANDROID_KEYCODES_H | |
19 | + | |
20 | +/****************************************************************** | |
21 | + * | |
22 | + * IMPORTANT NOTICE: | |
23 | + * | |
24 | + * This file is part of Android's set of stable system headers | |
25 | + * exposed by the Android NDK (Native Development Kit). | |
26 | + * | |
27 | + * Third-party source AND binary code relies on the definitions | |
28 | + * here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES. | |
29 | + * | |
30 | + * - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES) | |
31 | + * - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS | |
32 | + * - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY | |
33 | + * - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES | |
34 | + */ | |
35 | + | |
36 | +#include <sys/types.h> | |
37 | + | |
38 | +#ifdef __cplusplus | |
39 | +extern "C" { | |
40 | +#endif | |
41 | + | |
42 | +/* | |
43 | + * Key codes. | |
44 | + */ | |
45 | +enum { | |
46 | + AKEYCODE_UNKNOWN = 0, | |
47 | + AKEYCODE_SOFT_LEFT = 1, | |
48 | + AKEYCODE_SOFT_RIGHT = 2, | |
49 | + AKEYCODE_HOME = 3, | |
50 | + AKEYCODE_BACK = 4, | |
51 | + AKEYCODE_CALL = 5, | |
52 | + AKEYCODE_ENDCALL = 6, | |
53 | + AKEYCODE_0 = 7, | |
54 | + AKEYCODE_1 = 8, | |
55 | + AKEYCODE_2 = 9, | |
56 | + AKEYCODE_3 = 10, | |
57 | + AKEYCODE_4 = 11, | |
58 | + AKEYCODE_5 = 12, | |
59 | + AKEYCODE_6 = 13, | |
60 | + AKEYCODE_7 = 14, | |
61 | + AKEYCODE_8 = 15, | |
62 | + AKEYCODE_9 = 16, | |
63 | + AKEYCODE_STAR = 17, | |
64 | + AKEYCODE_POUND = 18, | |
65 | + AKEYCODE_DPAD_UP = 19, | |
66 | + AKEYCODE_DPAD_DOWN = 20, | |
67 | + AKEYCODE_DPAD_LEFT = 21, | |
68 | + AKEYCODE_DPAD_RIGHT = 22, | |
69 | + AKEYCODE_DPAD_CENTER = 23, | |
70 | + AKEYCODE_VOLUME_UP = 24, | |
71 | + AKEYCODE_VOLUME_DOWN = 25, | |
72 | + AKEYCODE_POWER = 26, | |
73 | + AKEYCODE_CAMERA = 27, | |
74 | + AKEYCODE_CLEAR = 28, | |
75 | + AKEYCODE_A = 29, | |
76 | + AKEYCODE_B = 30, | |
77 | + AKEYCODE_C = 31, | |
78 | + AKEYCODE_D = 32, | |
79 | + AKEYCODE_E = 33, | |
80 | + AKEYCODE_F = 34, | |
81 | + AKEYCODE_G = 35, | |
82 | + AKEYCODE_H = 36, | |
83 | + AKEYCODE_I = 37, | |
84 | + AKEYCODE_J = 38, | |
85 | + AKEYCODE_K = 39, | |
86 | + AKEYCODE_L = 40, | |
87 | + AKEYCODE_M = 41, | |
88 | + AKEYCODE_N = 42, | |
89 | + AKEYCODE_O = 43, | |
90 | + AKEYCODE_P = 44, | |
91 | + AKEYCODE_Q = 45, | |
92 | + AKEYCODE_R = 46, | |
93 | + AKEYCODE_S = 47, | |
94 | + AKEYCODE_T = 48, | |
95 | + AKEYCODE_U = 49, | |
96 | + AKEYCODE_V = 50, | |
97 | + AKEYCODE_W = 51, | |
98 | + AKEYCODE_X = 52, | |
99 | + AKEYCODE_Y = 53, | |
100 | + AKEYCODE_Z = 54, | |
101 | + AKEYCODE_COMMA = 55, | |
102 | + AKEYCODE_PERIOD = 56, | |
103 | + AKEYCODE_ALT_LEFT = 57, | |
104 | + AKEYCODE_ALT_RIGHT = 58, | |
105 | + AKEYCODE_SHIFT_LEFT = 59, | |
106 | + AKEYCODE_SHIFT_RIGHT = 60, | |
107 | + AKEYCODE_TAB = 61, | |
108 | + AKEYCODE_SPACE = 62, | |
109 | + AKEYCODE_SYM = 63, | |
110 | + AKEYCODE_EXPLORER = 64, | |
111 | + AKEYCODE_ENVELOPE = 65, | |
112 | + AKEYCODE_ENTER = 66, | |
113 | + AKEYCODE_DEL = 67, | |
114 | + AKEYCODE_GRAVE = 68, | |
115 | + AKEYCODE_MINUS = 69, | |
116 | + AKEYCODE_EQUALS = 70, | |
117 | + AKEYCODE_LEFT_BRACKET = 71, | |
118 | + AKEYCODE_RIGHT_BRACKET = 72, | |
119 | + AKEYCODE_BACKSLASH = 73, | |
120 | + AKEYCODE_SEMICOLON = 74, | |
121 | + AKEYCODE_APOSTROPHE = 75, | |
122 | + AKEYCODE_SLASH = 76, | |
123 | + AKEYCODE_AT = 77, | |
124 | + AKEYCODE_NUM = 78, | |
125 | + AKEYCODE_HEADSETHOOK = 79, | |
126 | + AKEYCODE_FOCUS = 80, // *Camera* focus | |
127 | + AKEYCODE_PLUS = 81, | |
128 | + AKEYCODE_MENU = 82, | |
129 | + AKEYCODE_NOTIFICATION = 83, | |
130 | + AKEYCODE_SEARCH = 84, | |
131 | + AKEYCODE_MEDIA_PLAY_PAUSE= 85, | |
132 | + AKEYCODE_MEDIA_STOP = 86, | |
133 | + AKEYCODE_MEDIA_NEXT = 87, | |
134 | + AKEYCODE_MEDIA_PREVIOUS = 88, | |
135 | + AKEYCODE_MEDIA_REWIND = 89, | |
136 | + AKEYCODE_MEDIA_FAST_FORWARD = 90, | |
137 | + AKEYCODE_MUTE = 91, | |
138 | + AKEYCODE_PAGE_UP = 92, | |
139 | + AKEYCODE_PAGE_DOWN = 93, | |
140 | + AKEYCODE_PICTSYMBOLS = 94, | |
141 | + AKEYCODE_SWITCH_CHARSET = 95, | |
142 | + AKEYCODE_BUTTON_A = 96, | |
143 | + AKEYCODE_BUTTON_B = 97, | |
144 | + AKEYCODE_BUTTON_C = 98, | |
145 | + AKEYCODE_BUTTON_X = 99, | |
146 | + AKEYCODE_BUTTON_Y = 100, | |
147 | + AKEYCODE_BUTTON_Z = 101, | |
148 | + AKEYCODE_BUTTON_L1 = 102, | |
149 | + AKEYCODE_BUTTON_R1 = 103, | |
150 | + AKEYCODE_BUTTON_L2 = 104, | |
151 | + AKEYCODE_BUTTON_R2 = 105, | |
152 | + AKEYCODE_BUTTON_THUMBL = 106, | |
153 | + AKEYCODE_BUTTON_THUMBR = 107, | |
154 | + AKEYCODE_BUTTON_START = 108, | |
155 | + AKEYCODE_BUTTON_SELECT = 109, | |
156 | + AKEYCODE_BUTTON_MODE = 110, | |
157 | + AKEYCODE_ESCAPE = 111, | |
158 | + AKEYCODE_FORWARD_DEL = 112, | |
159 | + AKEYCODE_CTRL_LEFT = 113, | |
160 | + AKEYCODE_CTRL_RIGHT = 114, | |
161 | + AKEYCODE_CAPS_LOCK = 115, | |
162 | + AKEYCODE_SCROLL_LOCK = 116, | |
163 | + AKEYCODE_META_LEFT = 117, | |
164 | + AKEYCODE_META_RIGHT = 118, | |
165 | + AKEYCODE_FUNCTION = 119, | |
166 | + AKEYCODE_SYSRQ = 120, | |
167 | + AKEYCODE_BREAK = 121, | |
168 | + AKEYCODE_MOVE_HOME = 122, | |
169 | + AKEYCODE_MOVE_END = 123, | |
170 | + AKEYCODE_INSERT = 124, | |
171 | + AKEYCODE_FORWARD = 125, | |
172 | + AKEYCODE_MEDIA_PLAY = 126, | |
173 | + AKEYCODE_MEDIA_PAUSE = 127, | |
174 | + AKEYCODE_MEDIA_CLOSE = 128, | |
175 | + AKEYCODE_MEDIA_EJECT = 129, | |
176 | + AKEYCODE_MEDIA_RECORD = 130, | |
177 | + AKEYCODE_F1 = 131, | |
178 | + AKEYCODE_F2 = 132, | |
179 | + AKEYCODE_F3 = 133, | |
180 | + AKEYCODE_F4 = 134, | |
181 | + AKEYCODE_F5 = 135, | |
182 | + AKEYCODE_F6 = 136, | |
183 | + AKEYCODE_F7 = 137, | |
184 | + AKEYCODE_F8 = 138, | |
185 | + AKEYCODE_F9 = 139, | |
186 | + AKEYCODE_F10 = 140, | |
187 | + AKEYCODE_F11 = 141, | |
188 | + AKEYCODE_F12 = 142, | |
189 | + AKEYCODE_NUM_LOCK = 143, | |
190 | + AKEYCODE_NUMPAD_0 = 144, | |
191 | + AKEYCODE_NUMPAD_1 = 145, | |
192 | + AKEYCODE_NUMPAD_2 = 146, | |
193 | + AKEYCODE_NUMPAD_3 = 147, | |
194 | + AKEYCODE_NUMPAD_4 = 148, | |
195 | + AKEYCODE_NUMPAD_5 = 149, | |
196 | + AKEYCODE_NUMPAD_6 = 150, | |
197 | + AKEYCODE_NUMPAD_7 = 151, | |
198 | + AKEYCODE_NUMPAD_8 = 152, | |
199 | + AKEYCODE_NUMPAD_9 = 153, | |
200 | + AKEYCODE_NUMPAD_DIVIDE = 154, | |
201 | + AKEYCODE_NUMPAD_MULTIPLY = 155, | |
202 | + AKEYCODE_NUMPAD_SUBTRACT = 156, | |
203 | + AKEYCODE_NUMPAD_ADD = 157, | |
204 | + AKEYCODE_NUMPAD_DOT = 158, | |
205 | + AKEYCODE_NUMPAD_COMMA = 159, | |
206 | + AKEYCODE_NUMPAD_ENTER = 160, | |
207 | + AKEYCODE_NUMPAD_EQUALS = 161, | |
208 | + AKEYCODE_NUMPAD_LEFT_PAREN = 162, | |
209 | + AKEYCODE_NUMPAD_RIGHT_PAREN = 163, | |
210 | + AKEYCODE_VOLUME_MUTE = 164, | |
211 | + AKEYCODE_INFO = 165, | |
212 | + AKEYCODE_CHANNEL_UP = 166, | |
213 | + AKEYCODE_CHANNEL_DOWN = 167, | |
214 | + AKEYCODE_ZOOM_IN = 168, | |
215 | + AKEYCODE_ZOOM_OUT = 169, | |
216 | + AKEYCODE_TV = 170, | |
217 | + AKEYCODE_WINDOW = 171, | |
218 | + AKEYCODE_GUIDE = 172, | |
219 | + AKEYCODE_DVR = 173, | |
220 | + AKEYCODE_BOOKMARK = 174, | |
221 | + AKEYCODE_CAPTIONS = 175, | |
222 | + AKEYCODE_SETTINGS = 176, | |
223 | + AKEYCODE_TV_POWER = 177, | |
224 | + AKEYCODE_TV_INPUT = 178, | |
225 | + AKEYCODE_STB_POWER = 179, | |
226 | + AKEYCODE_STB_INPUT = 180, | |
227 | + AKEYCODE_AVR_POWER = 181, | |
228 | + AKEYCODE_AVR_INPUT = 182, | |
229 | + AKEYCODE_PROG_RED = 183, | |
230 | + AKEYCODE_PROG_GREEN = 184, | |
231 | + AKEYCODE_PROG_YELLOW = 185, | |
232 | + AKEYCODE_PROG_BLUE = 186, | |
233 | + AKEYCODE_APP_SWITCH = 187, | |
234 | + | |
235 | + // NOTE: If you add a new keycode here you must also add it to several other files. | |
236 | + // Refer to frameworks/base/core/java/android/view/KeyEvent.java for the full list. | |
237 | +}; | |
238 | + | |
239 | +#ifdef __cplusplus | |
240 | +} | |
241 | +#endif | |
242 | + | |
243 | +#endif // _ANDROID_KEYCODES_H |
@@ -0,0 +1,303 @@ | ||
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 | + | |
17 | + | |
18 | +#ifndef ANDROID_NATIVE_ACTIVITY_H | |
19 | +#define ANDROID_NATIVE_ACTIVITY_H | |
20 | + | |
21 | +#include <stdint.h> | |
22 | +#include <sys/types.h> | |
23 | + | |
24 | +#include <jni.h> | |
25 | + | |
26 | +#include <android/asset_manager.h> | |
27 | +#include <android/input.h> | |
28 | +#include <android/native_window.h> | |
29 | + | |
30 | +#ifdef __cplusplus | |
31 | +extern "C" { | |
32 | +#endif | |
33 | + | |
34 | +struct ANativeActivityCallbacks; | |
35 | + | |
36 | +/** | |
37 | + * This structure defines the native side of an android.app.NativeActivity. | |
38 | + * It is created by the framework, and handed to the application's native | |
39 | + * code as it is being launched. | |
40 | + */ | |
41 | +typedef struct ANativeActivity { | |
42 | + /** | |
43 | + * Pointer to the callback function table of the native application. | |
44 | + * You can set the functions here to your own callbacks. The callbacks | |
45 | + * pointer itself here should not be changed; it is allocated and managed | |
46 | + * for you by the framework. | |
47 | + */ | |
48 | + struct ANativeActivityCallbacks* callbacks; | |
49 | + | |
50 | + /** | |
51 | + * The global handle on the process's Java VM. | |
52 | + */ | |
53 | + JavaVM* vm; | |
54 | + | |
55 | + /** | |
56 | + * JNI context for the main thread of the app. Note that this field | |
57 | + * can ONLY be used from the main thread of the process; that is, the | |
58 | + * thread that calls into the ANativeActivityCallbacks. | |
59 | + */ | |
60 | + JNIEnv* env; | |
61 | + | |
62 | + /** | |
63 | + * The NativeActivity Java class. | |
64 | + */ | |
65 | + jobject clazz; | |
66 | + | |
67 | + /** | |
68 | + * Path to this application's internal data directory. | |
69 | + */ | |
70 | + const char* internalDataPath; | |
71 | + | |
72 | + /** | |
73 | + * Path to this application's external (removable/mountable) data directory. | |
74 | + */ | |
75 | + const char* externalDataPath; | |
76 | + | |
77 | + /** | |
78 | + * The platform's SDK version code. | |
79 | + */ | |
80 | + int32_t sdkVersion; | |
81 | + | |
82 | + /** | |
83 | + * This is the native instance of the application. It is not used by | |
84 | + * the framework, but can be set by the application to its own instance | |
85 | + * state. | |
86 | + */ | |
87 | + void* instance; | |
88 | + | |
89 | + /** | |
90 | + * Pointer to the Asset Manager instance for the application. The application | |
91 | + * uses this to access binary assets bundled inside its own .apk file. | |
92 | + */ | |
93 | + AAssetManager* assetManager; | |
94 | + | |
95 | + /** | |
96 | + * Available starting with Honeycomb: path to the directory containing | |
97 | + * the application's OBB files (if any). If the app doesn't have any | |
98 | + * OBB files, this directory may not exist. | |
99 | + */ | |
100 | + const char* obbPath; | |
101 | +} ANativeActivity; | |
102 | + | |
103 | +/** | |
104 | + * These are the callbacks the framework makes into a native application. | |
105 | + * All of these callbacks happen on the main thread of the application. | |
106 | + * By default, all callbacks are NULL; set to a pointer to your own function | |
107 | + * to have it called. | |
108 | + */ | |
109 | +typedef struct ANativeActivityCallbacks { | |
110 | + /** | |
111 | + * NativeActivity has started. See Java documentation for Activity.onStart() | |
112 | + * for more information. | |
113 | + */ | |
114 | + void (*onStart)(ANativeActivity* activity); | |
115 | + | |
116 | + /** | |
117 | + * NativeActivity has resumed. See Java documentation for Activity.onResume() | |
118 | + * for more information. | |
119 | + */ | |
120 | + void (*onResume)(ANativeActivity* activity); | |
121 | + | |
122 | + /** | |
123 | + * Framework is asking NativeActivity to save its current instance state. | |
124 | + * See Java documentation for Activity.onSaveInstanceState() for more | |
125 | + * information. The returned pointer needs to be created with malloc(); | |
126 | + * the framework will call free() on it for you. You also must fill in | |
127 | + * outSize with the number of bytes in the allocation. Note that the | |
128 | + * saved state will be persisted, so it can not contain any active | |
129 | + * entities (pointers to memory, file descriptors, etc). | |
130 | + */ | |
131 | + void* (*onSaveInstanceState)(ANativeActivity* activity, size_t* outSize); | |
132 | + | |
133 | + /** | |
134 | + * NativeActivity has paused. See Java documentation for Activity.onPause() | |
135 | + * for more information. | |
136 | + */ | |
137 | + void (*onPause)(ANativeActivity* activity); | |
138 | + | |
139 | + /** | |
140 | + * NativeActivity has stopped. See Java documentation for Activity.onStop() | |
141 | + * for more information. | |
142 | + */ | |
143 | + void (*onStop)(ANativeActivity* activity); | |
144 | + | |
145 | + /** | |
146 | + * NativeActivity is being destroyed. See Java documentation for Activity.onDestroy() | |
147 | + * for more information. | |
148 | + */ | |
149 | + void (*onDestroy)(ANativeActivity* activity); | |
150 | + | |
151 | + /** | |
152 | + * Focus has changed in this NativeActivity's window. This is often used, | |
153 | + * for example, to pause a game when it loses input focus. | |
154 | + */ | |
155 | + void (*onWindowFocusChanged)(ANativeActivity* activity, int hasFocus); | |
156 | + | |
157 | + /** | |
158 | + * The drawing window for this native activity has been created. You | |
159 | + * can use the given native window object to start drawing. | |
160 | + */ | |
161 | + void (*onNativeWindowCreated)(ANativeActivity* activity, ANativeWindow* window); | |
162 | + | |
163 | + /** | |
164 | + * The drawing window for this native activity has been resized. You should | |
165 | + * retrieve the new size from the window and ensure that your rendering in | |
166 | + * it now matches. | |
167 | + */ | |
168 | + void (*onNativeWindowResized)(ANativeActivity* activity, ANativeWindow* window); | |
169 | + | |
170 | + /** | |
171 | + * The drawing window for this native activity needs to be redrawn. To avoid | |
172 | + * transient artifacts during screen changes (such resizing after rotation), | |
173 | + * applications should not return from this function until they have finished | |
174 | + * drawing their window in its current state. | |
175 | + */ | |
176 | + void (*onNativeWindowRedrawNeeded)(ANativeActivity* activity, ANativeWindow* window); | |
177 | + | |
178 | + /** | |
179 | + * The drawing window for this native activity is going to be destroyed. | |
180 | + * You MUST ensure that you do not touch the window object after returning | |
181 | + * from this function: in the common case of drawing to the window from | |
182 | + * another thread, that means the implementation of this callback must | |
183 | + * properly synchronize with the other thread to stop its drawing before | |
184 | + * returning from here. | |
185 | + */ | |
186 | + void (*onNativeWindowDestroyed)(ANativeActivity* activity, ANativeWindow* window); | |
187 | + | |
188 | + /** | |
189 | + * The input queue for this native activity's window has been created. | |
190 | + * You can use the given input queue to start retrieving input events. | |
191 | + */ | |
192 | + void (*onInputQueueCreated)(ANativeActivity* activity, AInputQueue* queue); | |
193 | + | |
194 | + /** | |
195 | + * The input queue for this native activity's window is being destroyed. | |
196 | + * You should no longer try to reference this object upon returning from this | |
197 | + * function. | |
198 | + */ | |
199 | + void (*onInputQueueDestroyed)(ANativeActivity* activity, AInputQueue* queue); | |
200 | + | |
201 | + /** | |
202 | + * The rectangle in the window in which content should be placed has changed. | |
203 | + */ | |
204 | + void (*onContentRectChanged)(ANativeActivity* activity, const ARect* rect); | |
205 | + | |
206 | + /** | |
207 | + * The current device AConfiguration has changed. The new configuration can | |
208 | + * be retrieved from assetManager. | |
209 | + */ | |
210 | + void (*onConfigurationChanged)(ANativeActivity* activity); | |
211 | + | |
212 | + /** | |
213 | + * The system is running low on memory. Use this callback to release | |
214 | + * resources you do not need, to help the system avoid killing more | |
215 | + * important processes. | |
216 | + */ | |
217 | + void (*onLowMemory)(ANativeActivity* activity); | |
218 | +} ANativeActivityCallbacks; | |
219 | + | |
220 | +/** | |
221 | + * This is the function that must be in the native code to instantiate the | |
222 | + * application's native activity. It is called with the activity instance (see | |
223 | + * above); if the code is being instantiated from a previously saved instance, | |
224 | + * the savedState will be non-NULL and point to the saved data. You must make | |
225 | + * any copy of this data you need -- it will be released after you return from | |
226 | + * this function. | |
227 | + */ | |
228 | +typedef void ANativeActivity_createFunc(ANativeActivity* activity, | |
229 | + void* savedState, size_t savedStateSize); | |
230 | + | |
231 | +/** | |
232 | + * The name of the function that NativeInstance looks for when launching its | |
233 | + * native code. This is the default function that is used, you can specify | |
234 | + * "android.app.func_name" string meta-data in your manifest to use a different | |
235 | + * function. | |
236 | + */ | |
237 | +extern ANativeActivity_createFunc ANativeActivity_onCreate; | |
238 | + | |
239 | +/** | |
240 | + * Finish the given activity. Its finish() method will be called, causing it | |
241 | + * to be stopped and destroyed. Note that this method can be called from | |
242 | + * *any* thread; it will send a message to the main thread of the process | |
243 | + * where the Java finish call will take place. | |
244 | + */ | |
245 | +void ANativeActivity_finish(ANativeActivity* activity); | |
246 | + | |
247 | +/** | |
248 | + * Change the window format of the given activity. Calls getWindow().setFormat() | |
249 | + * of the given activity. Note that this method can be called from | |
250 | + * *any* thread; it will send a message to the main thread of the process | |
251 | + * where the Java finish call will take place. | |
252 | + */ | |
253 | +void ANativeActivity_setWindowFormat(ANativeActivity* activity, int32_t format); | |
254 | + | |
255 | +/** | |
256 | + * Change the window flags of the given activity. Calls getWindow().setFlags() | |
257 | + * of the given activity. Note that this method can be called from | |
258 | + * *any* thread; it will send a message to the main thread of the process | |
259 | + * where the Java finish call will take place. See window.h for flag constants. | |
260 | + */ | |
261 | +void ANativeActivity_setWindowFlags(ANativeActivity* activity, | |
262 | + uint32_t addFlags, uint32_t removeFlags); | |
263 | + | |
264 | +/** | |
265 | + * Flags for ANativeActivity_showSoftInput; see the Java InputMethodManager | |
266 | + * API for documentation. | |
267 | + */ | |
268 | +enum { | |
269 | + ANATIVEACTIVITY_SHOW_SOFT_INPUT_IMPLICIT = 0x0001, | |
270 | + ANATIVEACTIVITY_SHOW_SOFT_INPUT_FORCED = 0x0002, | |
271 | +}; | |
272 | + | |
273 | +/** | |
274 | + * Show the IME while in the given activity. Calls InputMethodManager.showSoftInput() | |
275 | + * for the given activity. Note that this method can be called from | |
276 | + * *any* thread; it will send a message to the main thread of the process | |
277 | + * where the Java finish call will take place. | |
278 | + */ | |
279 | +void ANativeActivity_showSoftInput(ANativeActivity* activity, uint32_t flags); | |
280 | + | |
281 | +/** | |
282 | + * Flags for ANativeActivity_hideSoftInput; see the Java InputMethodManager | |
283 | + * API for documentation. | |
284 | + */ | |
285 | +enum { | |
286 | + ANATIVEACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY = 0x0001, | |
287 | + ANATIVEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS = 0x0002, | |
288 | +}; | |
289 | + | |
290 | +/** | |
291 | + * Hide the IME while in the given activity. Calls InputMethodManager.hideSoftInput() | |
292 | + * for the given activity. Note that this method can be called from | |
293 | + * *any* thread; it will send a message to the main thread of the process | |
294 | + * where the Java finish call will take place. | |
295 | + */ | |
296 | +void ANativeActivity_hideSoftInput(ANativeActivity* activity, uint32_t flags); | |
297 | + | |
298 | +#ifdef __cplusplus | |
299 | +}; | |
300 | +#endif | |
301 | + | |
302 | +#endif // ANDROID_NATIVE_ACTIVITY_H | |
303 | + |