summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/binder/IBinder.h2
-rw-r--r--include/binder/IMemory.h3
-rw-r--r--include/binder/IPCThreadState.h10
-rw-r--r--include/binder/MemoryDealer.h215
-rw-r--r--include/binder/MemoryHeapBase.h1
-rw-r--r--include/binder/MemoryHeapPmem.h7
-rw-r--r--include/binder/Parcel.h4
-rw-r--r--include/private/opengles/gl_context.h11
-rw-r--r--include/private/surfaceflinger/LayerState.h (renamed from include/private/ui/LayerState.h)9
-rw-r--r--include/private/surfaceflinger/SharedBufferStack.h (renamed from include/private/ui/SharedBufferStack.h)6
-rw-r--r--include/surfaceflinger/ISurface.h (renamed from include/ui/ISurface.h)17
-rw-r--r--include/surfaceflinger/ISurfaceComposer.h (renamed from include/ui/ISurfaceComposer.h)21
-rw-r--r--include/surfaceflinger/ISurfaceFlingerClient.h (renamed from include/ui/ISurfaceFlingerClient.h)17
-rw-r--r--include/surfaceflinger/Surface.h (renamed from include/ui/Surface.h)20
-rw-r--r--include/surfaceflinger/SurfaceComposerClient.h (renamed from include/ui/SurfaceComposerClient.h)24
-rw-r--r--include/tts/TtsEngine.h23
-rw-r--r--include/ui/Camera.h212
-rw-r--r--include/ui/CameraHardwareInterface.h219
-rw-r--r--include/ui/CameraParameters.h273
-rw-r--r--include/ui/GraphicBuffer.h17
-rw-r--r--include/ui/GraphicBufferAllocator.h1
-rw-r--r--include/ui/ICamera.h108
-rw-r--r--include/ui/ICameraClient.h51
-rw-r--r--include/ui/ICameraService.h55
-rw-r--r--include/ui/PixelFormat.h26
-rw-r--r--include/ui/Region.h6
-rw-r--r--include/ui/egl/android_natives.h38
-rw-r--r--include/utils/AndroidUnicode.h255
-rw-r--r--include/utils/Flattenable.h62
-rw-r--r--include/utils/ResourceTypes.h110
-rw-r--r--include/utils/String16.h5
-rw-r--r--include/utils/String8.h8
-rw-r--r--include/utils/threads.h37
33 files changed, 368 insertions, 1505 deletions
diff --git a/include/binder/IBinder.h b/include/binder/IBinder.h
index 884b5c1..749a977 100644
--- a/include/binder/IBinder.h
+++ b/include/binder/IBinder.h
@@ -52,7 +52,7 @@ public:
DUMP_TRANSACTION = B_PACK_CHARS('_','D','M','P'),
INTERFACE_TRANSACTION = B_PACK_CHARS('_', 'N', 'T', 'F'),
- // Corresponds to tfOneWay -- an asynchronous call.
+ // Corresponds to TF_ONE_WAY -- an asynchronous call.
FLAG_ONEWAY = 0x00000001
};
diff --git a/include/binder/IMemory.h b/include/binder/IMemory.h
index ae042cb..74d2cc7 100644
--- a/include/binder/IMemory.h
+++ b/include/binder/IMemory.h
@@ -36,8 +36,7 @@ public:
// flags returned by getFlags()
enum {
- READ_ONLY = 0x00000001,
- MAP_ONCE = 0x00000002
+ READ_ONLY = 0x00000001
};
virtual int getHeapID() const = 0;
diff --git a/include/binder/IPCThreadState.h b/include/binder/IPCThreadState.h
index 78306b2..3ab985d 100644
--- a/include/binder/IPCThreadState.h
+++ b/include/binder/IPCThreadState.h
@@ -68,6 +68,13 @@ public:
static void shutdown();
+ // Call this to disable switching threads to background scheduling when
+ // receiving incoming IPC calls. This is specifically here for the
+ // Android system process, since it expects to have background apps calling
+ // in to it but doesn't want to acquire locks in its services while in
+ // the background.
+ static void disableBackgroundScheduling(bool disable);
+
private:
IPCThreadState();
~IPCThreadState();
@@ -93,9 +100,10 @@ private:
void* cookie);
const sp<ProcessState> mProcess;
+ const pid_t mMyThreadId;
Vector<BBinder*> mPendingStrongDerefs;
Vector<RefBase::weakref_type*> mPendingWeakDerefs;
-
+
Parcel mIn;
Parcel mOut;
status_t mLastError;
diff --git a/include/binder/MemoryDealer.h b/include/binder/MemoryDealer.h
index 03ac70a..170f20d 100644
--- a/include/binder/MemoryDealer.h
+++ b/include/binder/MemoryDealer.h
@@ -22,232 +22,35 @@
#include <sys/types.h>
#include <binder/IMemory.h>
-#include <utils/threads.h>
#include <binder/MemoryHeapBase.h>
namespace android {
// ----------------------------------------------------------------------------
-class String8;
-/*
- * interface for implementing a "heap". A heap basically provides
- * the IMemoryHeap interface for cross-process sharing and the
- * ability to map/unmap pages within the heap.
- */
-class HeapInterface : public virtual BnMemoryHeap
-{
-public:
- // all values must be page-aligned
- virtual sp<IMemory> mapMemory(size_t offset, size_t size) = 0;
-
- HeapInterface();
-protected:
- virtual ~HeapInterface();
-};
-
-// ----------------------------------------------------------------------------
-
-/*
- * interface for implementing an allocator. An allocator provides
- * methods for allocating and freeing memory blocks and dumping
- * its state.
- */
-class AllocatorInterface : public RefBase
-{
-public:
- enum {
- PAGE_ALIGNED = 0x00000001
- };
-
- virtual size_t allocate(size_t size, uint32_t flags = 0) = 0;
- virtual status_t deallocate(size_t offset) = 0;
- virtual size_t size() const = 0;
- virtual void dump(const char* what, uint32_t flags = 0) const = 0;
- virtual void dump(String8& res,
- const char* what, uint32_t flags = 0) const = 0;
-
- AllocatorInterface();
-protected:
- virtual ~AllocatorInterface();
-};
-
-// ----------------------------------------------------------------------------
-
-/*
- * concrete implementation of HeapInterface on top of mmap()
- */
-class SharedHeap : public HeapInterface, public MemoryHeapBase
-{
-public:
- SharedHeap();
- SharedHeap(size_t size, uint32_t flags = 0, char const * name = NULL);
- virtual ~SharedHeap();
- virtual sp<IMemory> mapMemory(size_t offset, size_t size);
-};
-
-// ----------------------------------------------------------------------------
-
-/*
- * A simple templatized doubly linked-list implementation
- */
-
-template <typename NODE>
-class LinkedList
-{
- NODE* mFirst;
- NODE* mLast;
-
-public:
- LinkedList() : mFirst(0), mLast(0) { }
- bool isEmpty() const { return mFirst == 0; }
- NODE const* head() const { return mFirst; }
- NODE* head() { return mFirst; }
- NODE const* tail() const { return mLast; }
- NODE* tail() { return mLast; }
-
- void insertAfter(NODE* node, NODE* newNode) {
- newNode->prev = node;
- newNode->next = node->next;
- if (node->next == 0) mLast = newNode;
- else node->next->prev = newNode;
- node->next = newNode;
- }
-
- void insertBefore(NODE* node, NODE* newNode) {
- newNode->prev = node->prev;
- newNode->next = node;
- if (node->prev == 0) mFirst = newNode;
- else node->prev->next = newNode;
- node->prev = newNode;
- }
-
- void insertHead(NODE* newNode) {
- if (mFirst == 0) {
- mFirst = mLast = newNode;
- newNode->prev = newNode->next = 0;
- } else {
- newNode->prev = 0;
- newNode->next = mFirst;
- mFirst->prev = newNode;
- mFirst = newNode;
- }
- }
-
- void insertTail(NODE* newNode) {
- if (mLast == 0) {
- insertHead(newNode);
- } else {
- newNode->prev = mLast;
- newNode->next = 0;
- mLast->next = newNode;
- mLast = newNode;
- }
- }
-
- NODE* remove(NODE* node) {
- if (node->prev == 0) mFirst = node->next;
- else node->prev->next = node->next;
- if (node->next == 0) mLast = node->prev;
- else node->next->prev = node->prev;
- return node;
- }
-};
-
-
-/*
- * concrete implementation of AllocatorInterface using a simple
- * best-fit allocation scheme
- */
-class SimpleBestFitAllocator : public AllocatorInterface
-{
-public:
-
- SimpleBestFitAllocator(size_t size);
- virtual ~SimpleBestFitAllocator();
-
- virtual size_t allocate(size_t size, uint32_t flags = 0);
- virtual status_t deallocate(size_t offset);
- virtual size_t size() const;
- virtual void dump(const char* what, uint32_t flags = 0) const;
- virtual void dump(String8& res,
- const char* what, uint32_t flags = 0) const;
-
-private:
-
- struct chunk_t {
- chunk_t(size_t start, size_t size)
- : start(start), size(size), free(1), prev(0), next(0) {
- }
- size_t start;
- size_t size : 28;
- int free : 4;
- mutable chunk_t* prev;
- mutable chunk_t* next;
- };
-
- ssize_t alloc(size_t size, uint32_t flags);
- chunk_t* dealloc(size_t start);
- void dump_l(const char* what, uint32_t flags = 0) const;
- void dump_l(String8& res, const char* what, uint32_t flags = 0) const;
-
- static const int kMemoryAlign;
- mutable Mutex mLock;
- LinkedList<chunk_t> mList;
- size_t mHeapSize;
-};
+class SimpleBestFitAllocator;
// ----------------------------------------------------------------------------
class MemoryDealer : public RefBase
{
public:
+ MemoryDealer(size_t size, const char* name = 0);
- enum {
- READ_ONLY = MemoryHeapBase::READ_ONLY,
- PAGE_ALIGNED = AllocatorInterface::PAGE_ALIGNED
- };
-
- // creates a memory dealer with the SharedHeap and SimpleBestFitAllocator
- MemoryDealer(size_t size, uint32_t flags = 0, const char* name = 0);
-
- // provide a custom heap but use the SimpleBestFitAllocator
- MemoryDealer(const sp<HeapInterface>& heap);
-
- // provide both custom heap and allocotar
- MemoryDealer(
- const sp<HeapInterface>& heap,
- const sp<AllocatorInterface>& allocator);
-
- virtual sp<IMemory> allocate(size_t size, uint32_t flags = 0);
+ virtual sp<IMemory> allocate(size_t size);
virtual void deallocate(size_t offset);
- virtual void dump(const char* what, uint32_t flags = 0) const;
-
+ virtual void dump(const char* what) const;
sp<IMemoryHeap> getMemoryHeap() const { return heap(); }
- sp<AllocatorInterface> getAllocator() const { return allocator(); }
protected:
virtual ~MemoryDealer();
-private:
- const sp<HeapInterface>& heap() const;
- const sp<AllocatorInterface>& allocator() const;
-
- class Allocation : public BnMemory {
- public:
- Allocation(const sp<MemoryDealer>& dealer,
- ssize_t offset, size_t size, const sp<IMemory>& memory);
- virtual ~Allocation();
- virtual sp<IMemoryHeap> getMemory(ssize_t* offset, size_t* size) const;
- private:
- sp<MemoryDealer> mDealer;
- ssize_t mOffset;
- size_t mSize;
- sp<IMemory> mMemory;
- };
+private:
+ const sp<IMemoryHeap>& heap() const;
+ SimpleBestFitAllocator* allocator() const;
- sp<HeapInterface> mHeap;
- sp<AllocatorInterface> mAllocator;
+ sp<IMemoryHeap> mHeap;
+ SimpleBestFitAllocator* mAllocator;
};
diff --git a/include/binder/MemoryHeapBase.h b/include/binder/MemoryHeapBase.h
index d793c24..2f2e31b 100644
--- a/include/binder/MemoryHeapBase.h
+++ b/include/binder/MemoryHeapBase.h
@@ -32,7 +32,6 @@ class MemoryHeapBase : public virtual BnMemoryHeap
public:
enum {
READ_ONLY = IMemoryHeap::READ_ONLY,
- MAP_ONCE = IMemoryHeap::MAP_ONCE,
// memory won't be mapped locally, but will be mapped in the remote
// process.
DONT_MAP_LOCALLY = 0x00000100,
diff --git a/include/binder/MemoryHeapPmem.h b/include/binder/MemoryHeapPmem.h
index dbf26ff..e1660c4 100644
--- a/include/binder/MemoryHeapPmem.h
+++ b/include/binder/MemoryHeapPmem.h
@@ -20,10 +20,10 @@
#include <stdlib.h>
#include <stdint.h>
-#include <binder/MemoryDealer.h>
#include <binder/MemoryHeapBase.h>
#include <binder/IMemory.h>
#include <utils/SortedVector.h>
+#include <utils/threads.h>
namespace android {
@@ -31,7 +31,7 @@ class MemoryHeapBase;
// ---------------------------------------------------------------------------
-class MemoryHeapPmem : public HeapInterface, public MemoryHeapBase
+class MemoryHeapPmem : public MemoryHeapBase
{
public:
class MemoryPmem : public BnMemory {
@@ -46,8 +46,7 @@ public:
sp<MemoryHeapPmem> mClientHeap;
};
- MemoryHeapPmem(const sp<MemoryHeapBase>& pmemHeap,
- uint32_t flags = IMemoryHeap::MAP_ONCE);
+ MemoryHeapPmem(const sp<MemoryHeapBase>& pmemHeap, uint32_t flags = 0);
~MemoryHeapPmem();
/* HeapInterface additions */
diff --git a/include/binder/Parcel.h b/include/binder/Parcel.h
index ba6c711..66c34b2 100644
--- a/include/binder/Parcel.h
+++ b/include/binder/Parcel.h
@@ -30,6 +30,7 @@ class IBinder;
class ProcessState;
class String8;
class TextOutput;
+class Flattenable;
struct flat_binder_object; // defined in support_p/binder_module.h
@@ -81,6 +82,7 @@ public:
status_t writeString16(const char16_t* str, size_t len);
status_t writeStrongBinder(const sp<IBinder>& val);
status_t writeWeakBinder(const wp<IBinder>& val);
+ status_t write(const Flattenable& val);
// Place a native_handle into the parcel (the native_handle's file-
// descriptors are dup'ed, so it is safe to delete the native_handle
@@ -119,7 +121,7 @@ public:
const char16_t* readString16Inplace(size_t* outLen) const;
sp<IBinder> readStrongBinder() const;
wp<IBinder> readWeakBinder() const;
-
+ status_t read(Flattenable& val) const;
// Retrieve native_handle from the parcel. This returns a copy of the
// parcel's native_handle (the caller takes ownership). The caller
diff --git a/include/private/opengles/gl_context.h b/include/private/opengles/gl_context.h
index 26cde38..c7db9a6 100644
--- a/include/private/opengles/gl_context.h
+++ b/include/private/opengles/gl_context.h
@@ -36,7 +36,12 @@ struct android_native_buffer_t;
namespace android {
-const unsigned int OGLES_NUM_COMPRESSED_TEXTURE_FORMATS = 10;
+
+const unsigned int OGLES_NUM_COMPRESSED_TEXTURE_FORMATS = 10
+#ifdef GL_OES_compressed_ETC1_RGB8_texture
+ + 1
+#endif
+ ;
class EGLTextureObject;
class EGLSurfaceManager;
@@ -289,7 +294,6 @@ struct light_t {
vec4_t normalizedObjPosition;
vec4_t spotDir;
vec4_t normalizedSpotDir;
- vec4_t objViewer;
GLfixed spotExp;
GLfixed spotCutoff;
GLfixed spotCutoffCosine;
@@ -322,9 +326,10 @@ struct lighting_t {
material_t front;
light_model_t lightModel;
color_material_t colorMaterial;
+ vec4_t implicitSceneEmissionAndAmbient;
+ vec4_t objViewer;
uint32_t enabledLights;
GLboolean enable;
- vec4_t implicitSceneEmissionAndAmbient;
GLenum shadeModel;
typedef void (*light_fct_t)(ogles_context_t*, vertex_t*);
void (*lightVertex)(ogles_context_t* c, vertex_t* v);
diff --git a/include/private/ui/LayerState.h b/include/private/surfaceflinger/LayerState.h
index f1a2618..d7fe572 100644
--- a/include/private/ui/LayerState.h
+++ b/include/private/surfaceflinger/LayerState.h
@@ -14,17 +14,18 @@
* limitations under the License.
*/
-#ifndef ANDROID_COMPOSER_LAYER_STATE_H
-#define ANDROID_COMPOSER_LAYER_STATE_H
+#ifndef ANDROID_SF_LAYER_STATE_H
+#define ANDROID_SF_LAYER_STATE_H
#include <stdint.h>
#include <sys/types.h>
#include <utils/Errors.h>
-#include <ui/ISurfaceFlingerClient.h>
#include <ui/Region.h>
+#include <surfaceflinger/ISurface.h>
+
namespace android {
class Parcel;
@@ -69,5 +70,5 @@ struct layer_state_t {
}; // namespace android
-#endif // ANDROID_COMPOSER_LAYER_STATE_H
+#endif // ANDROID_SF_LAYER_STATE_H
diff --git a/include/private/ui/SharedBufferStack.h b/include/private/surfaceflinger/SharedBufferStack.h
index bbc1822..9b5a1e0 100644
--- a/include/private/ui/SharedBufferStack.h
+++ b/include/private/surfaceflinger/SharedBufferStack.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ANDROID_UI_SHARED_BUFFER_STACK_H
-#define ANDROID_UI_SHARED_BUFFER_STACK_H
+#ifndef ANDROID_SF_SHARED_BUFFER_STACK_H
+#define ANDROID_SF_SHARED_BUFFER_STACK_H
#include <stdint.h>
#include <sys/types.h>
@@ -356,4 +356,4 @@ COMPILE_TIME_ASSERT(sizeof(surface_flinger_cblk_t) <= 4096)
// ---------------------------------------------------------------------------
}; // namespace android
-#endif /* ANDROID_UI_SHARED_BUFFER_STACK_H */
+#endif /* ANDROID_SF_SHARED_BUFFER_STACK_H */
diff --git a/include/ui/ISurface.h b/include/surfaceflinger/ISurface.h
index 2ca0026..472f759 100644
--- a/include/ui/ISurface.h
+++ b/include/surfaceflinger/ISurface.h
@@ -14,15 +14,17 @@
* limitations under the License.
*/
-#ifndef ANDROID_ISURFACE_H
-#define ANDROID_ISURFACE_H
+#ifndef ANDROID_SF_ISURFACE_H
+#define ANDROID_SF_ISURFACE_H
#include <stdint.h>
#include <sys/types.h>
#include <utils/Errors.h>
-#include <binder/IInterface.h>
#include <utils/RefBase.h>
+
+#include <binder/IInterface.h>
+
#include <ui/PixelFormat.h>
#include <hardware/hardware.h>
@@ -55,8 +57,11 @@ public:
class BufferHeap {
public:
enum {
- /* rotate source image 90 degrees */
+ /* rotate source image */
+ ROT_0 = 0,
ROT_90 = HAL_TRANSFORM_ROT_90,
+ ROT_180 = HAL_TRANSFORM_ROT_180,
+ ROT_270 = HAL_TRANSFORM_ROT_270,
};
BufferHeap();
@@ -86,7 +91,7 @@ public:
virtual void unregisterBuffers() = 0;
virtual sp<OverlayRef> createOverlay(
- uint32_t w, uint32_t h, int32_t format) = 0;
+ uint32_t w, uint32_t h, int32_t format, int32_t orientation) = 0;
};
// ----------------------------------------------------------------------------
@@ -104,4 +109,4 @@ public:
}; // namespace android
-#endif // ANDROID_ISURFACE_H
+#endif // ANDROID_SF_ISURFACE_H
diff --git a/include/ui/ISurfaceComposer.h b/include/surfaceflinger/ISurfaceComposer.h
index 25d954c..d1e7785 100644
--- a/include/ui/ISurfaceComposer.h
+++ b/include/surfaceflinger/ISurfaceComposer.h
@@ -14,25 +14,24 @@
* limitations under the License.
*/
-#ifndef ANDROID_ISURFACE_COMPOSER_H
-#define ANDROID_ISURFACE_COMPOSER_H
+#ifndef ANDROID_SF_ISURFACE_COMPOSER_H
+#define ANDROID_SF_ISURFACE_COMPOSER_H
#include <stdint.h>
#include <sys/types.h>
#include <utils/RefBase.h>
#include <utils/Errors.h>
+
#include <binder/IInterface.h>
#include <ui/PixelFormat.h>
-#include <ui/ISurfaceFlingerClient.h>
-namespace android {
+#include <surfaceflinger/ISurfaceFlingerClient.h>
+namespace android {
// ----------------------------------------------------------------------------
-class DisplayInfo;
-
class ISurfaceComposer : public IInterface
{
public:
@@ -92,19 +91,19 @@ public:
/* retrieve the control block */
virtual sp<IMemoryHeap> getCblk() const = 0;
- /* open/close transactions. recquires ACCESS_SURFACE_FLINGER permission */
+ /* open/close transactions. requires ACCESS_SURFACE_FLINGER permission */
virtual void openGlobalTransaction() = 0;
virtual void closeGlobalTransaction() = 0;
- /* [un]freeze display. recquires ACCESS_SURFACE_FLINGER permission */
+ /* [un]freeze display. requires ACCESS_SURFACE_FLINGER permission */
virtual status_t freezeDisplay(DisplayID dpy, uint32_t flags) = 0;
virtual status_t unfreezeDisplay(DisplayID dpy, uint32_t flags) = 0;
- /* Set display orientation. recquires ACCESS_SURFACE_FLINGER permission */
+ /* Set display orientation. requires ACCESS_SURFACE_FLINGER permission */
virtual int setOrientation(DisplayID dpy, int orientation, uint32_t flags) = 0;
/* signal that we're done booting.
- * recquires ACCESS_SURFACE_FLINGER permission
+ * Requires ACCESS_SURFACE_FLINGER permission
*/
virtual void bootFinished() = 0;
@@ -143,4 +142,4 @@ public:
}; // namespace android
-#endif // ANDROID_ISURFACE_COMPOSER_H
+#endif // ANDROID_SF_ISURFACE_COMPOSER_H
diff --git a/include/ui/ISurfaceFlingerClient.h b/include/surfaceflinger/ISurfaceFlingerClient.h
index 5d231e6..d257645 100644
--- a/include/ui/ISurfaceFlingerClient.h
+++ b/include/surfaceflinger/ISurfaceFlingerClient.h
@@ -14,28 +14,26 @@
* limitations under the License.
*/
-#ifndef ANDROID_ISURFACE_FLINGER_CLIENT_H
-#define ANDROID_ISURFACE_FLINGER_CLIENT_H
+#ifndef ANDROID_SF_ISURFACE_FLINGER_CLIENT_H
+#define ANDROID_SF_ISURFACE_FLINGER_CLIENT_H
#include <stdint.h>
#include <sys/types.h>
#include <utils/Errors.h>
-#include <binder/IInterface.h>
#include <utils/RefBase.h>
-#include <ui/ISurface.h>
+#include <binder/IInterface.h>
#include <ui/PixelFormat.h>
+#include <surfaceflinger/ISurface.h>
+
namespace android {
// ----------------------------------------------------------------------------
-class Rect;
-class Point;
-class IMemory;
-class ISurface;
+class IMemoryHeap;
typedef int32_t ClientID;
typedef int32_t DisplayID;
@@ -63,6 +61,7 @@ public:
virtual sp<ISurface> createSurface( surface_data_t* data,
int pid,
+ const String8& name,
DisplayID display,
uint32_t w,
uint32_t h,
@@ -89,4 +88,4 @@ public:
}; // namespace android
-#endif // ANDROID_ISURFACE_FLINGER_CLIENT_H
+#endif // ANDROID_SF_ISURFACE_FLINGER_CLIENT_H
diff --git a/include/ui/Surface.h b/include/surfaceflinger/Surface.h
index 008c297..0279d84 100644
--- a/include/ui/Surface.h
+++ b/include/surfaceflinger/Surface.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ANDROID_UI_SURFACE_H
-#define ANDROID_UI_SURFACE_H
+#ifndef ANDROID_SF_SURFACE_H
+#define ANDROID_SF_SURFACE_H
#include <stdint.h>
#include <sys/types.h>
@@ -23,13 +23,13 @@
#include <utils/RefBase.h>
#include <utils/threads.h>
-#include <ui/ISurface.h>
#include <ui/PixelFormat.h>
#include <ui/Region.h>
-#include <ui/ISurfaceFlingerClient.h>
-
#include <ui/egl/android_natives.h>
+#include <surfaceflinger/ISurface.h>
+#include <surfaceflinger/ISurfaceFlingerClient.h>
+
namespace android {
// ---------------------------------------------------------------------------
@@ -210,9 +210,16 @@ private:
status_t dequeueBuffer(sp<GraphicBuffer>* buffer);
+ void dispatch_setUsage(va_list args);
+ int dispatch_connect(va_list args);
+ int dispatch_disconnect(va_list args);
void setUsage(uint32_t reqUsage);
+ int connect(int api);
+ int disconnect(int api);
+
uint32_t getUsage() const;
+ int getConnectedApi() const;
// constants
sp<SurfaceComposerClient> mClient;
@@ -227,6 +234,7 @@ private:
// protected by mSurfaceLock
Rect mSwapRectangle;
uint32_t mUsage;
+ int mConnected;
// protected by mSurfaceLock. These are also used from lock/unlock
// but in that case, they must be called form the same thread.
@@ -250,5 +258,5 @@ private:
}; // namespace android
-#endif // ANDROID_UI_SURFACE_H
+#endif // ANDROID_SF_SURFACE_H
diff --git a/include/ui/SurfaceComposerClient.h b/include/surfaceflinger/SurfaceComposerClient.h
index 777b878..9d0f0cb 100644
--- a/include/ui/SurfaceComposerClient.h
+++ b/include/surfaceflinger/SurfaceComposerClient.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ANDROID_SURFACE_COMPOSER_CLIENT_H
-#define ANDROID_SURFACE_COMPOSER_CLIENT_H
+#ifndef ANDROID_SF_SURFACE_COMPOSER_CLIENT_H
+#define ANDROID_SF_SURFACE_COMPOSER_CLIENT_H
#include <stdint.h>
#include <sys/types.h>
@@ -27,17 +27,18 @@
#include <utils/threads.h>
#include <ui/PixelFormat.h>
-#include <ui/ISurfaceComposer.h>
#include <ui/Region.h>
-#include <ui/Surface.h>
+
+#include <surfaceflinger/Surface.h>
namespace android {
// ---------------------------------------------------------------------------
class Region;
-class SurfaceFlingerSynchro;
class SharedClient;
+class ISurfaceComposer;
+class DisplayInfo;
class SurfaceComposerClient : virtual public RefBase
{
@@ -64,6 +65,7 @@ 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
uint32_t h, // height in pixel
@@ -71,6 +73,16 @@ public:
uint32_t flags = 0 // usage flags
);
+ 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
+ PixelFormat format, // pixel-format desired
+ uint32_t flags = 0 // usage flags
+ );
+
+
// ------------------------------------------------------------------------
// Composer parameters
// All composer parameters must be changed within a transaction
@@ -158,5 +170,5 @@ private:
}; // namespace android
-#endif // ANDROID_SURFACE_COMPOSER_CLIENT_H
+#endif // ANDROID_SF_SURFACE_COMPOSER_CLIENT_H
diff --git a/include/tts/TtsEngine.h b/include/tts/TtsEngine.h
index 28b0d2f..998e353 100644
--- a/include/tts/TtsEngine.h
+++ b/include/tts/TtsEngine.h
@@ -26,6 +26,12 @@
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
@@ -85,7 +91,7 @@ public:
// 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);
+ 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
@@ -122,7 +128,7 @@ public:
// @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
@@ -220,19 +226,6 @@ public:
virtual tts_result synthesizeText(const char *text, int8_t *buffer,
size_t bufferSize, void *userdata);
- // Synthesize IPA 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 IPA data.
- // @param ipa the IPA data 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_FEATURE_UNSUPPORTED if IPA is not supported,
- // otherwise TTS_SUCCESS or TTS_FAILURE
- virtual tts_result synthesizeIpa(const char *ipa, int8_t *buffer,
- size_t bufferSize, void *userdata);
};
} // namespace android
diff --git a/include/ui/Camera.h b/include/ui/Camera.h
deleted file mode 100644
index 5219772..0000000
--- a/include/ui/Camera.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * Copyright (C) 2008 HTC 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_HARDWARE_CAMERA_H
-#define ANDROID_HARDWARE_CAMERA_H
-
-#include <utils/Timers.h>
-#include <ui/ICameraClient.h>
-
-namespace android {
-
-/*
- * A set of bit masks for specifying how the received preview frames are
- * handled before the previewCallback() call.
- *
- * The least significant 3 bits of an "int" value are used for this purpose:
- *
- * ..... 0 0 0
- * ^ ^ ^
- * | | |---------> determine whether the callback is enabled or not
- * | |-----------> determine whether the callback is one-shot or not
- * |-------------> determine whether the frame is copied out or not
- *
- * WARNING:
- * When a frame is sent directly without copying, it is the frame receiver's
- * responsiblity to make sure that the frame data won't get corrupted by
- * subsequent preview frames filled by the camera. This flag is recommended
- * only when copying out data brings significant performance price and the
- * handling/processing of the received frame data is always faster than
- * the preview frame rate so that data corruption won't occur.
- *
- * For instance,
- * 1. 0x00 disables the callback. In this case, copy out and one shot bits
- * are ignored.
- * 2. 0x01 enables a callback without copying out the received frames. A
- * typical use case is the Camcorder application to avoid making costly
- * frame copies.
- * 3. 0x05 is enabling a callback with frame copied out repeatedly. A typical
- * use case is the Camera application.
- * 4. 0x07 is enabling a callback with frame copied out only once. A typical use
- * case is the Barcode scanner application.
- */
-#define FRAME_CALLBACK_FLAG_ENABLE_MASK 0x01
-#define FRAME_CALLBACK_FLAG_ONE_SHOT_MASK 0x02
-#define FRAME_CALLBACK_FLAG_COPY_OUT_MASK 0x04
-
-// Typical use cases
-#define FRAME_CALLBACK_FLAG_NOOP 0x00
-#define FRAME_CALLBACK_FLAG_CAMCORDER 0x01
-#define FRAME_CALLBACK_FLAG_CAMERA 0x05
-#define FRAME_CALLBACK_FLAG_BARCODE_SCANNER 0x07
-
-// msgType in notifyCallback and dataCallback functions
-enum {
- CAMERA_MSG_ERROR = 0x001,
- CAMERA_MSG_SHUTTER = 0x002,
- CAMERA_MSG_FOCUS = 0x004,
- CAMERA_MSG_ZOOM = 0x008,
- CAMERA_MSG_PREVIEW_FRAME = 0x010,
- CAMERA_MSG_VIDEO_FRAME = 0x020,
- CAMERA_MSG_POSTVIEW_FRAME = 0x040,
- CAMERA_MSG_RAW_IMAGE = 0x080,
- CAMERA_MSG_COMPRESSED_IMAGE = 0x100,
- CAMERA_MSG_ALL_MSGS = 0x1FF
-};
-
-// cmdType in sendCommand functions
-enum {
- CAMERA_CMD_START_SMOOTH_ZOOM = 1,
- CAMERA_CMD_STOP_SMOOTH_ZOOM = 2,
-};
-
-// camera fatal errors
-enum {
- CAMERA_ERROR_UKNOWN = 1,
- CAMERA_ERROR_SERVER_DIED = 100
-};
-
-class ICameraService;
-class ICamera;
-class Surface;
-class Mutex;
-class String8;
-
-// ref-counted object for callbacks
-class CameraListener: virtual public RefBase
-{
-public:
- virtual void notify(int32_t msgType, int32_t ext1, int32_t ext2) = 0;
- virtual void postData(int32_t msgType, const sp<IMemory>& dataPtr) = 0;
- virtual void postDataTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& dataPtr) = 0;
-};
-
-class Camera : public BnCameraClient, public IBinder::DeathRecipient
-{
-public:
- // construct a camera client from an existing remote
- static sp<Camera> create(const sp<ICamera>& camera);
- static sp<Camera> connect();
- ~Camera();
- void init();
-
- status_t reconnect();
- void disconnect();
- status_t lock();
- status_t unlock();
-
- status_t getStatus() { return mStatus; }
-
- // pass the buffered ISurface to the camera service
- status_t setPreviewDisplay(const sp<Surface>& surface);
- status_t setPreviewDisplay(const sp<ISurface>& surface);
-
- // start preview mode, must call setPreviewDisplay first
- status_t startPreview();
-
- // stop preview mode
- void stopPreview();
-
- // get preview state
- bool previewEnabled();
-
- // start recording mode, must call setPreviewDisplay first
- status_t startRecording();
-
- // stop recording mode
- void stopRecording();
-
- // get recording state
- bool recordingEnabled();
-
- // release a recording frame
- void releaseRecordingFrame(const sp<IMemory>& mem);
-
- // autoFocus - status returned from callback
- status_t autoFocus();
-
- // cancel auto focus
- status_t cancelAutoFocus();
-
- // take a picture - picture returned from callback
- status_t takePicture();
-
- // set preview/capture parameters - key/value pairs
- status_t setParameters(const String8& params);
-
- // get preview/capture parameters - key/value pairs
- String8 getParameters() const;
-
- // send command to camera driver
- status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2);
-
- void setListener(const sp<CameraListener>& listener);
- void setPreviewCallbackFlags(int preview_callback_flag);
-
- // ICameraClient interface
- virtual void notifyCallback(int32_t msgType, int32_t ext, int32_t ext2);
- virtual void dataCallback(int32_t msgType, const sp<IMemory>& dataPtr);
- virtual void dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& dataPtr);
-
- sp<ICamera> remote();
-
-private:
- Camera();
- Camera(const Camera&);
- Camera& operator=(const Camera);
- virtual void binderDied(const wp<IBinder>& who);
-
- class DeathNotifier: public IBinder::DeathRecipient
- {
- public:
- DeathNotifier() {
- }
-
- virtual void binderDied(const wp<IBinder>& who);
- };
-
- static sp<DeathNotifier> mDeathNotifier;
-
- // helper function to obtain camera service handle
- static const sp<ICameraService>& getCameraService();
-
- sp<ICamera> mCamera;
- status_t mStatus;
-
- sp<CameraListener> mListener;
-
- friend class DeathNotifier;
-
- static Mutex mLock;
- static sp<ICameraService> mCameraService;
-
-};
-
-}; // namespace android
-
-#endif
-
diff --git a/include/ui/CameraHardwareInterface.h b/include/ui/CameraHardwareInterface.h
deleted file mode 100644
index 240c134..0000000
--- a/include/ui/CameraHardwareInterface.h
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright (C) 2008 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_HARDWARE_CAMERA_HARDWARE_INTERFACE_H
-#define ANDROID_HARDWARE_CAMERA_HARDWARE_INTERFACE_H
-
-#include <binder/IMemory.h>
-#include <utils/RefBase.h>
-#include <ui/ISurface.h>
-#include <ui/Camera.h>
-#include <ui/CameraParameters.h>
-#include <ui/Overlay.h>
-
-namespace android {
-/**
- * The size of image for display.
- */
-typedef struct image_rect_struct
-{
- uint32_t width; /* Image width */
- uint32_t height; /* Image height */
-} image_rect_type;
-
-
-typedef void (*notify_callback)(int32_t msgType,
- int32_t ext1,
- int32_t ext2,
- void* user);
-
-typedef void (*data_callback)(int32_t msgType,
- const sp<IMemory>& dataPtr,
- void* user);
-
-typedef void (*data_callback_timestamp)(nsecs_t timestamp,
- int32_t msgType,
- const sp<IMemory>& dataPtr,
- void* user);
-
-/**
- * CameraHardwareInterface.h defines the interface to the
- * camera hardware abstraction layer, used for setting and getting
- * parameters, live previewing, and taking pictures.
- *
- * It is a referenced counted interface with RefBase as its base class.
- * CameraService calls openCameraHardware() to retrieve a strong pointer to the
- * instance of this interface and may be called multiple times. The
- * following steps describe a typical sequence:
- *
- * -# After CameraService calls openCameraHardware(), getParameters() and
- * setParameters() are used to initialize the camera instance.
- * CameraService calls getPreviewHeap() to establish access to the
- * preview heap so it can be registered with SurfaceFlinger for
- * efficient display updating while in preview mode.
- * -# startPreview() is called. The camera instance then periodically
- * sends the message CAMERA_MSG_PREVIEW_FRAME (if enabled) each time
- * a new preview frame is available. If data callback code needs to use
- * this memory after returning, it must copy the data.
- *
- * Prior to taking a picture, CameraService calls autofocus(). When auto
- * focusing has completed, the camera instance sends a CAMERA_MSG_FOCUS notification,
- * which informs the application whether focusing was successful. The camera instance
- * only sends this message once and it is up to the application to call autoFocus()
- * again if refocusing is desired.
- *
- * CameraService calls takePicture() to request the camera instance take a
- * picture. At this point, if a shutter, postview, raw, and/or compressed callback
- * is desired, the corresponding message must be enabled. As with CAMERA_MSG_PREVIEW_FRAME,
- * any memory provided in a data callback must be copied if it's needed after returning.
- */
-class CameraHardwareInterface : public virtual RefBase {
-public:
- virtual ~CameraHardwareInterface() { }
-
- /** Return the IMemoryHeap for the preview image heap */
- virtual sp<IMemoryHeap> getPreviewHeap() const = 0;
-
- /** Return the IMemoryHeap for the raw image heap */
- virtual sp<IMemoryHeap> getRawHeap() const = 0;
-
- /** Set the notification and data callbacks */
- virtual void setCallbacks(notify_callback notify_cb,
- data_callback data_cb,
- data_callback_timestamp data_cb_timestamp,
- void* user) = 0;
-
- /**
- * The following three functions all take a msgtype,
- * which is a bitmask of the messages defined in
- * include/ui/Camera.h
- */
-
- /**
- * Enable a message, or set of messages.
- */
- virtual void enableMsgType(int32_t msgType) = 0;
-
- /**
- * Disable a message, or a set of messages.
- */
- virtual void disableMsgType(int32_t msgType) = 0;
-
- /**
- * Query whether a message, or a set of messages, is enabled.
- * Note that this is operates as an AND, if any of the messages
- * queried are off, this will return false.
- */
- virtual bool msgTypeEnabled(int32_t msgType) = 0;
-
- /**
- * Start preview mode.
- */
- virtual status_t startPreview() = 0;
-
- /**
- * Only used if overlays are used for camera preview.
- */
- virtual bool useOverlay() {return false;}
- virtual status_t setOverlay(const sp<Overlay> &overlay) {return BAD_VALUE;}
-
- /**
- * Stop a previously started preview.
- */
- virtual void stopPreview() = 0;
-
- /**
- * Returns true if preview is enabled.
- */
- virtual bool previewEnabled() = 0;
-
- /**
- * Start record mode. When a record image is available a CAMERA_MSG_VIDEO_FRAME
- * message is sent with the corresponding frame. Every record frame must be released
- * by calling releaseRecordingFrame().
- */
- virtual status_t startRecording() = 0;
-
- /**
- * Stop a previously started recording.
- */
- virtual void stopRecording() = 0;
-
- /**
- * Returns true if recording is enabled.
- */
- virtual bool recordingEnabled() = 0;
-
- /**
- * Release a record frame previously returned by CAMERA_MSG_VIDEO_FRAME.
- */
- virtual void releaseRecordingFrame(const sp<IMemory>& mem) = 0;
-
- /**
- * Start auto focus, the notification callback routine is called
- * with CAMERA_MSG_FOCUS once when focusing is complete. autoFocus()
- * will be called again if another auto focus is needed.
- */
- virtual status_t autoFocus() = 0;
-
- /**
- * Cancels auto-focus function. If the auto-focus is still in progress,
- * this function will cancel it. Whether the auto-focus is in progress
- * or not, this function will return the focus position to the default.
- * If the camera does not support auto-focus, this is a no-op.
- */
- virtual status_t cancelAutoFocus() = 0;
-
- /**
- * Take a picture.
- */
- virtual status_t takePicture() = 0;
-
- /**
- * Cancel a picture that was started with takePicture. Calling this
- * method when no picture is being taken is a no-op.
- */
- virtual status_t cancelPicture() = 0;
-
- /** Set the camera parameters. */
- virtual status_t setParameters(const CameraParameters& params) = 0;
-
- /** Return the camera parameters. */
- virtual CameraParameters getParameters() const = 0;
-
- /**
- * Send command to camera driver.
- */
- virtual status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) = 0;
-
- /**
- * Release the hardware resources owned by this object. Note that this is
- * *not* done in the destructor.
- */
- virtual void release() = 0;
-
- /**
- * Dump state of the camera hardware
- */
- virtual status_t dump(int fd, const Vector<String16>& args) const = 0;
-};
-
-/** factory function to instantiate a camera hardware object */
-extern "C" sp<CameraHardwareInterface> openCameraHardware();
-
-}; // namespace android
-
-#endif
diff --git a/include/ui/CameraParameters.h b/include/ui/CameraParameters.h
deleted file mode 100644
index 9e4e140..0000000
--- a/include/ui/CameraParameters.h
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * Copyright (C) 2008 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_HARDWARE_CAMERA_PARAMETERS_H
-#define ANDROID_HARDWARE_CAMERA_PARAMETERS_H
-
-#include <utils/KeyedVector.h>
-#include <utils/String8.h>
-
-namespace android {
-
-class CameraParameters
-{
-public:
- CameraParameters();
- CameraParameters(const String8 &params) { unflatten(params); }
- ~CameraParameters();
-
- enum {
- CAMERA_ORIENTATION_UNKNOWN = 0,
- CAMERA_ORIENTATION_PORTRAIT = 1,
- CAMERA_ORIENTATION_LANDSCAPE = 2,
- };
-
- String8 flatten() const;
- void unflatten(const String8 &params);
-
- void set(const char *key, const char *value);
- void set(const char *key, int value);
- const char *get(const char *key) const;
- int getInt(const char *key) const;
-
- /* preview-size=176x144 */
- void setPreviewSize(int width, int height);
- void getPreviewSize(int *width, int *height) const;
-
- /* preview-fps=15 */
- void setPreviewFrameRate(int fps);
- int getPreviewFrameRate() const;
-
- /* preview-format=rgb565|yuv422 */
- void setPreviewFormat(const char *format);
- const char *getPreviewFormat() const;
-
- /* picture-size=1024x768 */
- void setPictureSize(int width, int height);
- void getPictureSize(int *width, int *height) const;
-
- /* picture-format=yuv422|jpeg */
- void setPictureFormat(const char *format);
- const char *getPictureFormat() const;
-
- int getOrientation() const;
- void setOrientation(int orientation);
-
- void dump() const;
- status_t dump(int fd, const Vector<String16>& args) const;
-
- // Parameter keys to communicate between camera application and driver.
- // The access (read/write, read only, or write only) is viewed from the
- // perspective of applications, not driver.
-
- // Preview frame size in pixels (width x height).
- // Example value: "480x320". Read/Write.
- static const char KEY_PREVIEW_SIZE[];
- // Supported preview frame sizes in pixels.
- // Example value: "800x600,480x320". Read only.
- static const char KEY_SUPPORTED_PREVIEW_SIZES[];
- // The image format for preview frames.
- // Example value: "yuv420sp" or PIXEL_FORMAT_XXX constants. Read/write.
- static const char KEY_PREVIEW_FORMAT[];
- // Supported image formats for preview frames.
- // Example value: "yuv420sp,yuv422i-yuyv". Read only.
- static const char KEY_SUPPORTED_PREVIEW_FORMATS[];
- // Number of preview frames per second.
- // Example value: "15". Read/write.
- static const char KEY_PREVIEW_FRAME_RATE[];
- // Supported number of preview frames per second.
- // Example value: "24,15,10". Read.
- static const char KEY_SUPPORTED_PREVIEW_FRAME_RATES[];
- // The dimensions for captured pictures in pixels (width x height).
- // Example value: "1024x768". Read/write.
- static const char KEY_PICTURE_SIZE[];
- // Supported dimensions for captured pictures in pixels.
- // Example value: "2048x1536,1024x768". Read only.
- static const char KEY_SUPPORTED_PICTURE_SIZES[];
- // The image format for captured pictures.
- // Example value: "jpeg" or PIXEL_FORMAT_XXX constants. Read/write.
- static const char KEY_PICTURE_FORMAT[];
- // Supported image formats for captured pictures.
- // Example value: "jpeg,rgb565". Read only.
- static const char KEY_SUPPORTED_PICTURE_FORMATS[];
- // The width (in pixels) of EXIF thumbnail in Jpeg picture.
- // Example value: "512". Read/write.
- static const char KEY_JPEG_THUMBNAIL_WIDTH[];
- // The height (in pixels) of EXIF thumbnail in Jpeg picture.
- // Example value: "384". Read/write.
- static const char KEY_JPEG_THUMBNAIL_HEIGHT[];
- // Supported EXIF thumbnail sizes (width x height).
- // Example value: "512x384,320x240". Read only.
- static const char KEY_SUPPORTED_THUMBNAIL_SIZES[];
- // The quality of the EXIF thumbnail in Jpeg picture. The range is 1 to 100,
- // with 100 being the best.
- // Example value: "90". Read/write.
- static const char KEY_JPEG_THUMBNAIL_QUALITY[];
- // Jpeg quality of captured picture. The range is 1 to 100, with 100 being
- // the best.
- // Example value: "90". Read/write.
- static const char KEY_JPEG_QUALITY[];
- // The orientation of the device in degrees. For example, suppose the
- // natural position of the device is landscape. If the user takes a picture
- // in landscape mode in 2048x1536 resolution, the rotation will be set to
- // "0". If the user rotates the phone 90 degrees clockwise, the rotation
- // should be set to "90".
- // The camera driver can set orientation in the EXIF header without rotating
- // the picture. Or the driver can rotate the picture and the EXIF thumbnail.
- // If the Jpeg picture is rotated, the orientation in the EXIF header should
- // be missing or 1 (row #0 is top and column #0 is left side). The driver
- // should not set default value for this parameter.
- // Example value: "0" or "90" or "180" or "270". Write only.
- static const char KEY_ROTATION[];
- // GPS latitude coordinate. This will be stored in JPEG EXIF header.
- // Example value: "25.032146". Write only.
- static const char KEY_GPS_LATITUDE[];
- // GPS longitude coordinate. This will be stored in JPEG EXIF header.
- // Example value: "121.564448". Write only.
- static const char KEY_GPS_LONGITUDE[];
- // GPS altitude. This will be stored in JPEG EXIF header.
- // Example value: "21.0". Write only.
- static const char KEY_GPS_ALTITUDE[];
- // GPS timestamp (UTC in seconds since January 1, 1970). This should be
- // stored in JPEG EXIF header.
- // Example value: "1251192757". Write only.
- static const char KEY_GPS_TIMESTAMP[];
- // Current white balance setting.
- // Example value: "auto" or WHITE_BALANCE_XXX constants. Read/write.
- static const char KEY_WHITE_BALANCE[];
- // Supported white balance settings.
- // Example value: "auto,incandescent,daylight". Read only.
- static const char KEY_SUPPORTED_WHITE_BALANCE[];
- // Current color effect setting.
- // Example value: "none" or EFFECT_XXX constants. Read/write.
- static const char KEY_EFFECT[];
- // Supported color effect settings.
- // Example value: "none,mono,sepia". Read only.
- static const char KEY_SUPPORTED_EFFECTS[];
- // Current antibanding setting.
- // Example value: "auto" or ANTIBANDING_XXX constants. Read/write.
- static const char KEY_ANTIBANDING[];
- // Supported antibanding settings.
- // Example value: "auto,50hz,60hz,off". Read only.
- static const char KEY_SUPPORTED_ANTIBANDING[];
- // Current scene mode.
- // Example value: "auto" or SCENE_MODE_XXX constants. Read/write.
- static const char KEY_SCENE_MODE[];
- // Supported scene mode settings.
- // Example value: "auto,night,fireworks". Read only.
- static const char KEY_SUPPORTED_SCENE_MODES[];
- // Current flash mode.
- // Example value: "auto" or FLASH_MODE_XXX constants. Read/write.
- static const char KEY_FLASH_MODE[];
- // Supported flash modes.
- // Example value: "auto,on,off". Read only.
- static const char KEY_SUPPORTED_FLASH_MODES[];
- // Current focus mode. If the camera does not support auto-focus, the value
- // should be FOCUS_MODE_FIXED. If the focus mode is not FOCUS_MODE_FIXED or
- // or FOCUS_MODE_INFINITY, applications should call
- // CameraHardwareInterface.autoFocus to start the focus.
- // Example value: "auto" or FOCUS_MODE_XXX constants. Read/write.
- static const char KEY_FOCUS_MODE[];
- // Supported focus modes.
- // Example value: "auto,macro,fixed". Read only.
- static const char KEY_SUPPORTED_FOCUS_MODES[];
-
- // Values for white balance settings.
- static const char WHITE_BALANCE_AUTO[];
- static const char WHITE_BALANCE_INCANDESCENT[];
- static const char WHITE_BALANCE_FLUORESCENT[];
- static const char WHITE_BALANCE_WARM_FLUORESCENT[];
- static const char WHITE_BALANCE_DAYLIGHT[];
- static const char WHITE_BALANCE_CLOUDY_DAYLIGHT[];
- static const char WHITE_BALANCE_TWILIGHT[];
- static const char WHITE_BALANCE_SHADE[];
-
- // Values for effect settings.
- static const char EFFECT_NONE[];
- static const char EFFECT_MONO[];
- static const char EFFECT_NEGATIVE[];
- static const char EFFECT_SOLARIZE[];
- static const char EFFECT_SEPIA[];
- static const char EFFECT_POSTERIZE[];
- static const char EFFECT_WHITEBOARD[];
- static const char EFFECT_BLACKBOARD[];
- static const char EFFECT_AQUA[];
-
- // Values for antibanding settings.
- static const char ANTIBANDING_AUTO[];
- static const char ANTIBANDING_50HZ[];
- static const char ANTIBANDING_60HZ[];
- static const char ANTIBANDING_OFF[];
-
- // Values for flash mode settings.
- // Flash will not be fired.
- static const char FLASH_MODE_OFF[];
- // Flash will be fired automatically when required. The flash may be fired
- // during preview, auto-focus, or snapshot depending on the driver.
- static const char FLASH_MODE_AUTO[];
- // Flash will always be fired during snapshot. The flash may also be
- // fired during preview or auto-focus depending on the driver.
- static const char FLASH_MODE_ON[];
- // Flash will be fired in red-eye reduction mode.
- static const char FLASH_MODE_RED_EYE[];
- // Constant emission of light during preview, auto-focus and snapshot.
- // This can also be used for video recording.
- static const char FLASH_MODE_TORCH[];
-
- // Values for scene mode settings.
- static const char SCENE_MODE_AUTO[];
- static const char SCENE_MODE_ACTION[];
- static const char SCENE_MODE_PORTRAIT[];
- static const char SCENE_MODE_LANDSCAPE[];
- static const char SCENE_MODE_NIGHT[];
- static const char SCENE_MODE_NIGHT_PORTRAIT[];
- static const char SCENE_MODE_THEATRE[];
- static const char SCENE_MODE_BEACH[];
- static const char SCENE_MODE_SNOW[];
- static const char SCENE_MODE_SUNSET[];
- static const char SCENE_MODE_STEADYPHOTO[];
- static const char SCENE_MODE_FIREWORKS[];
- static const char SCENE_MODE_SPORTS[];
- static const char SCENE_MODE_PARTY[];
- static const char SCENE_MODE_CANDLELIGHT[];
-
- // Formats for setPreviewFormat and setPictureFormat.
- static const char PIXEL_FORMAT_YUV422SP[];
- static const char PIXEL_FORMAT_YUV420SP[]; // NV21
- static const char PIXEL_FORMAT_YUV422I[]; // YUY2
- static const char PIXEL_FORMAT_RGB565[];
- static const char PIXEL_FORMAT_JPEG[];
-
- // Values for focus mode settings.
- // Auto-focus mode.
- static const char FOCUS_MODE_AUTO[];
- // Focus is set at infinity. Applications should not call
- // CameraHardwareInterface.autoFocus in this mode.
- static const char FOCUS_MODE_INFINITY[];
- static const char FOCUS_MODE_MACRO[];
- // Focus is fixed. The camera is always in this mode if the focus is not
- // adjustable. If the camera has auto-focus, this mode can fix the
- // focus, which is usually at hyperfocal distance. Applications should
- // not call CameraHardwareInterface.autoFocus in this mode.
- static const char FOCUS_MODE_FIXED[];
-
-private:
- DefaultKeyedVector<String8,String8> mMap;
-};
-
-}; // namespace android
-
-#endif
diff --git a/include/ui/GraphicBuffer.h b/include/ui/GraphicBuffer.h
index b9c491b..e72b6b3 100644
--- a/include/ui/GraphicBuffer.h
+++ b/include/ui/GraphicBuffer.h
@@ -23,6 +23,7 @@
#include <ui/android_native_buffer.h>
#include <ui/PixelFormat.h>
#include <ui/Rect.h>
+#include <utils/Flattenable.h>
#include <pixelflinger/pixelflinger.h>
struct android_native_buffer_t;
@@ -30,7 +31,6 @@ struct android_native_buffer_t;
namespace android {
class GraphicBufferMapper;
-class Parcel;
// ===========================================================================
// GraphicBuffer
@@ -40,7 +40,7 @@ class GraphicBuffer
: public EGLNativeBase<
android_native_buffer_t,
GraphicBuffer,
- LightRefBase<GraphicBuffer> >
+ LightRefBase<GraphicBuffer> >, public Flattenable
{
public:
@@ -97,7 +97,6 @@ public:
uint32_t getVerticalStride() const;
protected:
- GraphicBuffer(const Parcel& reply);
virtual ~GraphicBuffer();
enum {
@@ -122,8 +121,16 @@ private:
status_t initSize(uint32_t w, uint32_t h, PixelFormat format,
uint32_t usage);
- static status_t writeToParcel(Parcel* reply,
- android_native_buffer_t const* buffer);
+ void free_handle();
+
+ // Flattenable interface
+ size_t getFlattenedSize() const;
+ size_t getFdCount() const;
+ status_t flatten(void* buffer, size_t size,
+ int fds[], size_t count) const;
+ status_t unflatten(void const* buffer, size_t size,
+ int fds[], size_t count);
+
GraphicBufferMapper& mBufferMapper;
ssize_t mInitCheck;
diff --git a/include/ui/GraphicBufferAllocator.h b/include/ui/GraphicBufferAllocator.h
index be9c79b..741d763 100644
--- a/include/ui/GraphicBufferAllocator.h
+++ b/include/ui/GraphicBufferAllocator.h
@@ -86,7 +86,6 @@ private:
GraphicBufferAllocator();
~GraphicBufferAllocator();
- mutable Mutex mLock;
alloc_device_t *mAllocDev;
};
diff --git a/include/ui/ICamera.h b/include/ui/ICamera.h
deleted file mode 100644
index 5642691..0000000
--- a/include/ui/ICamera.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2008 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_HARDWARE_ICAMERA_H
-#define ANDROID_HARDWARE_ICAMERA_H
-
-#include <utils/RefBase.h>
-#include <binder/IInterface.h>
-#include <binder/Parcel.h>
-#include <ui/ISurface.h>
-#include <binder/IMemory.h>
-#include <utils/String8.h>
-#include <ui/Camera.h>
-
-namespace android {
-
-class ICameraClient;
-
-class ICamera: public IInterface
-{
-public:
- DECLARE_META_INTERFACE(Camera);
-
- virtual void disconnect() = 0;
-
- // connect new client with existing camera remote
- virtual status_t connect(const sp<ICameraClient>& client) = 0;
-
- // prevent other processes from using this ICamera interface
- virtual status_t lock() = 0;
-
- // allow other processes to use this ICamera interface
- virtual status_t unlock() = 0;
-
- // pass the buffered ISurface to the camera service
- virtual status_t setPreviewDisplay(const sp<ISurface>& surface) = 0;
-
- // set the preview callback flag to affect how the received frames from
- // preview are handled.
- virtual void setPreviewCallbackFlag(int flag) = 0;
-
- // start preview mode, must call setPreviewDisplay first
- virtual status_t startPreview() = 0;
-
- // stop preview mode
- virtual void stopPreview() = 0;
-
- // get preview state
- virtual bool previewEnabled() = 0;
-
- // start recording mode
- virtual status_t startRecording() = 0;
-
- // stop recording mode
- virtual void stopRecording() = 0;
-
- // get recording state
- virtual bool recordingEnabled() = 0;
-
- // release a recording frame
- virtual void releaseRecordingFrame(const sp<IMemory>& mem) = 0;
-
- // auto focus
- virtual status_t autoFocus() = 0;
-
- // cancel auto focus
- virtual status_t cancelAutoFocus() = 0;
-
- // take a picture
- virtual status_t takePicture() = 0;
-
- // set preview/capture parameters - key/value pairs
- virtual status_t setParameters(const String8& params) = 0;
-
- // get preview/capture parameters - key/value pairs
- virtual String8 getParameters() const = 0;
-
- // send command to camera driver
- virtual status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) = 0;
-};
-
-// ----------------------------------------------------------------------------
-
-class BnCamera: public BnInterface<ICamera>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-}; // namespace android
-
-#endif
diff --git a/include/ui/ICameraClient.h b/include/ui/ICameraClient.h
deleted file mode 100644
index 236d0f6..0000000
--- a/include/ui/ICameraClient.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2008 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_HARDWARE_ICAMERA_APP_H
-#define ANDROID_HARDWARE_ICAMERA_APP_H
-
-#include <utils/RefBase.h>
-#include <binder/IInterface.h>
-#include <binder/Parcel.h>
-#include <binder/IMemory.h>
-#include <utils/Timers.h>
-
-namespace android {
-
-class ICameraClient: public IInterface
-{
-public:
- DECLARE_META_INTERFACE(CameraClient);
-
- virtual void notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2) = 0;
- virtual void dataCallback(int32_t msgType, const sp<IMemory>& data) = 0;
- virtual void dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& data) = 0;
-};
-
-// ----------------------------------------------------------------------------
-
-class BnCameraClient: public BnInterface<ICameraClient>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-}; // namespace android
-
-#endif
diff --git a/include/ui/ICameraService.h b/include/ui/ICameraService.h
deleted file mode 100644
index 061681a..0000000
--- a/include/ui/ICameraService.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2008 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_HARDWARE_ICAMERASERVICE_H
-#define ANDROID_HARDWARE_ICAMERASERVICE_H
-
-#include <utils/RefBase.h>
-#include <binder/IInterface.h>
-#include <binder/Parcel.h>
-
-#include <ui/ICameraClient.h>
-#include <ui/ICamera.h>
-
-namespace android {
-
-class ICameraService : public IInterface
-{
-public:
- enum {
- CONNECT = IBinder::FIRST_CALL_TRANSACTION,
- };
-
-public:
- DECLARE_META_INTERFACE(CameraService);
-
- virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient) = 0;
-};
-
-// ----------------------------------------------------------------------------
-
-class BnCameraService: public BnInterface<ICameraService>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-}; // namespace android
-
-#endif
diff --git a/include/ui/PixelFormat.h b/include/ui/PixelFormat.h
index 6d87321b..f46f25c 100644
--- a/include/ui/PixelFormat.h
+++ b/include/ui/PixelFormat.h
@@ -30,6 +30,7 @@
#include <sys/types.h>
#include <utils/Errors.h>
#include <pixelflinger/format.h>
+#include <hardware/hardware.h>
namespace android {
@@ -57,25 +58,18 @@ enum {
// real pixel formats supported for rendering -----------------------------
- PIXEL_FORMAT_RGBA_8888 = GGL_PIXEL_FORMAT_RGBA_8888, // 4x8-bit RGBA
- PIXEL_FORMAT_RGBX_8888 = GGL_PIXEL_FORMAT_RGBX_8888, // 4x8-bit RGB0
- PIXEL_FORMAT_RGB_888 = GGL_PIXEL_FORMAT_RGB_888, // 3x8-bit RGB
- PIXEL_FORMAT_RGB_565 = GGL_PIXEL_FORMAT_RGB_565, // 16-bit RGB
- PIXEL_FORMAT_BGRA_8888 = GGL_PIXEL_FORMAT_BGRA_8888, // 4x8-bit BGRA
- PIXEL_FORMAT_RGBA_5551 = GGL_PIXEL_FORMAT_RGBA_5551, // 16-bit ARGB
- PIXEL_FORMAT_RGBA_4444 = GGL_PIXEL_FORMAT_RGBA_4444, // 16-bit ARGB
+ PIXEL_FORMAT_RGBA_8888 = HAL_PIXEL_FORMAT_RGBA_8888, // 4x8-bit RGBA
+ PIXEL_FORMAT_RGBX_8888 = HAL_PIXEL_FORMAT_RGBX_8888, // 4x8-bit RGB0
+ PIXEL_FORMAT_RGB_888 = HAL_PIXEL_FORMAT_RGB_888, // 3x8-bit RGB
+ PIXEL_FORMAT_RGB_565 = HAL_PIXEL_FORMAT_RGB_565, // 16-bit RGB
+ PIXEL_FORMAT_BGRA_8888 = HAL_PIXEL_FORMAT_BGRA_8888, // 4x8-bit BGRA
+ PIXEL_FORMAT_RGBA_5551 = HAL_PIXEL_FORMAT_RGBA_5551, // 16-bit ARGB
+ PIXEL_FORMAT_RGBA_4444 = HAL_PIXEL_FORMAT_RGBA_4444, // 16-bit ARGB
PIXEL_FORMAT_A_8 = GGL_PIXEL_FORMAT_A_8, // 8-bit A
PIXEL_FORMAT_L_8 = GGL_PIXEL_FORMAT_L_8, // 8-bit L (R=G=B=L)
PIXEL_FORMAT_LA_88 = GGL_PIXEL_FORMAT_LA_88, // 16-bit LA
PIXEL_FORMAT_RGB_332 = GGL_PIXEL_FORMAT_RGB_332, // 8-bit RGB
- PIXEL_FORMAT_YCbCr_422_SP= GGL_PIXEL_FORMAT_YCbCr_422_SP,
- PIXEL_FORMAT_YCbCr_420_SP= GGL_PIXEL_FORMAT_YCbCr_420_SP,
- PIXEL_FORMAT_YCbCr_422_P = GGL_PIXEL_FORMAT_YCbCr_422_P,
- PIXEL_FORMAT_YCbCr_420_P = GGL_PIXEL_FORMAT_YCbCr_420_P,
- PIXEL_FORMAT_YCbCr_422_I = GGL_PIXEL_FORMAT_YCbCr_422_I,
- PIXEL_FORMAT_YCbCr_420_I = GGL_PIXEL_FORMAT_YCbCr_420_I,
-
// New formats can be added if they're also defined in
// pixelflinger/format.h
};
@@ -97,9 +91,7 @@ struct PixelFormatInfo
RGBA = 3,
LUMINANCE = 4,
LUMINANCE_ALPHA = 5,
- Y_CB_CR_SP = 6,
- Y_CB_CR_P = 7,
- Y_CB_CR_I = 8,
+ OTHER = 0xFF
};
struct szinfo {
diff --git a/include/ui/Region.h b/include/ui/Region.h
index 2bcad5b..925fd06 100644
--- a/include/ui/Region.h
+++ b/include/ui/Region.h
@@ -21,7 +21,6 @@
#include <sys/types.h>
#include <utils/Vector.h>
-#include <binder/Parcel.h>
#include <ui/Rect.h>
@@ -39,7 +38,6 @@ public:
Region();
Region(const Region& rhs);
explicit Region(const Rect& rhs);
- explicit Region(const Parcel& parcel);
explicit Region(const void* buffer);
~Region();
@@ -118,10 +116,6 @@ public:
// be sorted in Y and X and must not make the region invalid.
void addRectUnchecked(int l, int t, int r, int b);
- // flatten/unflatten a region to/from a Parcel
- status_t write(Parcel& parcel) const;
- status_t read(const Parcel& parcel);
-
// flatten/unflatten a region to/from a raw buffer
ssize_t write(void* buffer, size_t size) const;
static ssize_t writeEmpty(void* buffer, size_t size);
diff --git a/include/ui/egl/android_natives.h b/include/ui/egl/android_natives.h
index 3740db5..773fd93 100644
--- a/include/ui/egl/android_natives.h
+++ b/include/ui/egl/android_natives.h
@@ -69,7 +69,14 @@ enum {
/* valid operations for the (*perform)() hook */
enum {
- NATIVE_WINDOW_SET_USAGE = 0
+ NATIVE_WINDOW_SET_USAGE = 0,
+ NATIVE_WINDOW_CONNECT = 1,
+ NATIVE_WINDOW_DISCONNECT = 2
+};
+
+/* parameter for NATIVE_WINDOW_[DIS]CONNECT */
+enum {
+ NATIVE_WINDOW_API_EGL = 1
};
typedef struct android_native_window_t
@@ -157,8 +164,13 @@ typedef struct android_native_window_t
* This hook should not be called directly, instead use the helper functions
* defined below.
*
+ * (*perform)() returns -ENOENT if the 'what' parameter is not supported
+ * by the surface's implementation.
+ *
* The valid operations are:
* NATIVE_WINDOW_SET_USAGE
+ * NATIVE_WINDOW_CONNECT
+ * NATIVE_WINDOW_DISCONNECT
*
*/
@@ -185,6 +197,30 @@ static inline int native_window_set_usage(
return window->perform(window, NATIVE_WINDOW_SET_USAGE, usage);
}
+/*
+ * native_window_connect(..., NATIVE_WINDOW_API_EGL) must be called
+ * by EGL when the window is made current.
+ * Returns -EINVAL if for some reason the window cannot be connected, which
+ * can happen if it's connected to some other API.
+ */
+static inline int native_window_connect(
+ android_native_window_t* window, int api)
+{
+ return window->perform(window, NATIVE_WINDOW_CONNECT, api);
+}
+
+/*
+ * native_window_disconnect(..., NATIVE_WINDOW_API_EGL) must be called
+ * by EGL when the window is made not current.
+ * An error is returned if for instance the window wasn't connected in the
+ * first place.
+ */
+static inline int native_window_disconnect(
+ android_native_window_t* window, int api)
+{
+ return window->perform(window, NATIVE_WINDOW_DISCONNECT, api);
+}
+
// ---------------------------------------------------------------------------
diff --git a/include/utils/AndroidUnicode.h b/include/utils/AndroidUnicode.h
deleted file mode 100644
index 563fcd0..0000000
--- a/include/utils/AndroidUnicode.h
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Copyright (C) 2006 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_UNICODE_H
-#define ANDROID_UNICODE_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#define REPLACEMENT_CHAR (0xFFFD)
-
-// this part of code is copied from umachine.h under ICU
-/**
- * Define UChar32 as a type for single Unicode code points.
- * UChar32 is a signed 32-bit integer (same as int32_t).
- *
- * The Unicode code point range is 0..0x10ffff.
- * All other values (negative or >=0x110000) are illegal as Unicode code points.
- * They may be used as sentinel values to indicate "done", "error"
- * or similar non-code point conditions.
- *
- * @stable ICU 2.4
- */
-typedef int32_t UChar32;
-
-namespace android {
-
- class Encoding;
- /**
- * \class Unicode
- *
- * Helper class for getting properties of Unicode characters. Characters
- * can have one of the types listed in CharType and each character can have the
- * directionality of Direction.
- */
- class Unicode
- {
- public:
- /**
- * Directions specified in the Unicode standard. These directions map directly
- * to java.lang.Character.
- */
- enum Direction {
- DIRECTIONALITY_UNDEFINED = -1,
- DIRECTIONALITY_LEFT_TO_RIGHT,
- DIRECTIONALITY_RIGHT_TO_LEFT,
- DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC,
- DIRECTIONALITY_EUROPEAN_NUMBER,
- DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR,
- DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR,
- DIRECTIONALITY_ARABIC_NUMBER,
- DIRECTIONALITY_COMMON_NUMBER_SEPARATOR,
- DIRECTIONALITY_NONSPACING_MARK,
- DIRECTIONALITY_BOUNDARY_NEUTRAL,
- DIRECTIONALITY_PARAGRAPH_SEPARATOR,
- DIRECTIONALITY_SEGMENT_SEPARATOR,
- DIRECTIONALITY_WHITESPACE,
- DIRECTIONALITY_OTHER_NEUTRALS,
- DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING,
- DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE,
- DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING,
- DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE,
- DIRECTIONALITY_POP_DIRECTIONAL_FORMAT
- };
-
- /**
- * Character types as specified in the Unicode standard. These map directly to
- * java.lang.Character.
- */
- enum CharType {
- CHARTYPE_UNASSIGNED = 0,
- CHARTYPE_UPPERCASE_LETTER,
- CHARTYPE_LOWERCASE_LETTER,
- CHARTYPE_TITLECASE_LETTER,
- CHARTYPE_MODIFIER_LETTER,
- CHARTYPE_OTHER_LETTER,
- CHARTYPE_NON_SPACING_MARK,
- CHARTYPE_ENCLOSING_MARK,
- CHARTYPE_COMBINING_SPACING_MARK,
- CHARTYPE_DECIMAL_DIGIT_NUMBER,
- CHARTYPE_LETTER_NUMBER,
- CHARTYPE_OTHER_NUMBER,
- CHARTYPE_SPACE_SEPARATOR,
- CHARTYPE_LINE_SEPARATOR,
- CHARTYPE_PARAGRAPH_SEPARATOR,
- CHARTYPE_CONTROL,
- CHARTYPE_FORMAT,
- CHARTYPE_MISSING_VALUE_FOR_JAVA, /* This is the mysterious missing 17 value from the java constants */
- CHARTYPE_PRIVATE_USE,
- CHARTYPE_SURROGATE,
- CHARTYPE_DASH_PUNCTUATION,
- CHARTYPE_START_PUNCTUATION,
- CHARTYPE_END_PUNCTUATION,
- CHARTYPE_CONNECTOR_PUNCTUATION,
- CHARTYPE_OTHER_PUNCTUATION,
- CHARTYPE_MATH_SYMBOL,
- CHARTYPE_CURRENCY_SYMBOL,
- CHARTYPE_MODIFIER_SYMBOL,
- CHARTYPE_OTHER_SYMBOL,
- CHARTYPE_INITIAL_QUOTE_PUNCTUATION,
- CHARTYPE_FINAL_QUOTE_PUNCTUATION
- };
-
- /**
- * Decomposition types as described by the unicode standard. These values map to
- * the same values in uchar.h in ICU.
- */
- enum DecompositionType {
- DECOMPOSITION_NONE = 0,
- DECOMPOSITION_CANONICAL,
- DECOMPOSITION_COMPAT,
- DECOMPOSITION_CIRCLE,
- DECOMPOSITION_FINAL,
- DECOMPOSITION_FONT,
- DECOMPOSITION_FRACTION,
- DECOMPOSITION_INITIAL,
- DECOMPOSITION_ISOLATED,
- DECOMPOSITION_MEDIAL,
- DECOMPOSITION_NARROW,
- DECOMPOSITION_NOBREAK,
- DECOMPOSITION_SMALL,
- DECOMPOSITION_SQUARE,
- DECOMPOSITION_SUB,
- DECOMPOSITION_SUPER,
- DECOMPOSITION_VERTICAL,
- DECOMPOSITION_WIDE
- };
-
- /**
- * Returns the packed data for java calls
- * @param c The unicode character.
- * @return The packed data for the character.
- *
- * Copied from java.lang.Character implementation:
- * 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
- * F E D C B A 9 8 7 6 5 4 3 2 1 0 F E D C B A 9 8 7 6 5 4 3 2 1 0
- *
- * 31 types ---------
- * 18 directionalities ---------
- * 2 mirroreds -
- * ----------- 56 toupper diffs
- * ----------- 48 tolower diffs
- * --- 4 totitlecase diffs
- * ------------- 84 numeric values
- * --------- 24 mirror char diffs
- */
- static uint32_t getPackedData(UChar32 c);
-
- /**
- * Get the Character type.
- * @param c The unicode character.
- * @return The character's type or CHARTYPE_UNASSIGNED if the character is invalid
- * or has an unassigned class.
- */
- static CharType getType(UChar32 c);
-
- /**
- * Get the Character's decomposition type.
- * @param c The unicode character.
- * @return The character's decomposition type or DECOMPOSITION_NONE is there
- * is no decomposition.
- */
- static DecompositionType getDecompositionType(UChar32 c);
-
- /**
- * Returns the digit value of a character or -1 if the character
- * is not within the specified radix.
- *
- * The digit value is computed for integer characters and letters
- * within the given radix. This function does not handle Roman Numerals,
- * fractions, or any other characters that may represent numbers.
- *
- * @param c The unicode character
- * @param radix The intended radix.
- * @return The digit value or -1 if there is no digit value or if the value is outside the radix.
- */
- static int getDigitValue(UChar32 c, int radix = 10);
-
- /**
- * Return the numeric value of a character
- *
- * @param c The unicode character.
- * @return The numeric value of the character. -1 if the character has no numeric value,
- * -2 if the character has a numeric value that is not representable by an integer.
- */
- static int getNumericValue(UChar32 c);
-
- /**
- * Convert the character to lowercase
- * @param c The unicode character.
- * @return The lowercase character equivalent of c. If c does not have a lowercase equivalent,
- * the original character is returned.
- */
- static UChar32 toLower(UChar32 c);
-
- /**
- * Convert the character to uppercase
- * @param c The unicode character.
- * @return The uppercase character equivalent of c. If c does not have an uppercase equivalent,
- * the original character is returned.
- */
- static UChar32 toUpper(UChar32 c);
-
- /**
- * Get the directionality of the character.
- * @param c The unicode character.
- * @return The direction of the character or DIRECTIONALITY_UNDEFINED.
- */
- static Direction getDirectionality(UChar32 c);
-
- /**
- * Check if the character is a mirrored character. This means that the character
- * has an equivalent character that is the mirror image of itself.
- * @param c The unicode character.
- * @return True iff c has a mirror equivalent.
- */
- static bool isMirrored(UChar32 c);
-
- /**
- * Return the mirror of the given character.
- * @param c The unicode character.
- * @return The mirror equivalent of c. If c does not have a mirror equivalent,
- * the original character is returned.
- * @see isMirrored
- */
- static UChar32 toMirror(UChar32 c);
-
- /**
- * Convert the character to title case.
- * @param c The unicode character.
- * @return The titlecase equivalent of c. If c does not have a titlecase equivalent,
- * the original character is returned.
- */
- static UChar32 toTitle(UChar32 c);
-
- };
-
-}
-
-#endif
diff --git a/include/utils/Flattenable.h b/include/utils/Flattenable.h
new file mode 100644
index 0000000..852be3b
--- /dev/null
+++ b/include/utils/Flattenable.h
@@ -0,0 +1,62 @@
+/*
+ * 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_UTILS_FLATTENABLE_H
+#define ANDROID_UTILS_FLATTENABLE_H
+
+
+#include <stdint.h>
+#include <sys/types.h>
+#include <utils/Errors.h>
+
+namespace android {
+
+class Flattenable
+{
+public:
+ // size in bytes of the flattened object
+ virtual size_t getFlattenedSize() const = 0;
+
+ // number of file descriptors to flatten
+ virtual size_t getFdCount() const = 0;
+
+ // flattens the object into buffer.
+ // size should be at least of getFlattenedSize()
+ // file descriptors are written in the fds[] array but ownership is
+ // not transfered (ie: they must be dupped by the caller of
+ // flatten() if needed).
+ virtual status_t flatten(void* buffer, size_t size,
+ int fds[], size_t count) const = 0;
+
+ // unflattens the object from buffer.
+ // size should be equal to the value of getFlattenedSize() when the
+ // object was flattened.
+ // unflattened file descriptors are found in the fds[] array and
+ // don't need to be dupped(). ie: the caller of unflatten doesn't
+ // keep ownership. If a fd is not retained by unflatten() it must be
+ // explicitly closed.
+ virtual status_t unflatten(void const* buffer, size_t size,
+ int fds[], size_t count) = 0;
+
+protected:
+ virtual ~Flattenable() = 0;
+
+};
+
+}; // namespace android
+
+
+#endif /* ANDROID_UTILS_FLATTENABLE_H */
diff --git a/include/utils/ResourceTypes.h b/include/utils/ResourceTypes.h
index 49145e8..b701ce7 100644
--- a/include/utils/ResourceTypes.h
+++ b/include/utils/ResourceTypes.h
@@ -393,7 +393,10 @@ struct ResStringPool_header
enum {
// If set, the string index is sorted by the string values (based
// on strcmp16()).
- SORTED_FLAG = 1<<0
+ SORTED_FLAG = 1<<0,
+
+ // String pool is encoded in UTF-8
+ UTF8_FLAG = 1<<8
};
uint32_t flags;
@@ -444,6 +447,8 @@ public:
}
const char16_t* stringAt(size_t idx, size_t* outLen) const;
+ const char* string8At(size_t idx, size_t* outLen) const;
+
const ResStringPool_span* styleAt(const ResStringPool_ref& ref) const;
const ResStringPool_span* styleAt(size_t idx) const;
@@ -451,14 +456,20 @@ public:
size_t size() const;
+#ifndef HAVE_ANDROID_OS
+ bool isUTF8() const;
+#endif
+
private:
status_t mError;
void* mOwnedData;
const ResStringPool_header* mHeader;
size_t mSize;
+ mutable Mutex mDecodeLock;
const uint32_t* mEntries;
const uint32_t* mEntryStyles;
- const char16_t* mStrings;
+ const void* mStrings;
+ char16_t** mCache;
uint32_t mStringPoolSize; // number of uint16_t
const uint32_t* mStyles;
uint32_t mStylePoolSize; // number of uint32_t
@@ -620,6 +631,8 @@ public:
void restart();
+ const ResStringPool& getStrings() const;
+
event_code_t getEventType() const;
// Note, unlike XmlPullParser, the first call to next() will return
// START_TAG of the first element.
@@ -705,8 +718,6 @@ public:
void uninit();
- const ResStringPool& getStrings() const;
-
private:
friend class ResXMLParser;
@@ -930,10 +941,25 @@ struct ResTable_config
SCREENLONG_YES = 0x20,
};
+ enum {
+ // uiMode bits for the mode type.
+ MASK_UI_MODE_TYPE = 0x0f,
+ UI_MODE_TYPE_ANY = 0x00,
+ UI_MODE_TYPE_NORMAL = 0x01,
+ UI_MODE_TYPE_DESK = 0x02,
+ UI_MODE_TYPE_CAR = 0x03,
+
+ // uiMode bits for the night switch.
+ MASK_UI_MODE_NIGHT = 0x30,
+ UI_MODE_NIGHT_ANY = 0x00,
+ UI_MODE_NIGHT_NO = 0x10,
+ UI_MODE_NIGHT_YES = 0x20,
+ };
+
union {
struct {
uint8_t screenLayout;
- uint8_t screenConfigPad0;
+ uint8_t uiMode;
uint8_t screenConfigPad1;
uint8_t screenConfigPad2;
};
@@ -987,6 +1013,8 @@ struct ResTable_config
diff = (int32_t)(version - o.version);
if (diff != 0) return diff;
diff = (int32_t)(screenLayout - o.screenLayout);
+ if (diff != 0) return diff;
+ diff = (int32_t)(uiMode - o.uiMode);
return (int)diff;
}
@@ -1005,7 +1033,8 @@ struct ResTable_config
CONFIG_DENSITY = 0x0100,
CONFIG_SCREEN_SIZE = 0x0200,
CONFIG_VERSION = 0x0400,
- CONFIG_SCREEN_LAYOUT = 0x0800
+ CONFIG_SCREEN_LAYOUT = 0x0800,
+ CONFIG_UI_MODE = 0x1000
};
// Compare two configuration, returning CONFIG_* flags set for each value
@@ -1025,6 +1054,7 @@ struct ResTable_config
if (screenSize != o.screenSize) diffs |= CONFIG_SCREEN_SIZE;
if (version != o.version) diffs |= CONFIG_VERSION;
if (screenLayout != o.screenLayout) diffs |= CONFIG_SCREEN_LAYOUT;
+ if (uiMode != o.uiMode) diffs |= CONFIG_UI_MODE;
return diffs;
}
@@ -1058,7 +1088,7 @@ struct ResTable_config
}
}
- if (screenConfig || o.screenConfig) {
+ if (screenLayout || o.screenLayout) {
if (((screenLayout^o.screenLayout) & MASK_SCREENSIZE) != 0) {
if (!(screenLayout & MASK_SCREENSIZE)) return false;
if (!(o.screenLayout & MASK_SCREENSIZE)) return true;
@@ -1069,19 +1099,28 @@ struct ResTable_config
}
}
- if (screenType || o.screenType) {
- if (orientation != o.orientation) {
- if (!orientation) return false;
- if (!o.orientation) return true;
+ if (orientation != o.orientation) {
+ if (!orientation) return false;
+ if (!o.orientation) return true;
+ }
+
+ if (uiMode || o.uiMode) {
+ if (((uiMode^o.uiMode) & MASK_UI_MODE_TYPE) != 0) {
+ if (!(uiMode & MASK_UI_MODE_TYPE)) return false;
+ if (!(o.uiMode & MASK_UI_MODE_TYPE)) return true;
}
+ if (((uiMode^o.uiMode) & MASK_UI_MODE_NIGHT) != 0) {
+ if (!(uiMode & MASK_UI_MODE_NIGHT)) return false;
+ if (!(o.uiMode & MASK_UI_MODE_NIGHT)) return true;
+ }
+ }
- // density is never 'more specific'
- // as the default just equals 160
+ // density is never 'more specific'
+ // as the default just equals 160
- if (touchscreen != o.touchscreen) {
- if (!touchscreen) return false;
- if (!o.touchscreen) return true;
- }
+ if (touchscreen != o.touchscreen) {
+ if (!touchscreen) return false;
+ if (!o.touchscreen) return true;
}
if (input || o.input) {
@@ -1166,7 +1205,7 @@ struct ResTable_config
}
}
- if (screenConfig || o.screenConfig) {
+ if (screenLayout || o.screenLayout) {
if (((screenLayout^o.screenLayout) & MASK_SCREENSIZE) != 0
&& (requested->screenLayout & MASK_SCREENSIZE)) {
return (screenLayout & MASK_SCREENSIZE);
@@ -1177,11 +1216,22 @@ struct ResTable_config
}
}
- if (screenType || o.screenType) {
- if ((orientation != o.orientation) && requested->orientation) {
- return (orientation);
+ if ((orientation != o.orientation) && requested->orientation) {
+ return (orientation);
+ }
+
+ if (uiMode || o.uiMode) {
+ if (((uiMode^o.uiMode) & MASK_UI_MODE_TYPE) != 0
+ && (requested->uiMode & MASK_UI_MODE_TYPE)) {
+ return (uiMode & MASK_UI_MODE_TYPE);
}
+ if (((uiMode^o.uiMode) & MASK_UI_MODE_NIGHT) != 0
+ && (requested->uiMode & MASK_UI_MODE_NIGHT)) {
+ return (uiMode & MASK_UI_MODE_NIGHT);
+ }
+ }
+ if (screenType || o.screenType) {
if (density != o.density) {
// density is tough. Any density is potentially useful
// because the system will scale it. Scaling down
@@ -1331,6 +1381,20 @@ struct ResTable_config
&& screenLong != setScreenLong) {
return false;
}
+
+ const int uiModeType = uiMode&MASK_UI_MODE_TYPE;
+ const int setUiModeType = settings.uiMode&MASK_UI_MODE_TYPE;
+ if (setUiModeType != 0 && uiModeType != 0
+ && uiModeType != setUiModeType) {
+ return false;
+ }
+
+ const int uiModeNight = uiMode&MASK_UI_MODE_NIGHT;
+ const int setUiModeNight = settings.uiMode&MASK_UI_MODE_NIGHT;
+ if (setUiModeNight != 0 && uiModeNight != 0
+ && uiModeNight != setUiModeNight) {
+ return false;
+ }
}
if (screenType != 0) {
if (settings.orientation != 0 && orientation != 0
@@ -1411,13 +1475,15 @@ struct ResTable_config
String8 toString() const {
char buf[200];
sprintf(buf, "imsi=%d/%d lang=%c%c reg=%c%c orient=%d touch=%d dens=%d "
- "kbd=%d nav=%d input=%d scrnW=%d scrnH=%d sz=%d long=%d vers=%d.%d",
+ "kbd=%d nav=%d input=%d scrnW=%d scrnH=%d sz=%d long=%d "
+ "ui=%d night=%d vers=%d.%d",
mcc, mnc,
language[0] ? language[0] : '-', language[1] ? language[1] : '-',
country[0] ? country[0] : '-', country[1] ? country[1] : '-',
orientation, touchscreen, density, keyboard, navigation, inputFlags,
screenWidth, screenHeight,
screenLayout&MASK_SCREENSIZE, screenLayout&MASK_SCREENLONG,
+ uiMode&MASK_UI_MODE_TYPE, uiMode&MASK_UI_MODE_NIGHT,
sdkVersion, minorVersion);
return String8(buf);
}
diff --git a/include/utils/String16.h b/include/utils/String16.h
index a2d22ee..07a0c11 100644
--- a/include/utils/String16.h
+++ b/include/utils/String16.h
@@ -49,12 +49,17 @@ int strzcmp16(const char16_t *s1, size_t n1, const char16_t *s2, size_t n2);
// Version of strzcmp16 for comparing strings in different endianness.
int strzcmp16_h_n(const char16_t *s1H, size_t n1, const char16_t *s2N, size_t n2);
+// Convert UTF-8 to UTF-16 including surrogate pairs
+void utf8_to_utf16(const uint8_t *src, size_t srcLen, char16_t* dst, const size_t dstLen);
+
}
// ---------------------------------------------------------------------------
namespace android {
+// ---------------------------------------------------------------------------
+
class String8;
class TextOutput;
diff --git a/include/utils/String8.h b/include/utils/String8.h
index ecc5774..c4b18a4 100644
--- a/include/utils/String8.h
+++ b/include/utils/String8.h
@@ -60,6 +60,11 @@ size_t utf32_length(const char *src, size_t src_len);
/*
* Returns the UTF-8 length of "src".
*/
+size_t utf8_length_from_utf16(const char16_t *src, size_t src_len);
+
+/*
+ * Returns the UTF-8 length of "src".
+ */
size_t utf8_length_from_utf32(const char32_t *src, size_t src_len);
/*
@@ -120,6 +125,9 @@ size_t utf8_to_utf32(const char* src, size_t src_len,
size_t utf32_to_utf8(const char32_t* src, size_t src_len,
char* dst, size_t dst_len);
+size_t utf16_to_utf8(const char16_t* src, size_t src_len,
+ char* dst, size_t dst_len);
+
}
// ---------------------------------------------------------------------------
diff --git a/include/utils/threads.h b/include/utils/threads.h
index 0fc533f..5ac0c5e 100644
--- a/include/utils/threads.h
+++ b/include/utils/threads.h
@@ -124,6 +124,24 @@ typedef int (*android_create_thread_fn)(android_thread_func_t entryFunction,
extern void androidSetCreateThreadFunc(android_create_thread_fn func);
+// ------------------------------------------------------------------
+// Extra functions working with raw pids.
+
+// Get pid for the current thread.
+extern pid_t androidGetTid();
+
+// Change the scheduling group of a particular thread. The group
+// should be one of the ANDROID_TGROUP constants. Returns BAD_VALUE if
+// grp is out of range, else another non-zero value with errno set if
+// the operation failed.
+extern int androidSetThreadSchedulingGroup(pid_t tid, int grp);
+
+// Change the priority AND scheduling group of a particular thread. The priority
+// should be one of the ANDROID_PRIORITY constants. Returns INVALID_OPERATION
+// if the priority set failed, else another value if just the group set failed;
+// in either case errno is set.
+extern int androidSetThreadPriority(pid_t tid, int prio);
+
#ifdef __cplusplus
}
#endif
@@ -191,7 +209,7 @@ inline thread_id_t getThreadId() {
class Mutex {
public:
enum {
- NORMAL = 0,
+ PRIVATE = 0,
SHARED = 1
};
@@ -287,7 +305,13 @@ typedef Mutex::Autolock AutoMutex;
*/
class Condition {
public:
+ enum {
+ PRIVATE = 0,
+ SHARED = 1
+ };
+
Condition();
+ Condition(int type);
~Condition();
// Wait on the condition variable. Lock the mutex before calling.
status_t wait(Mutex& mutex);
@@ -311,6 +335,17 @@ private:
inline Condition::Condition() {
pthread_cond_init(&mCond, NULL);
}
+inline Condition::Condition(int type) {
+ if (type == SHARED) {
+ pthread_condattr_t attr;
+ pthread_condattr_init(&attr);
+ pthread_condattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
+ pthread_cond_init(&mCond, &attr);
+ pthread_condattr_destroy(&attr);
+ } else {
+ pthread_cond_init(&mCond, NULL);
+ }
+}
inline Condition::~Condition() {
pthread_cond_destroy(&mCond);
}