diff options
Diffstat (limited to 'native')
-rw-r--r-- | native/android/Android.mk | 1 | ||||
-rw-r--r-- | native/android/input.cpp | 8 | ||||
-rw-r--r-- | native/android/native_window.cpp | 3 | ||||
-rw-r--r-- | native/include/android/input.h | 52 | ||||
-rw-r--r-- | native/include/android/keycodes.h | 3 | ||||
-rw-r--r-- | native/include/android/native_window.h | 3 | ||||
-rw-r--r-- | native/include/android/tts.h | 313 |
7 files changed, 64 insertions, 319 deletions
diff --git a/native/android/Android.mk b/native/android/Android.mk index 44ec83f..9940442 100644 --- a/native/android/Android.mk +++ b/native/android/Android.mk @@ -22,7 +22,6 @@ LOCAL_SHARED_LIBRARIES := \ libbinder \ libui \ libgui \ - libsurfaceflinger_client \ libandroid_runtime LOCAL_STATIC_LIBRARIES := \ diff --git a/native/android/input.cpp b/native/android/input.cpp index ed26667..91671c3 100644 --- a/native/android/input.cpp +++ b/native/android/input.cpp @@ -92,6 +92,10 @@ int32_t AMotionEvent_getMetaState(const AInputEvent* motion_event) { return static_cast<const MotionEvent*>(motion_event)->getMetaState(); } +int32_t AMotionEvent_getButtonState(const AInputEvent* motion_event) { + return static_cast<const MotionEvent*>(motion_event)->getButtonState(); +} + int32_t AMotionEvent_getEdgeFlags(const AInputEvent* motion_event) { return reinterpret_cast<const MotionEvent*>(motion_event)->getEdgeFlags(); } @@ -128,6 +132,10 @@ int32_t AMotionEvent_getPointerId(const AInputEvent* motion_event, size_t pointe return static_cast<const MotionEvent*>(motion_event)->getPointerId(pointer_index); } +int32_t AMotionEvent_getToolType(const AInputEvent* motion_event, size_t pointer_index) { + return static_cast<const MotionEvent*>(motion_event)->getToolType(pointer_index); +} + float AMotionEvent_getRawX(const AInputEvent* motion_event, size_t pointer_index) { return static_cast<const MotionEvent*>(motion_event)->getRawX(pointer_index); } diff --git a/native/android/native_window.cpp b/native/android/native_window.cpp index ae1993d..8d42edb 100644 --- a/native/android/native_window.cpp +++ b/native/android/native_window.cpp @@ -68,8 +68,7 @@ int32_t ANativeWindow_getFormat(ANativeWindow* window) { int32_t ANativeWindow_setBuffersGeometry(ANativeWindow* window, int32_t width, int32_t height, int32_t format) { - native_window_set_buffers_geometry(window, width, height, format); - return 0; + return native_window_set_buffers_geometry(window, width, height, format); } int32_t ANativeWindow_lock(ANativeWindow* window, ANativeWindow_Buffer* outBuffer, diff --git a/native/include/android/input.h b/native/include/android/input.h index 86be54a..26cac50 100644 --- a/native/include/android/input.h +++ b/native/include/android/input.h @@ -297,6 +297,14 @@ enum { * may not be the window currently touched. */ AMOTION_EVENT_ACTION_SCROLL = 8, + + /* The pointer is not down but has entered the boundaries of a window or view. + */ + AMOTION_EVENT_ACTION_HOVER_ENTER = 9, + + /* The pointer is not down but has exited the boundaries of a window or view. + */ + AMOTION_EVENT_ACTION_HOVER_EXIT = 10, }; /* @@ -364,6 +372,7 @@ enum { AMOTION_EVENT_AXIS_WHEEL = 21, AMOTION_EVENT_AXIS_GAS = 22, AMOTION_EVENT_AXIS_BRAKE = 23, + AMOTION_EVENT_AXIS_DISTANCE = 24, AMOTION_EVENT_AXIS_GENERIC_1 = 32, AMOTION_EVENT_AXIS_GENERIC_2 = 33, AMOTION_EVENT_AXIS_GENERIC_3 = 34, @@ -386,6 +395,32 @@ enum { }; /* + * Constants that identify buttons that are associated with motion events. + * Refer to the documentation on the MotionEvent class for descriptions of each button. + */ +enum { + AMOTION_EVENT_BUTTON_PRIMARY = 1 << 0, + AMOTION_EVENT_BUTTON_SECONDARY = 1 << 1, + AMOTION_EVENT_BUTTON_TERTIARY = 1 << 2, + AMOTION_EVENT_BUTTON_BACK = 1 << 3, + AMOTION_EVENT_BUTTON_FORWARD = 1 << 4, + AMOTION_EVENT_BUTTON_ERASER = 1 << 5, +}; + +/* + * Constants that identify tool types. + * Refer to the documentation on the MotionEvent class for descriptions of each tool type. + */ +enum { + AMOTION_EVENT_TOOL_TYPE_UNKNOWN = 0, + AMOTION_EVENT_TOOL_TYPE_FINGER = 1, + AMOTION_EVENT_TOOL_TYPE_STYLUS = 2, + AMOTION_EVENT_TOOL_TYPE_MOUSE = 3, + AMOTION_EVENT_TOOL_TYPE_INDIRECT_FINGER = 4, + AMOTION_EVENT_TOOL_TYPE_INDIRECT_STYLUS = 5, +}; + +/* * Input sources. * * Refer to the documentation on android.view.InputDevice for more details about input sources @@ -409,6 +444,7 @@ enum { 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_STYLUS = 0x00004000 | AINPUT_SOURCE_CLASS_POINTER, AINPUT_SOURCE_TRACKBALL = 0x00010000 | AINPUT_SOURCE_CLASS_NAVIGATION, AINPUT_SOURCE_TOUCHPAD = 0x00100000 | AINPUT_SOURCE_CLASS_POSITION, AINPUT_SOURCE_JOYSTICK = 0x01000000 | AINPUT_SOURCE_CLASS_JOYSTICK, @@ -524,6 +560,9 @@ int32_t AMotionEvent_getFlags(const AInputEvent* motion_event); * event was generated. */ int32_t AMotionEvent_getMetaState(const AInputEvent* motion_event); +/* Get the button state of all buttons that are pressed. */ +int32_t AMotionEvent_getButtonState(const AInputEvent* motion_event); + /* Get a bitfield indicating which edges, if any, were touched by this motion event. * For touch events, clients can use this to determine if the user's finger was * touching the edge of the display. */ @@ -564,11 +603,16 @@ float AMotionEvent_getYPrecision(const AInputEvent* motion_event); size_t AMotionEvent_getPointerCount(const AInputEvent* motion_event); /* Get the pointer identifier associated with a particular pointer - * data index is this event. The identifier tells you the actual pointer + * data index in this event. The identifier tells you the actual pointer * number associated with the data, accounting for individual pointers * going up and down since the start of the current gesture. */ int32_t AMotionEvent_getPointerId(const AInputEvent* motion_event, size_t pointer_index); +/* Get the tool type of a pointer for the given pointer index. + * The tool type indicates the type of tool used to make contact such as a + * finger or stylus, if known. */ +int32_t AMotionEvent_getToolType(const AInputEvent* motion_event, size_t pointer_index); + /* Get the original raw X coordinate of this event. * For touch events on the screen, this is the original location of the event * on the screen, before it had been adjusted for the containing window @@ -657,7 +701,8 @@ int64_t AMotionEvent_getHistoricalEventTime(AInputEvent* motion_event, * and views. * Whole numbers are pixels; the value may have a fraction for input devices * that are sub-pixel precise. */ -float AMotionEvent_getHistoricalRawX(const AInputEvent* motion_event, size_t pointer_index); +float AMotionEvent_getHistoricalRawX(const AInputEvent* motion_event, size_t pointer_index, + size_t history_index); /* Get the historical raw Y coordinate of this event for the given pointer index that * occurred between this event and the previous motion event. @@ -666,7 +711,8 @@ float AMotionEvent_getHistoricalRawX(const AInputEvent* motion_event, size_t poi * and views. * Whole numbers are pixels; the value may have a fraction for input devices * that are sub-pixel precise. */ -float AMotionEvent_getHistoricalRawY(const AInputEvent* motion_event, size_t pointer_index); +float AMotionEvent_getHistoricalRawY(const AInputEvent* motion_event, size_t pointer_index, + size_t history_index); /* Get the historical X coordinate of this event for the given pointer index that * occurred between this event and the previous motion event. diff --git a/native/include/android/keycodes.h b/native/include/android/keycodes.h index c4a7eff..5d49775 100644 --- a/native/include/android/keycodes.h +++ b/native/include/android/keycodes.h @@ -247,6 +247,9 @@ enum { AKEYCODE_BUTTON_14 = 201, AKEYCODE_BUTTON_15 = 202, AKEYCODE_BUTTON_16 = 203, + AKEYCODE_LANGUAGE_SWITCH = 204, + AKEYCODE_MANNER_MODE = 205, + AKEYCODE_3D_MODE = 206, // NOTE: If you add a new keycode here you must also add it to several other files. // Refer to frameworks/base/core/java/android/view/KeyEvent.java for the full list. diff --git a/native/include/android/native_window.h b/native/include/android/native_window.h index f3d7550..337fa96 100644 --- a/native/include/android/native_window.h +++ b/native/include/android/native_window.h @@ -95,6 +95,9 @@ int32_t ANativeWindow_getFormat(ANativeWindow* window); * * For all of these parameters, if 0 is supplied then the window's base * value will come back in force. + * + * width and height must be either both zero or both non-zero. + * */ int32_t ANativeWindow_setBuffersGeometry(ANativeWindow* window, int32_t width, int32_t height, int32_t format); diff --git a/native/include/android/tts.h b/native/include/android/tts.h deleted file mode 100644 index fb15108..0000000 --- a/native/include/android/tts.h +++ /dev/null @@ -1,313 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. - * - * 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_TTS_H -#define ANDROID_TTS_H - -// This header defines the interface used by the Android platform -// to access Text-To-Speech functionality in shared libraries that implement -// speech synthesis and the management of resources associated with the -// synthesis. - -// The shared library must contain a function named "android_getTtsEngine" -// that returns an 'android_tts_engine_t' instance. - -#ifdef __cplusplus -extern "C" { -#endif - -#define ANDROID_TTS_ENGINE_PROPERTY_CONFIG "engineConfig" -#define ANDROID_TTS_ENGINE_PROPERTY_PITCH "pitch" -#define ANDROID_TTS_ENGINE_PROPERTY_RATE "rate" -#define ANDROID_TTS_ENGINE_PROPERTY_VOLUME "volume" - -typedef enum { - ANDROID_TTS_SUCCESS = 0, - ANDROID_TTS_FAILURE = -1, - ANDROID_TTS_FEATURE_UNSUPPORTED = -2, - ANDROID_TTS_VALUE_INVALID = -3, - ANDROID_TTS_PROPERTY_UNSUPPORTED = -4, - ANDROID_TTS_PROPERTY_SIZE_TOO_SMALL = -5, - ANDROID_TTS_MISSING_RESOURCES = -6 -} android_tts_result_t; - -typedef enum { - ANDROID_TTS_LANG_COUNTRY_VAR_AVAILABLE = 2, - ANDROID_TTS_LANG_COUNTRY_AVAILABLE = 1, - ANDROID_TTS_LANG_AVAILABLE = 0, - ANDROID_TTS_LANG_MISSING_DATA = -1, - ANDROID_TTS_LANG_NOT_SUPPORTED = -2 -} android_tts_support_result_t; - -typedef enum { - ANDROID_TTS_SYNTH_DONE = 0, - ANDROID_TTS_SYNTH_PENDING = 1 -} android_tts_synth_status_t; - -typedef enum { - ANDROID_TTS_CALLBACK_HALT = 0, - ANDROID_TTS_CALLBACK_CONTINUE = 1 -} android_tts_callback_status_t; - -// Supported audio formats -typedef enum { - ANDROID_TTS_AUDIO_FORMAT_INVALID = -1, - ANDROID_TTS_AUDIO_FORMAT_DEFAULT = 0, - ANDROID_TTS_AUDIO_FORMAT_PCM_16_BIT = 1, - ANDROID_TTS_AUDIO_FORMAT_PCM_8_BIT = 2, -} android_tts_audio_format_t; - - -/* An android_tts_engine_t object can be anything, but must have, - * as its first field, a pointer to a table of functions. - * - * See the full definition of struct android_tts_engine_t_funcs_t - * below for details. - */ -typedef struct android_tts_engine_funcs_t android_tts_engine_funcs_t; - -typedef struct { - android_tts_engine_funcs_t *funcs; -} android_tts_engine_t; - -/* This function must be located in the TTS Engine shared library - * and must return the address of an android_tts_engine_t library. - */ -extern android_tts_engine_t *android_getTtsEngine(); - -/* Including the old version for legacy support (Froyo compatibility). - * This should return the same thing as android_getTtsEngine. - */ -extern "C" android_tts_engine_t *getTtsEngine(); - -// A callback type used to notify the framework of new synthetized -// audio samples, status will be SYNTH_DONE for the last sample of -// the last request, of SYNTH_PENDING otherwise. -// -// This is passed by the framework to the engine through the -// 'engine_init' function (see below). -// -// The callback for synthesis completed takes: -// @param [inout] void *& - The userdata pointer set in the original -// synth call -// @param [in] uint32_t - Track sampling rate in Hz -// @param [in] uint32_t - The audio format -// @param [in] int - The number of channels -// @param [inout] int8_t *& - A buffer of audio data only valid during the -// execution of the callback -// @param [inout] size_t & - The size of the buffer -// @param [in] tts_synth_status - indicate whether the synthesis is done, or -// if more data is to be synthesized. -// @return TTS_CALLBACK_HALT to indicate the synthesis must stop, -// TTS_CALLBACK_CONTINUE to indicate the synthesis must continue if -// there is more data to produce. -typedef android_tts_callback_status_t (*android_tts_synth_cb_t) - (void **pUserData, - uint32_t trackSamplingHz, - android_tts_audio_format_t audioFormat, - int channelCount, - int8_t **pAudioBuffer, - size_t *pBufferSize, - android_tts_synth_status_t status); - - -// The table of function pointers that the android_tts_engine_t must point to. -// Note that each of these functions will take a handle to the engine itself -// as their first parameter. -// - -struct android_tts_engine_funcs_t { - // reserved fields, ignored by the framework - // they must be placed here to ensure binary compatibility - // of legacy binary plugins. - void *reserved[2]; - - // Initialize the TTS engine and returns whether initialization succeeded. - // @param synthDoneCBPtr synthesis callback function pointer - // @return TTS_SUCCESS, or TTS_FAILURE - android_tts_result_t (*init) - (void *engine, - android_tts_synth_cb_t synthDonePtr, - const char *engineConfig); - - // Shut down the TTS engine and releases all associated resources. - // @return TTS_SUCCESS, or TTS_FAILURE - android_tts_result_t (*shutdown) - (void *engine); - - // Interrupt synthesis and flushes any synthesized data that hasn't been - // output yet. This will block until callbacks underway are completed. - // @return TTS_SUCCESS, or TTS_FAILURE - android_tts_result_t (*stop) - (void *engine); - - // Returns the level of support for the language, country and variant. - // @return TTS_LANG_COUNTRY_VAR_AVAILABLE if the language, country and variant are supported, - // and the corresponding resources are correctly installed - // TTS_LANG_COUNTRY_AVAILABLE if the language and country are supported and the - // corresponding resources are correctly installed, but there is no match for - // the specified variant - // TTS_LANG_AVAILABLE if the language is supported and the - // corresponding resources are correctly installed, but there is no match for - // the specified country and variant - // TTS_LANG_MISSING_DATA if the required resources to provide any level of support - // for the language are not correctly installed - // TTS_LANG_NOT_SUPPORTED if the language is not supported by the TTS engine. - android_tts_support_result_t (*isLanguageAvailable) - (void *engine, - const char *lang, - const char *country, - const char *variant); - - // Load the resources associated with the specified language. The loaded - // language will only be used once a call to setLanguage() with the same - // language value is issued. Language and country values are coded according to the ISO three - // letter codes for languages and countries, as can be retrieved from a java.util.Locale - // instance. The variant value is encoded as the variant string retrieved from a - // java.util.Locale instance built with that variant data. - // @param lang pointer to the ISO three letter code for the language - // @param country pointer to the ISO three letter code for the country - // @param variant pointer to the variant code - // @return TTS_SUCCESS, or TTS_FAILURE - android_tts_result_t (*loadLanguage) - (void *engine, - const char *lang, - const char *country, - const char *variant); - - // Load the resources associated with the specified language, country and Locale variant. - // The loaded language will only be used once a call to setLanguageFromLocale() with the same - // language value is issued. Language and country values are coded according to the ISO three - // letter codes for languages and countries, as can be retrieved from a java.util.Locale - // instance. The variant value is encoded as the variant string retrieved from a - // java.util.Locale instance built with that variant data. - // @param lang pointer to the ISO three letter code for the language - // @param country pointer to the ISO three letter code for the country - // @param variant pointer to the variant code - // @return TTS_SUCCESS, or TTS_FAILURE - android_tts_result_t (*setLanguage) - (void *engine, - const char *lang, - const char *country, - const char *variant); - - // Retrieve the currently set language, country and variant, or empty strings if none of - // parameters have been set. Language and country are represented by their 3-letter ISO code - // @param[out] pointer to the retrieved 3-letter code language value - // @param[out] pointer to the retrieved 3-letter code country value - // @param[out] pointer to the retrieved variant value - // @return TTS_SUCCESS, or TTS_FAILURE - android_tts_result_t (*getLanguage) - (void *engine, - char *language, - char *country, - char *variant); - - // Notifies the engine what audio parameters should be used for the synthesis. - // This is meant to be used as a hint, the engine implementation will set the output values - // to those of the synthesis format, based on a given hint. - // @param[inout] encoding in: the desired audio sample format - // out: the format used by the TTS engine - // @param[inout] rate in: the desired audio sample rate - // out: the sample rate used by the TTS engine - // @param[inout] channels in: the desired number of audio channels - // out: the number of channels used by the TTS engine - // @return TTS_SUCCESS, or TTS_FAILURE - android_tts_result_t (*setAudioFormat) - (void *engine, - android_tts_audio_format_t* pEncoding, - uint32_t* pRate, - int* pChannels); - - // Set a property for the the TTS engine - // "size" is the maximum size of "value" for properties "property" - // @param property pointer to the property name - // @param value pointer to the property value - // @param size maximum size required to store this type of property - // @return TTS_PROPERTY_UNSUPPORTED, or TTS_SUCCESS, or TTS_FAILURE, - // or TTS_VALUE_INVALID - android_tts_result_t (*setProperty) - (void *engine, - const char *property, - const char *value, - const size_t size); - - // Retrieve a property from the TTS engine - // @param property pointer to the property name - // @param[out] value pointer to the retrieved language value - // @param[inout] iosize in: stores the size available to store the - // property value. - // out: stores the size required to hold the language - // value if getLanguage() returned - // TTS_PROPERTY_SIZE_TOO_SMALL, unchanged otherwise - // @return TTS_PROPERTY_UNSUPPORTED, or TTS_SUCCESS, - // or TTS_PROPERTY_SIZE_TOO_SMALL - android_tts_result_t (*getProperty) - (void *engine, - const char *property, - char *value, - size_t *iosize); - - // Synthesize the text. - // As the synthesis is performed, the engine invokes the callback to notify - // the TTS framework that it has filled the given buffer, and indicates how - // many bytes it wrote. The callback is called repeatedly until the engine - // has generated all the audio data corresponding to the text. - // Note about the format of the input: the text parameter may use the - // following elements - // and their respective attributes as defined in the SSML 1.0 specification: - // * lang - // * say-as: - // o interpret-as - // * phoneme - // * voice: - // o gender, - // o age, - // o variant, - // o name - // * emphasis - // * break: - // o strength, - // o time - // * prosody: - // o pitch, - // o contour, - // o range, - // o rate, - // o duration, - // o volume - // * mark - // Differences between this text format and SSML are: - // * full SSML documents are not supported - // * namespaces are not supported - // Text is coded in UTF-8. - // @param text the UTF-8 text to synthesize - // @param userdata pointer to be returned when the call is invoked - // @param buffer the location where the synthesized data must be written - // @param bufferSize the number of bytes that can be written in buffer - // @return TTS_SUCCESS or TTS_FAILURE - android_tts_result_t (*synthesizeText) - (void *engine, - const char *text, - int8_t *buffer, - size_t bufferSize, - void *userdata); -}; - -#ifdef __cplusplus -} -#endif - -#endif /* ANDROID_TTS_H */ |