From e551875b2d82ed2709a28e046759523cb87ba2e2 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Thu, 15 Jul 2010 17:48:05 -0700 Subject: [PATCH] Update NDK for pre-key-dispatching changes. The same code now calls the appropriate function as part of its key processing. Change-Id: Ie6fbcd802b098b85d8113fe0a49473134721009b --- .../usr/include/android/asset_manager.h | 148 ++++++++++ .../arch-arm/usr/include/android/input.h | 260 +++++++++++------- .../usr/include/android/native_activity.h | 2 +- .../arch-arm/usr/include/android/sensor.h | 235 ++++++++++++++++ .../android-9/arch-arm/usr/lib/libandroid.so | Bin 9556 -> 17940 bytes ndk/samples/native-activity/jni/main.c | 3 + ndk/samples/native-plasma/jni/plasma.c | 3 + 7 files changed, 552 insertions(+), 99 deletions(-) create mode 100644 ndk/platforms/android-9/arch-arm/usr/include/android/asset_manager.h create mode 100644 ndk/platforms/android-9/arch-arm/usr/include/android/sensor.h diff --git a/ndk/platforms/android-9/arch-arm/usr/include/android/asset_manager.h b/ndk/platforms/android-9/arch-arm/usr/include/android/asset_manager.h new file mode 100644 index 000000000..89989f8cc --- /dev/null +++ b/ndk/platforms/android-9/arch-arm/usr/include/android/asset_manager.h @@ -0,0 +1,148 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef ANDROID_ASSET_MANAGER_H +#define ANDROID_ASSET_MANAGER_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct AAssetManager; +typedef struct AAssetManager AAssetManager; + +struct AAssetDir; +typedef struct AAssetDir AAssetDir; + +struct AAsset; +typedef struct AAsset AAsset; + +/* Available modes for opening assets */ +enum { + AASSET_MODE_UNKNOWN = 0, + AASSET_MODE_RANDOM = 1, + AASSET_MODE_STREAMING = 2, + AASSET_MODE_BUFFER = 3 +}; + + +/** + * Given a Dalvik AssetManager object, obtain the corresponding native AAssetManager + * object. Note that the caller is responsible for obtaining and holding a VM reference + * to the jobject to prevent its being garbage collected while the native object is + * in use. + */ +AAssetManager* AAssetManager_fromJava(JNIEnv* env, jobject assetManager); + +/** + * Open the named directory within the asset hierarchy. The directory can then + * be inspected with the AAssetDir functions. To open the top-level directory, + * pass in "" as the dirName. + * + * The object returned here should be freed by calling AAssetDir_close(). + */ +AAssetDir* AAssetManager_openDir(AAssetManager* mgr, const char* dirName); + +/** + * Open an asset. + * + * The object returned here should be freed by calling AAsset_close(). + */ +AAsset* AAssetManager_open(AAssetManager* mgr, const char* filename, int mode); + +/** + * Iterate over the files in an asset directory. A NULL string is returned + * when all the file names have been returned. + * + * The returned file name is suitable for passing to AAssetManager_open(). + * + * The string returned here is owned by the AssetDir implementation and is not + * guaranteed to remain valid if any other calls are made on this AAssetDir + * instance. + */ +const char* AAssetDir_getNextFileName(AAssetDir* assetDir); + +/** + * Reset the iteration state of AAssetDir_getNextFileName() to the beginning. + */ +void AAssetDir_rewind(AAssetDir* assetDir); + +/** + * Close an opened AAssetDir, freeing any related resources. + */ +void AAssetDir_close(AAssetDir* assetDir); + +/** + * Attempt to read 'count' bytes of data from the current offset. + * + * Returns the number of bytes read, zero on EOF, or < 0 on error. + */ +int AAsset_read(AAsset* asset, void* buf, size_t count); + +/** + * Seek to the specified offset within the asset data. 'whence' uses the + * same constants as lseek()/fseek(). + * + * Returns the new position on success, or (off_t) -1 on error. + */ +off_t AAsset_seek(AAsset* asset, off_t offset, int whence); + +/** + * Close the asset, freeing all associated resources. + */ +void AAsset_close(AAsset* asset); + +/** + * Get a pointer to a buffer holding the entire contents of the assset. + * + * Returns NULL on failure. + */ +const void* AAsset_getBuffer(AAsset* asset); + +/** + * Report the total size of the asset data. + */ +off_t AAsset_getLength(AAsset* asset); + +/** + * Report the total amount of asset data that can be read from the current position. + */ +off_t AAsset_getRemainingLength(AAsset* asset); + +/** + * Open a new file descriptor that can be used to read the asset data. + * + * Returns < 0 if direct fd access is not possible (for example, if the asset is + * compressed). + */ +int AAsset_openFileDescriptor(AAsset* asset, off_t* outStart, off_t* outLength); + +/** + * Returns whether this asset's internal buffer is allocated in ordinary RAM (i.e. not + * mmapped). + */ +int AAsset_isAllocated(AAsset* asset); + + + +#ifdef __cplusplus +}; +#endif + +#endif // ANDROID_ASSET_MANAGER_H diff --git a/ndk/platforms/android-9/arch-arm/usr/include/android/input.h b/ndk/platforms/android-9/arch-arm/usr/include/android/input.h index 25dd68ef7..0b8c7e49d 100644 --- a/ndk/platforms/android-9/arch-arm/usr/include/android/input.h +++ b/ndk/platforms/android-9/arch-arm/usr/include/android/input.h @@ -48,50 +48,22 @@ extern "C" { #endif -/* - * Input device classes. - */ -enum { - /* The input device is a keyboard. */ - INPUT_DEVICE_CLASS_KEYBOARD = 0x00000001, - - /* The input device is an alpha-numeric keyboard (not just a dial pad). */ - INPUT_DEVICE_CLASS_ALPHAKEY = 0x00000002, - - /* The input device is a touchscreen (either single-touch or multi-touch). */ - INPUT_DEVICE_CLASS_TOUCHSCREEN = 0x00000004, - - /* The input device is a trackball. */ - INPUT_DEVICE_CLASS_TRACKBALL = 0x00000008, - - /* The input device is a multi-touch touchscreen. */ - INPUT_DEVICE_CLASS_TOUCHSCREEN_MT= 0x00000010, - - /* The input device is a directional pad. */ - INPUT_DEVICE_CLASS_DPAD = 0x00000020, - - /* The input device is a gamepad (implies keyboard). */ - INPUT_DEVICE_CLASS_GAMEPAD = 0x00000040 -}; - /* * Key states (may be returned by queries about the current state of a * particular key code, scan code or switch). - * - * XXX should we call this BUTTON_STATE_XXX? */ enum { /* The key state is unknown or the requested key itself is not supported. */ - KEY_STATE_UNKNOWN = -1, + AKEY_STATE_UNKNOWN = -1, /* The key is up. */ - KEY_STATE_UP = 0, + AKEY_STATE_UP = 0, /* The key is down. */ - KEY_STATE_DOWN = 1, + AKEY_STATE_DOWN = 1, /* The key is down but is a virtual key press that is being emulated by the system. */ - KEY_STATE_VIRTUAL = 2 + AKEY_STATE_VIRTUAL = 2 }; /* @@ -99,28 +71,28 @@ enum { */ enum { /* No meta keys are pressed. */ - META_NONE = 0, + AMETA_NONE = 0, /* This mask is used to check whether one of the ALT meta keys is pressed. */ - META_ALT_ON = 0x02, + AMETA_ALT_ON = 0x02, /* This mask is used to check whether the left ALT meta key is pressed. */ - META_ALT_LEFT_ON = 0x10, + AMETA_ALT_LEFT_ON = 0x10, /* This mask is used to check whether the right ALT meta key is pressed. */ - META_ALT_RIGHT_ON = 0x20, + AMETA_ALT_RIGHT_ON = 0x20, /* This mask is used to check whether one of the SHIFT meta keys is pressed. */ - META_SHIFT_ON = 0x01, + AMETA_SHIFT_ON = 0x01, /* This mask is used to check whether the left SHIFT meta key is pressed. */ - META_SHIFT_LEFT_ON = 0x40, + AMETA_SHIFT_LEFT_ON = 0x40, /* This mask is used to check whether the right SHIFT meta key is pressed. */ - META_SHIFT_RIGHT_ON = 0x80, + AMETA_SHIFT_RIGHT_ON = 0x80, /* This mask is used to check whether the SYM meta key is pressed. */ - META_SYM_ON = 0x04 + AMETA_SYM_ON = 0x04 }; /* @@ -137,10 +109,10 @@ typedef struct AInputEvent AInputEvent; */ enum { /* Indicates that the input event is a key event. */ - INPUT_EVENT_TYPE_KEY = 1, + AINPUT_EVENT_TYPE_KEY = 1, /* Indicates that the input event is a motion event. */ - INPUT_EVENT_TYPE_MOTION = 2 + AINPUT_EVENT_TYPE_MOTION = 2 }; /* @@ -148,16 +120,16 @@ enum { */ enum { /* The key has been pressed down. */ - KEY_EVENT_ACTION_DOWN = 0, + AKEY_EVENT_ACTION_DOWN = 0, /* The key has been released. */ - KEY_EVENT_ACTION_UP = 1, + AKEY_EVENT_ACTION_UP = 1, /* Multiple duplicate key events have occurred in a row, or a complex string is * being delivered. The repeat_count property of the key event contains the number * of times the given key code should be executed. */ - KEY_EVENT_ACTION_MULTIPLE = 2 + AKEY_EVENT_ACTION_MULTIPLE = 2 }; /* @@ -165,25 +137,25 @@ enum { */ enum { /* This mask is set if the device woke because of this key event. */ - KEY_EVENT_FLAG_WOKE_HERE = 0x1, + AKEY_EVENT_FLAG_WOKE_HERE = 0x1, /* This mask is set if the key event was generated by a software keyboard. */ - KEY_EVENT_FLAG_SOFT_KEYBOARD = 0x2, + AKEY_EVENT_FLAG_SOFT_KEYBOARD = 0x2, /* This mask is set if we don't want the key event to cause us to leave touch mode. */ - KEY_EVENT_FLAG_KEEP_TOUCH_MODE = 0x4, + AKEY_EVENT_FLAG_KEEP_TOUCH_MODE = 0x4, /* This mask is set if an event was known to come from a trusted part * of the system. That is, the event is known to come from the user, * and could not have been spoofed by a third party component. */ - KEY_EVENT_FLAG_FROM_SYSTEM = 0x8, + AKEY_EVENT_FLAG_FROM_SYSTEM = 0x8, /* This mask is used for compatibility, to identify enter keys that are * coming from an IME whose enter key has been auto-labelled "next" or * "done". This allows TextView to dispatch these as normal enter keys * for old applications, but still do the appropriate action when * receiving them. */ - KEY_EVENT_FLAG_EDITOR_ACTION = 0x10, + AKEY_EVENT_FLAG_EDITOR_ACTION = 0x10, /* When associated with up key events, this indicates that the key press * has been canceled. Typically this is used with virtual touch screen @@ -193,26 +165,26 @@ enum { * key. Note that for this to work, the application can not perform an * action for a key until it receives an up or the long press timeout has * expired. */ - KEY_EVENT_FLAG_CANCELED = 0x20, + AKEY_EVENT_FLAG_CANCELED = 0x20, /* This key event was generated by a virtual (on-screen) hard key area. * Typically this is an area of the touchscreen, outside of the regular * display, dedicated to "hardware" buttons. */ - KEY_EVENT_FLAG_VIRTUAL_HARD_KEY = 0x40, + AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY = 0x40, /* This flag is set for the first key repeat that occurs after the * long press timeout. */ - KEY_EVENT_FLAG_LONG_PRESS = 0x80, + AKEY_EVENT_FLAG_LONG_PRESS = 0x80, - /* Set when a key event has KEY_EVENT_FLAG_CANCELED set because a long + /* Set when a key event has AKEY_EVENT_FLAG_CANCELED set because a long * press action was executed while it was down. */ - KEY_EVENT_FLAG_CANCELED_LONG_PRESS = 0x100, + AKEY_EVENT_FLAG_CANCELED_LONG_PRESS = 0x100, - /* Set for KEY_EVENT_ACTION_UP when this event's key code is still being + /* Set for AKEY_EVENT_ACTION_UP when this event's key code is still being * tracked from its initial down. That is, somebody requested that tracking * started on the key down and a long press has not caused * the tracking to be canceled. */ - KEY_EVENT_FLAG_TRACKING = 0x200 + AKEY_EVENT_FLAG_TRACKING = 0x200 }; /* @@ -220,57 +192,57 @@ enum { */ /* Bit shift for the action bits holding the pointer index as - * defined by MOTION_EVENT_ACTION_POINTER_INDEX_MASK. + * defined by AMOTION_EVENT_ACTION_POINTER_INDEX_MASK. */ -#define MOTION_EVENT_ACTION_POINTER_INDEX_SHIFT 8 +#define AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT 8 enum { /* Bit mask of the parts of the action code that are the action itself. */ - MOTION_EVENT_ACTION_MASK = 0xff, + AMOTION_EVENT_ACTION_MASK = 0xff, /* Bits in the action code that represent a pointer index, used with - * MOTION_EVENT_ACTION_POINTER_DOWN and MOTION_EVENT_ACTION_POINTER_UP. Shifting - * down by MOTION_EVENT_ACTION_POINTER_INDEX_SHIFT provides the actual pointer + * AMOTION_EVENT_ACTION_POINTER_DOWN and AMOTION_EVENT_ACTION_POINTER_UP. Shifting + * down by AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT provides the actual pointer * index where the data for the pointer going up or down can be found. */ - MOTION_EVENT_ACTION_POINTER_INDEX_MASK = 0xff00, + AMOTION_EVENT_ACTION_POINTER_INDEX_MASK = 0xff00, /* A pressed gesture has started, the motion contains the initial starting location. */ - MOTION_EVENT_ACTION_DOWN = 0, + AMOTION_EVENT_ACTION_DOWN = 0, /* A pressed gesture has finished, the motion contains the final release location * as well as any intermediate points since the last down or move event. */ - MOTION_EVENT_ACTION_UP = 1, + AMOTION_EVENT_ACTION_UP = 1, - /* A change has happened during a press gesture (between MOTION_EVENT_ACTION_DOWN and - * MOTION_EVENT_ACTION_UP). The motion contains the most recent point, as well as + /* A change has happened during a press gesture (between AMOTION_EVENT_ACTION_DOWN and + * AMOTION_EVENT_ACTION_UP). The motion contains the most recent point, as well as * any intermediate points since the last down or move event. */ - MOTION_EVENT_ACTION_MOVE = 2, + AMOTION_EVENT_ACTION_MOVE = 2, /* The current gesture has been aborted. * You will not receive any more points in it. You should treat this as * an up event, but not perform any action that you normally would. */ - MOTION_EVENT_ACTION_CANCEL = 3, + AMOTION_EVENT_ACTION_CANCEL = 3, /* A movement has happened outside of the normal bounds of the UI element. * This does not provide a full gesture, but only the initial location of the movement/touch. */ - MOTION_EVENT_ACTION_OUTSIDE = 4, + AMOTION_EVENT_ACTION_OUTSIDE = 4, /* A non-primary pointer has gone down. - * The bits in MOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed. + * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed. */ - MOTION_EVENT_ACTION_POINTER_DOWN = 5, + AMOTION_EVENT_ACTION_POINTER_DOWN = 5, /* A non-primary pointer has gone up. - * The bits in MOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed. + * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed. */ - MOTION_EVENT_ACTION_POINTER_UP = 6 + AMOTION_EVENT_ACTION_POINTER_UP = 6 }; /* @@ -278,39 +250,50 @@ enum { */ enum { /* No edges intersected */ - MOTION_EVENT_EDGE_FLAG_NONE = 0, + AMOTION_EVENT_EDGE_FLAG_NONE = 0, /* Flag indicating the motion event intersected the top edge of the screen. */ - MOTION_EVENT_EDGE_FLAG_TOP = 0x01, + AMOTION_EVENT_EDGE_FLAG_TOP = 0x01, /* Flag indicating the motion event intersected the bottom edge of the screen. */ - MOTION_EVENT_EDGE_FLAG_BOTTOM = 0x02, + AMOTION_EVENT_EDGE_FLAG_BOTTOM = 0x02, /* Flag indicating the motion event intersected the left edge of the screen. */ - MOTION_EVENT_EDGE_FLAG_LEFT = 0x04, + AMOTION_EVENT_EDGE_FLAG_LEFT = 0x04, /* Flag indicating the motion event intersected the right edge of the screen. */ - MOTION_EVENT_EDGE_FLAG_RIGHT = 0x08 + AMOTION_EVENT_EDGE_FLAG_RIGHT = 0x08 }; /* - * Specifies the logical nature of an input event. - * For example, the nature distinguishes between motion events that represent touches and - * those that represent trackball moves. + * Input sources. * - * XXX This concept is tentative. Another idea would be to associate events with logical - * controllers rather than physical devices. The interpretation of an event would - * be made with respect to the nature of the controller that is considered the logical - * source of an event. The decoupling is beneficial since multiple physical (and virtual) - * devices could be responsible for producing events that would be associated with - * various logical controllers. For example, the hard keyboard, on screen keyboard, - * and peripheral keyboard could be mapped onto a single logical "keyboard" controller - * (or treated independently, if desired). + * The appropriate interpretation for an input event depends on its source. + * Refer to the documentation on android.view.InputDevice for more details about input sources + * and their correct interpretation. */ enum { - INPUT_EVENT_NATURE_KEY = 1, - INPUT_EVENT_NATURE_TOUCH = 2, - INPUT_EVENT_NATURE_TRACKBALL = 3 + AINPUT_SOURCE_CLASS_MASK = 0x000000ff, + + AINPUT_SOURCE_CLASS_BUTTON = 0x00000001, + AINPUT_SOURCE_CLASS_POINTER = 0x00000002, + AINPUT_SOURCE_CLASS_NAVIGATION = 0x00000004, + AINPUT_SOURCE_CLASS_POSITION = 0x00000008, + AINPUT_SOURCE_CLASS_JOYSTICK = 0x00000010, +}; + +enum { + AINPUT_SOURCE_UNKNOWN = 0x00000000, + + AINPUT_SOURCE_KEYBOARD = 0x00000100 | AINPUT_SOURCE_CLASS_BUTTON, + AINPUT_SOURCE_DPAD = 0x00000200 | AINPUT_SOURCE_CLASS_BUTTON, + AINPUT_SOURCE_GAMEPAD = 0x00000400 | AINPUT_SOURCE_CLASS_BUTTON, + AINPUT_SOURCE_TOUCHSCREEN = 0x00001000 | AINPUT_SOURCE_CLASS_POINTER, + AINPUT_SOURCE_MOUSE = 0x00002000 | AINPUT_SOURCE_CLASS_POINTER, + AINPUT_SOURCE_TRACKBALL = 0x00010000 | AINPUT_SOURCE_CLASS_NAVIGATION, + AINPUT_SOURCE_TOUCHPAD = 0x00100000 | AINPUT_SOURCE_CLASS_POSITION, + AINPUT_SOURCE_JOYSTICK_LEFT = 0x01000000 | AINPUT_SOURCE_CLASS_JOYSTICK, + AINPUT_SOURCE_JOYSTICK_RIGHT = 0x02000000 | AINPUT_SOURCE_CLASS_JOYSTICK, }; /* @@ -337,8 +320,8 @@ int32_t AInputEvent_getType(const AInputEvent* event); */ int32_t AInputEvent_getDeviceId(const AInputEvent* event); -/* Get the input event nature. */ -int32_t AInputEvent_getNature(const AInputEvent* event); +/* Get the input event source. */ +int32_t AInputEvent_getSource(const AInputEvent* event); /*** Accessors for key events only. ***/ @@ -466,11 +449,41 @@ float AMotionEvent_getPressure(const AInputEvent* motion_event, size_t pointer_i * determine fat touch events. */ float AMotionEvent_getSize(const AInputEvent* motion_event, size_t pointer_index); +/* Get the current length of the major axis of an ellipse that describes the touch area + * at the point of contact for the given pointer index. */ +float AMotionEvent_getTouchMajor(const AInputEvent* motion_event, size_t pointer_index); + +/* Get the current length of the minor axis of an ellipse that describes the touch area + * at the point of contact for the given pointer index. */ +float AMotionEvent_getTouchMinor(const AInputEvent* motion_event, size_t pointer_index); + +/* Get the current length of the major axis of an ellipse that describes the size + * of the approaching tool for the given pointer index. + * The tool area represents the estimated size of the finger or pen that is + * touching the device independent of its actual touch area at the point of contact. */ +float AMotionEvent_getToolMajor(const AInputEvent* motion_event, size_t pointer_index); + +/* Get the current length of the minor axis of an ellipse that describes the size + * of the approaching tool for the given pointer index. + * The tool area represents the estimated size of the finger or pen that is + * touching the device independent of its actual touch area at the point of contact. */ +float AMotionEvent_getToolMinor(const AInputEvent* motion_event, size_t pointer_index); + +/* Get the current orientation of the touch area and tool area in radians clockwise from + * vertical for the given pointer index. + * An angle of 0 degrees indicates that the major axis of contact is oriented + * upwards, is perfectly circular or is of unknown orientation. A positive angle + * indicates that the major axis of contact is oriented to the right. A negative angle + * indicates that the major axis of contact is oriented to the left. + * The full range is from -PI/4 radians (finger pointing fully left) to PI/4 radians + * (finger pointing fully right). */ +float AMotionEvent_getOrientation(const AInputEvent* motion_event, size_t pointer_index); + /* Get the number of historical points in this event. These are movements that * have occurred between this event and the previous event. This only applies - * to MOTION_EVENT_ACTION_MOVE events -- all other actions will have a size of 0. + * to AMOTION_EVENT_ACTION_MOVE events -- all other actions will have a size of 0. * Historical samples are indexed from oldest to newest. */ -size_t AMotionEvent_get_history_size(const AInputEvent* motion_event); +size_t AMotionEvent_getHistorySize(const AInputEvent* motion_event); /* Get the time that a historical movement occurred between this event and * the previous event, in the java.lang.System.nanoTime() time base. */ @@ -527,6 +540,47 @@ float AMotionEvent_getHistoricalPressure(AInputEvent* motion_event, size_t point float AMotionEvent_getHistoricalSize(AInputEvent* motion_event, size_t pointer_index, size_t history_index); +/* Get the historical length of the major axis of an ellipse that describes the touch area + * at the point of contact for the given pointer index that + * occurred between this event and the previous motion event. */ +float AMotionEvent_getHistoricalTouchMajor(const AInputEvent* motion_event, size_t pointer_index, + size_t history_index); + +/* Get the historical length of the minor axis of an ellipse that describes the touch area + * at the point of contact for the given pointer index that + * occurred between this event and the previous motion event. */ +float AMotionEvent_getHistoricalTouchMinor(const AInputEvent* motion_event, size_t pointer_index, + size_t history_index); + +/* Get the historical length of the major axis of an ellipse that describes the size + * of the approaching tool for the given pointer index that + * occurred between this event and the previous motion event. + * The tool area represents the estimated size of the finger or pen that is + * touching the device independent of its actual touch area at the point of contact. */ +float AMotionEvent_getHistoricalToolMajor(const AInputEvent* motion_event, size_t pointer_index, + size_t history_index); + +/* Get the historical length of the minor axis of an ellipse that describes the size + * of the approaching tool for the given pointer index that + * occurred between this event and the previous motion event. + * The tool area represents the estimated size of the finger or pen that is + * touching the device independent of its actual touch area at the point of contact. */ +float AMotionEvent_getHistoricalToolMinor(const AInputEvent* motion_event, size_t pointer_index, + size_t history_index); + +/* Get the historical orientation of the touch area and tool area in radians clockwise from + * vertical for the given pointer index that + * occurred between this event and the previous motion event. + * An angle of 0 degrees indicates that the major axis of contact is oriented + * upwards, is perfectly circular or is of unknown orientation. A positive angle + * indicates that the major axis of contact is oriented to the right. A negative angle + * indicates that the major axis of contact is oriented to the left. + * The full range is from -PI/4 radians (finger pointing fully left) to PI/4 radians + * (finger pointing fully right). */ +float AMotionEvent_getHistoricalOrientation(const AInputEvent* motion_event, size_t pointer_index, + size_t history_index); + + /* * Input queue * @@ -553,7 +607,7 @@ void AInputQueue_detachLooper(AInputQueue* queue); * input queue. Returns 1 if the queue has events; 0 if * it does not have events; and a negative value if there is an error. */ -int AInputQueue_hasEvents(AInputQueue* queue); +int32_t AInputQueue_hasEvents(AInputQueue* queue); /* * Returns the next available event from the queue. Returns a negative @@ -561,6 +615,16 @@ int AInputQueue_hasEvents(AInputQueue* queue); */ int32_t AInputQueue_getEvent(AInputQueue* queue, AInputEvent** outEvent); +/* + * Sends the key for standard pre-dispatching -- that is, possibly deliver + * it to the current IME to be consumed before the app. Returns 0 if it + * was not pre-dispatched, meaning you can process it right now. If non-zero + * is returned, you must abandon the current event processing and allow the + * event to appear again in the event queue (if it does not get consumed during + * pre-dispatching). + */ +int32_t AInputQueue_preDispatchEvent(AInputQueue* queue, AInputEvent* event); + /* * Report that dispatching has finished with the given event. * This must be called after receiving an event with AInputQueue_get_event(). diff --git a/ndk/platforms/android-9/arch-arm/usr/include/android/native_activity.h b/ndk/platforms/android-9/arch-arm/usr/include/android/native_activity.h index d4df05b98..ee4204d88 100644 --- a/ndk/platforms/android-9/arch-arm/usr/include/android/native_activity.h +++ b/ndk/platforms/android-9/arch-arm/usr/include/android/native_activity.h @@ -73,7 +73,7 @@ typedef struct ANativeActivity { * Path to this application's external (removable/mountable) data directory. */ const char* externalDataPath; - + /** * The platform's SDK version code. */ diff --git a/ndk/platforms/android-9/arch-arm/usr/include/android/sensor.h b/ndk/platforms/android-9/arch-arm/usr/include/android/sensor.h new file mode 100644 index 000000000..4291d3e88 --- /dev/null +++ b/ndk/platforms/android-9/arch-arm/usr/include/android/sensor.h @@ -0,0 +1,235 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef ANDROID_SENSOR_H +#define ANDROID_SENSOR_H + +/****************************************************************** + * + * IMPORTANT NOTICE: + * + * This file is part of Android's set of stable system headers + * exposed by the Android NDK (Native Development Kit). + * + * Third-party source AND binary code relies on the definitions + * here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES. + * + * - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES) + * - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS + * - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY + * - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES + */ + +/* + * Structures and functions to receive and process sensor events in + * native code. + * + */ + +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/* + * Sensor types + * (keep in sync with hardware/sensor.h) + */ + +enum { + ASENSOR_TYPE_ACCELEROMETER = 1, + ASENSOR_TYPE_MAGNETIC_FIELD = 2, + ASENSOR_TYPE_GYROSCOPE = 4, + ASENSOR_TYPE_LIGHT = 5, + ASENSOR_TYPE_PROXIMITY = 8 +}; + +/* + * Sensor accuracy measure + */ +enum { + ASENSOR_STATUS_UNRELIABLE = 0, + ASENSOR_STATUS_ACCURACY_LOW = 1, + ASENSOR_STATUS_ACCURACY_MEDIUM = 2, + ASENSOR_STATUS_ACCURACY_HIGH = 3 +}; + +/* + * A few useful constants + */ + +/* Earth's gravity in m/s^2 */ +#define ASENSOR_STANDARD_GRAVITY (9.80665f) +/* Maximum magnetic field on Earth's surface in uT */ +#define ASENSOR_MAGNETIC_FIELD_EARTH_MAX (60.0f) +/* Minimum magnetic field on Earth's surface in uT*/ +#define ASENSOR_MAGNETIC_FIELD_EARTH_MIN (30.0f) + +/* + * A sensor event. + */ + +typedef struct ASensorVector { + union { + float v[3]; + struct { + float x; + float y; + float z; + }; + }; + int8_t status; + uint8_t reserved[3]; +} ASensorVector; + +typedef struct ASensorEvent { + int sensor; + int32_t reserved0; + union { + float data[16]; + ASensorVector acceleration; + ASensorVector magnetic; + float temperature; + float distance; + float light; + }; + int64_t timestamp; + int32_t reserved1[4]; +} ASensorEvent; + + +struct ASensorManager; +typedef struct ASensorManager ASensorManager; + +struct ASensorEventQueue; +typedef struct ASensorEventQueue ASensorEventQueue; + +struct ASensor; +typedef struct ASensor ASensor; + +/*****************************************************************************/ + +/* + * Get a reference to the sensor manager. ASensorManager is a singleton. + * + * Example: + * + * ASensorManager* sensorManager = ASensorManager_getInstance(); + * + */ +ASensorManager* ASensorManager_getInstance(); + + +/* + * Returns the list of available sensors. + */ +int ASensorManager_getSensorList(ASensorManager* manager, ASensor** list); + +/* + * Returns the default sensor for the given type, or NULL if no sensor + * of that type exist. + */ +ASensor* ASensorManager_getDefaultSensor(ASensorManager* manager, int type); + +/* + * Creates a new sensor event queue and associate it with a looper. + */ +ASensorEventQueue* ASensorManager_createEventQueue(ASensorManager* manager, + ALooper* looper, ALooper_callbackFunc* callback, void* data); + +/* + * Destroys the event queue and free all resources associated to it. + */ +int ASensorManager_destroyEventQueue(ASensorManager* manager, ASensorEventQueue* queue); + + +/*****************************************************************************/ + +/* + * Enable the selected sensor. Returns a negative error code on failure. + */ +int ASensorEventQueue_enableSensor(ASensorEventQueue* queue, ASensor* sensor); + +/* + * Disable the selected sensor. Returns a negative error code on failure. + */ +int ASensorEventQueue_disableSensor(ASensorEventQueue* queue, ASensor* sensor); + +/* + * Sets the delivery rate of events in microseconds for the given sensor. + * Note that this is a hint only, generally event will arrive at a higher + * rate. + * Returns a negative error code on failure. + */ +int ASensorEventQueue_setEventRate(ASensorEventQueue* queue, ASensor* sensor, int32_t usec); + +/* + * Returns true if there are one or more events available in the + * sensor queue. Returns 1 if the queue has events; 0 if + * it does not have events; and a negative value if there is an error. + */ +int ASensorEventQueue_hasEvents(ASensorEventQueue* queue); + +/* + * Returns the next available events from the queue. Returns a negative + * value if no events are available or an error has occurred, otherwise + * the number of events returned. + * + * Examples: + * ASensorEvent event; + * ssize_t numEvent = ASensorEventQueue_getEvents(queue, &event, 1); + * + * ASensorEvent eventBuffer[8]; + * ssize_t numEvent = ASensorEventQueue_getEvents(queue, eventBuffer, 8); + * + */ +ssize_t ASensorEventQueue_getEvents(ASensorEventQueue* queue, + ASensorEvent* events, size_t count); + + +/*****************************************************************************/ + +/* + * Returns this sensor's name (non localized) + */ +const char* ASensor_getName(ASensor* sensor); + +/* + * Returns this sensor's vendor's name (non localized) + */ +const char* ASensor_getVendor(ASensor* sensor); + +/* + * Return this sensor's type + */ +int ASensor_getType(ASensor* sensor); + +/* + * Returns this sensors's resolution + */ +float ASensor_getResolution(ASensor* sensor); + + +#ifdef __cplusplus +}; +#endif + +#endif // ANDROID_SENSOR_H diff --git a/ndk/platforms/android-9/arch-arm/usr/lib/libandroid.so b/ndk/platforms/android-9/arch-arm/usr/lib/libandroid.so index d79ec890a58382b3f8d7ade88155c852ce07532e..04a1e58ec1d502feac29cdc0118f4e8575ac87a3 100644 GIT binary patch literal 17940 zcmeHPe{|H9EaXSAsJ} zHbF-r6Qyzz^#QeV5{^V^gtD0)zZ5d3oD_&4ic5BgYyoV7G7*r7?9|5EQxP}Vq@vY_ z7Oue)MT`j&^+o@7z-It-ALt-xF6eoX3VIQg3Hlo7UqHJ-kAZ4IHqhrlRO}#^CNWkG zPO&4PFz8Xx3m_`bf+{qLv1afF(32cr0e%OUzYC5Ov0{)J6a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PM@1vr*4?2ac213)K+z~x?BL`jj$OH1VK$yg@lpI`M|-Q%BL-veW!sWcJO0zhZ3lwOGEm^KR+G>y6KjnQ8pc zOHTQ$v-_Ii(|dI@;TtmTm@jJ5103$azF_n2-QiHH7H$oNgRLPg*xbB(uhz1=MXQ6j zJy_R7-#!Z`ln2Mh*-^S9EhOKU%^t?|vLF66dw6{O*6u+lX(*(Cpdn^ z;m?d*06$eYF>)FFtKc>7We-0Czw_XfC;#u+!z0LD0)7;{4E#8F1vvTDfRo=2;$K}o zG7e7lP+R}Mj2 zobxxp={wOM!10O8Ik(2A3#VQ5J*3Fze)ptrF?9Y;h1y1ij;y6m6?1UyjqW%&&iHu+ z1Mq)EG*&dW#2Z@fX1!KC>I?X5gY?nfIk{#E9&K4cuyvPju$nC{E({haOBNO9EmKzJ zmnzpO*XONKZdi0<9`mOx=Skn6j-~CCt#>m&g8aq-M~n_9^nNqK{5YnHF+X5>xS#nG zmTmZZ69ay#`1V1()6u!BW42Rn0vt1?%j?AH zNt~vqQu;9SL$tY!PW+R_=`Vb7OLNu{t)&_)Ji=6Htcd7;AFv!8J*`KgaZEI=Q7Ys^ zYoHlKI*O-tN<`~a6k4BDOb|UvlOL^rBH9mxi6|ePgXibTA(jk&SM}Aa>K*FyK ziD`5u4_za;s|{}Utj0Qpfr z9s|*ya>mOC0YrLHs4gnULG=FvZxNG|U0ghuF;s5{u diff --git a/ndk/samples/native-activity/jni/main.c b/ndk/samples/native-activity/jni/main.c index c52c95997..83f55a90f 100644 --- a/ndk/samples/native-activity/jni/main.c +++ b/ndk/samples/native-activity/jni/main.c @@ -133,6 +133,9 @@ static int engine_do_ui_event(struct engine* engine) { AInputEvent* event = NULL; if (AInputQueue_getEvent(engine->app->inputQueue, &event) >= 0) { LOGI("New input event: type=%d\n", AInputEvent_getType(event)); + if (AInputQueue_preDispatchEvent(engine->app->inputQueue, event)) { + return 1; + } if (AInputEvent_getType(event) == INPUT_EVENT_TYPE_MOTION) { engine->animating = 1; engine->x = AMotionEvent_getX(event, 0); diff --git a/ndk/samples/native-plasma/jni/plasma.c b/ndk/samples/native-plasma/jni/plasma.c index 0ef9788ae..90d6bd7cf 100644 --- a/ndk/samples/native-plasma/jni/plasma.c +++ b/ndk/samples/native-plasma/jni/plasma.c @@ -414,6 +414,9 @@ static int engine_term_display(struct engine* engine) { static int engine_do_ui_event(struct engine* engine) { AInputEvent* event = NULL; if (AInputQueue_getEvent(engine->app->inputQueue, &event) >= 0) { + if (AInputQueue_preDispatchEvent(engine->app->inputQueue, event)) { + return 1; + } if (AInputEvent_getType(event) == INPUT_EVENT_TYPE_MOTION) { engine->animating = 1; AInputQueue_finishEvent(engine->app->inputQueue, event, 1);