diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/android_runtime/AndroidRuntime.h | 18 | ||||
-rw-r--r-- | include/binder/Parcel.h | 3 | ||||
-rw-r--r-- | include/gui/SurfaceTexture.h | 31 | ||||
-rw-r--r-- | include/gui/SurfaceTextureClient.h | 22 | ||||
-rw-r--r-- | include/surfaceflinger/IGraphicBufferAlloc.h | 10 | ||||
-rw-r--r-- | include/surfaceflinger/ISurfaceComposerClient.h | 1 | ||||
-rw-r--r-- | include/surfaceflinger/SurfaceComposerClient.h | 2 | ||||
-rw-r--r-- | include/tts/TtsEngine.h | 232 | ||||
-rw-r--r-- | include/ui/Input.h | 5 |
9 files changed, 64 insertions, 260 deletions
diff --git a/include/android_runtime/AndroidRuntime.h b/include/android_runtime/AndroidRuntime.h index de2d50b..b02a057 100644 --- a/include/android_runtime/AndroidRuntime.h +++ b/include/android_runtime/AndroidRuntime.h @@ -46,14 +46,10 @@ public: const char* className, const JNINativeMethod* gMethods, int numMethods); /** - * Call a static Java function that takes no arguments and returns void. - */ - status_t callStatic(const char* className, const char* methodName); - - /** * Call a class's static main method with the given arguments, */ - status_t callMain(const char* className, int argc, const char* const argv[]); + status_t callMain(const char* className, jclass clazz, int argc, + const char* const argv[]); /** * Find a class, with the input either of the form @@ -69,6 +65,13 @@ public: static AndroidRuntime* getRuntime(); /** + * This gets called after the VM has been created, but before we + * run any code. Override it to make any FindClass calls that need + * to use CLASSPATH. + */ + virtual void onVmCreated(JNIEnv* env); + + /** * This gets called after the JavaVM has initialized. Override it * with the system's native entry point. */ @@ -98,6 +101,9 @@ public: /** return a pointer to the JNIEnv pointer for this thread */ static JNIEnv* getJNIEnv(); + /** return a new string corresponding to 'className' with all '.'s replaced by '/'s. */ + static char* toSlashClassName(const char* className); + private: static int startReg(JNIEnv* env); void parseExtraOpts(char* extraOptsBuf); diff --git a/include/binder/Parcel.h b/include/binder/Parcel.h index 32c9a1d5..bfe13f0 100644 --- a/include/binder/Parcel.h +++ b/include/binder/Parcel.h @@ -53,7 +53,8 @@ public: status_t setData(const uint8_t* buffer, size_t len); - status_t appendFrom(Parcel *parcel, size_t start, size_t len); + status_t appendFrom(const Parcel *parcel, + size_t start, size_t len); bool hasFileDescriptors() const; diff --git a/include/gui/SurfaceTexture.h b/include/gui/SurfaceTexture.h index 585d288..96828c6 100644 --- a/include/gui/SurfaceTexture.h +++ b/include/gui/SurfaceTexture.h @@ -127,11 +127,28 @@ public: // be called from the client. status_t setDefaultBufferSize(uint32_t w, uint32_t h); -private: + // getCurrentBuffer returns the buffer associated with the current image. + sp<GraphicBuffer> getCurrentBuffer() const; + + // getCurrentTextureTarget returns the texture target of the current + // texture as returned by updateTexImage(). + GLenum getCurrentTextureTarget() const; + + // getCurrentCrop returns the cropping rectangle of the current buffer + Rect getCurrentCrop() const; + + // getCurrentTransform returns the transform of the current buffer + uint32_t getCurrentTransform() const; + +protected: // freeAllBuffers frees the resources (both GraphicBuffer and EGLImage) for // all slots. void freeAllBuffers(); + static bool isExternalFormat(uint32_t format); + static GLenum getTextureTarget(uint32_t format); + +private: // createImage creates a new EGLImage from a GraphicBuffer. EGLImageKHR createImage(EGLDisplay dpy, @@ -194,6 +211,10 @@ private: // reset mCurrentTexture to INVALID_BUFFER_SLOT. int mCurrentTexture; + // mCurrentTextureTarget is the GLES texture target to be used with the + // current texture. + GLenum mCurrentTextureTarget; + // mCurrentTextureBuf is the graphic buffer of the current texture. It's // possible that this buffer is not associated with any buffer slot, so we // must track it separately in order to properly use @@ -248,12 +269,6 @@ private: // allocate new GraphicBuffer objects. sp<IGraphicBufferAlloc> mGraphicBufferAlloc; - // mAllocdBuffers is mirror of the list of buffers that SurfaceFlinger is - // referencing. This is kept so that gralloc implementations do not need to - // properly handle the case where SurfaceFlinger no longer holds a reference - // to a buffer, but other processes do. - Vector<sp<GraphicBuffer> > mAllocdBuffers; - // mFrameAvailableListener is the listener object that will be called when a // new frame becomes available. If it is not NULL it will be called from // queueBuffer. @@ -262,7 +277,7 @@ private: // mMutex is the mutex used to prevent concurrent access to the member // variables of SurfaceTexture objects. It must be locked whenever the // member variables are accessed. - Mutex mMutex; + mutable Mutex mMutex; }; // ---------------------------------------------------------------------------- diff --git a/include/gui/SurfaceTextureClient.h b/include/gui/SurfaceTextureClient.h index df82bf2..fe9b049 100644 --- a/include/gui/SurfaceTextureClient.h +++ b/include/gui/SurfaceTextureClient.h @@ -27,6 +27,8 @@ namespace android { +class Surface; + class SurfaceTextureClient : public EGLNativeBase<ANativeWindow, SurfaceTextureClient, RefBase> { @@ -36,6 +38,7 @@ public: sp<ISurfaceTexture> getISurfaceTexture() const; private: + friend class Surface; // can't be copied SurfaceTextureClient& operator = (const SurfaceTextureClient& rhs); @@ -78,6 +81,8 @@ private: void freeAllBuffers(); + int getConnectedApi() const; + enum { MIN_UNDEQUEUED_BUFFERS = SurfaceTexture::MIN_UNDEQUEUED_BUFFERS }; enum { MIN_BUFFER_SLOTS = SurfaceTexture::MIN_BUFFER_SLOTS }; enum { NUM_BUFFER_SLOTS = SurfaceTexture::NUM_BUFFER_SLOTS }; @@ -121,10 +126,25 @@ private: // a timestamp is auto-generated when queueBuffer is called. int64_t mTimestamp; + // mConnectedApi holds the currently connected API to this surface + int mConnectedApi; + + // mQueryWidth is the width returned by query(). It is set to width + // of the last dequeued buffer or to mReqWidth if no buffer was dequeued. + uint32_t mQueryWidth; + + // mQueryHeight is the height returned by query(). It is set to height + // of the last dequeued buffer or to mReqHeight if no buffer was dequeued. + uint32_t mQueryHeight; + + // mQueryFormat is the format returned by query(). It is set to the last + // dequeued format or to mReqFormat if no buffer was dequeued. + uint32_t mQueryFormat; + // mMutex is the mutex used to prevent concurrent access to the member // variables of SurfaceTexture objects. It must be locked whenever the // member variables are accessed. - Mutex mMutex; + mutable Mutex mMutex; }; }; // namespace android diff --git a/include/surfaceflinger/IGraphicBufferAlloc.h b/include/surfaceflinger/IGraphicBufferAlloc.h index d996af7..01e4bd9 100644 --- a/include/surfaceflinger/IGraphicBufferAlloc.h +++ b/include/surfaceflinger/IGraphicBufferAlloc.h @@ -32,18 +32,10 @@ class IGraphicBufferAlloc : public IInterface public: DECLARE_META_INTERFACE(GraphicBufferAlloc); - /* Create a new GraphicBuffer for the client to use. The server will - * maintain a reference to the newly created GraphicBuffer until - * freeAllGraphicBuffers is called. + /* Create a new GraphicBuffer for the client to use. */ virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage) = 0; - - /* Free all but one of the GraphicBuffer objects that the server is - * currently referencing. If bufIndex is not a valid index of the buffers - * the server is referencing, then all buffers are freed. - */ - virtual void freeAllGraphicBuffersExcept(int bufIndex) = 0; }; // ---------------------------------------------------------------------------- diff --git a/include/surfaceflinger/ISurfaceComposerClient.h b/include/surfaceflinger/ISurfaceComposerClient.h index a1e9e04..46b1bb7 100644 --- a/include/surfaceflinger/ISurfaceComposerClient.h +++ b/include/surfaceflinger/ISurfaceComposerClient.h @@ -64,7 +64,6 @@ public: * Requires ACCESS_SURFACE_FLINGER permission */ virtual sp<ISurface> createSurface( surface_data_t* data, - int pid, const String8& name, DisplayID display, uint32_t w, diff --git a/include/surfaceflinger/SurfaceComposerClient.h b/include/surfaceflinger/SurfaceComposerClient.h index 25b2ebf..c61a5bf 100644 --- a/include/surfaceflinger/SurfaceComposerClient.h +++ b/include/surfaceflinger/SurfaceComposerClient.h @@ -79,7 +79,6 @@ public: //! Create a surface sp<SurfaceControl> createSurface( - int pid, // pid of the process the surface is for const String8& name,// name of the surface DisplayID display, // Display to create this surface on uint32_t w, // width in pixel @@ -89,7 +88,6 @@ public: ); sp<SurfaceControl> createSurface( - int pid, // pid of the process the surface is for DisplayID display, // Display to create this surface on uint32_t w, // width in pixel uint32_t h, // height in pixel diff --git a/include/tts/TtsEngine.h b/include/tts/TtsEngine.h deleted file mode 100644 index 998e353..0000000 --- a/include/tts/TtsEngine.h +++ /dev/null @@ -1,232 +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. - */ -#include <media/AudioSystem.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. -// An example of the implementation of this interface can be found in -// FIXME: add path+name to implementation of default TTS engine -// Libraries implementing this interface are used in: -// frameworks/base/tts/jni/android_tts_SpeechSynthesis.cpp - -namespace android { - -#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" - - -enum tts_synth_status { - TTS_SYNTH_DONE = 0, - TTS_SYNTH_PENDING = 1 -}; - -enum tts_callback_status { - TTS_CALLBACK_HALT = 0, - TTS_CALLBACK_CONTINUE = 1 -}; - -// The callback is used by the implementation of this interface to notify its -// client, the Android TTS service, that the last requested synthesis has been -// completed. // TODO reword -// 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 tts_callback_status (synthDoneCB_t)(void *&, uint32_t, - uint32_t, int, int8_t *&, size_t&, tts_synth_status); - -class TtsEngine; -extern "C" TtsEngine* getTtsEngine(); - -enum tts_result { - TTS_SUCCESS = 0, - TTS_FAILURE = -1, - TTS_FEATURE_UNSUPPORTED = -2, - TTS_VALUE_INVALID = -3, - TTS_PROPERTY_UNSUPPORTED = -4, - TTS_PROPERTY_SIZE_TOO_SMALL = -5, - TTS_MISSING_RESOURCES = -6 -}; - -enum tts_support_result { - TTS_LANG_COUNTRY_VAR_AVAILABLE = 2, - TTS_LANG_COUNTRY_AVAILABLE = 1, - TTS_LANG_AVAILABLE = 0, - TTS_LANG_MISSING_DATA = -1, - TTS_LANG_NOT_SUPPORTED = -2 -}; - -class TtsEngine -{ -public: - virtual ~TtsEngine() {} - - // Initialize the TTS engine and returns whether initialization succeeded. - // @param synthDoneCBPtr synthesis callback function pointer - // @return TTS_SUCCESS, or TTS_FAILURE - virtual tts_result init(synthDoneCB_t synthDoneCBPtr, const char *engineConfig); - - // Shut down the TTS engine and releases all associated resources. - // @return TTS_SUCCESS, or TTS_FAILURE - virtual tts_result shutdown(); - - // 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 - virtual tts_result stop(); - - // 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. - virtual tts_support_result isLanguageAvailable(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 - virtual tts_result loadLanguage(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 - virtual tts_result setLanguage(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 - virtual tts_result getLanguage(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 - virtual tts_result setAudioFormat(AudioSystem::audio_format& encoding, uint32_t& rate, - int& channels); - - // 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 - virtual tts_result setProperty(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 - virtual tts_result getProperty(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 - virtual tts_result synthesizeText(const char *text, int8_t *buffer, - size_t bufferSize, void *userdata); - -}; - -} // namespace android - diff --git a/include/ui/Input.h b/include/ui/Input.h index 0dc29c8..9b92c73 100644 --- a/include/ui/Input.h +++ b/include/ui/Input.h @@ -620,6 +620,11 @@ private: // Oldest sample to consider when calculating the velocity. static const nsecs_t MAX_AGE = 200 * 1000000; // 200 ms + // When the total duration of the window of samples being averaged is less + // than the window size, the resulting velocity is scaled to reduce the impact + // of overestimation in short traces. + static const nsecs_t MIN_WINDOW = 100 * 1000000; // 100 ms + // The minimum duration between samples when estimating velocity. static const nsecs_t MIN_DURATION = 10 * 1000000; // 10 ms |