summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2012-03-07 19:36:08 -0800
committerMathias Agopian <mathias@google.com>2012-03-07 19:36:08 -0800
commit8c79817dc6459baa2c79db88e3c3e4d5c07d6a61 (patch)
treed7e4dfcc8a7851d5851750989664ec81ca620d6d /include
parent08965ec67ada98f63f8ac879cc44c8b0e7ff046d (diff)
downloadframeworks_base-8c79817dc6459baa2c79db88e3c3e4d5c07d6a61.zip
frameworks_base-8c79817dc6459baa2c79db88e3c3e4d5c07d6a61.tar.gz
frameworks_base-8c79817dc6459baa2c79db88e3c3e4d5c07d6a61.tar.bz2
remove files that moved to frameworks/native
Change-Id: I140d291e520097b1148930f736823650e08488f7
Diffstat (limited to 'include')
-rw-r--r--include/binder/Binder.h103
-rw-r--r--include/binder/BinderService.h60
-rw-r--r--include/binder/BpBinder.h124
-rw-r--r--include/binder/IBinder.h159
-rw-r--r--include/binder/IInterface.h150
-rw-r--r--include/binder/IMemory.h102
-rw-r--r--include/binder/IPCThreadState.h129
-rw-r--r--include/binder/IPermissionController.h56
-rw-r--r--include/binder/IServiceManager.h101
-rw-r--r--include/binder/MemoryBase.h51
-rw-r--r--include/binder/MemoryDealer.h60
-rw-r--r--include/binder/MemoryHeapBase.h100
-rw-r--r--include/binder/Parcel.h297
-rw-r--r--include/binder/PermissionCache.h79
-rw-r--r--include/binder/ProcessState.h113
-rw-r--r--include/gui/BitTube.h54
-rw-r--r--include/gui/BufferQueue.h426
-rw-r--r--include/gui/DisplayEventReceiver.h123
-rw-r--r--include/gui/IDisplayEventConnection.h73
-rw-r--r--include/gui/IGraphicBufferAlloc.h58
-rw-r--r--include/gui/ISensorEventConnection.h57
-rw-r--r--include/gui/ISensorServer.h57
-rw-r--r--include/gui/ISurface.h64
-rw-r--r--include/gui/ISurfaceComposer.h174
-rw-r--r--include/gui/ISurfaceComposerClient.h84
-rw-r--r--include/gui/ISurfaceTexture.h146
-rw-r--r--include/gui/Sensor.h95
-rw-r--r--include/gui/SensorEventQueue.h82
-rw-r--r--include/gui/SensorManager.h75
-rw-r--r--include/gui/Surface.h175
-rw-r--r--include/gui/SurfaceComposerClient.h177
-rw-r--r--include/gui/SurfaceTexture.h275
-rw-r--r--include/gui/SurfaceTextureClient.h165
-rw-r--r--include/private/binder/Static.h39
-rw-r--r--include/private/binder/binder_module.h33
-rw-r--r--include/private/gui/ComposerService.h53
-rw-r--r--include/private/gui/LayerState.h81
-rw-r--r--include/private/gui/SharedBufferStack.h59
-rw-r--r--include/private/ui/RegionHelper.h284
-rw-r--r--include/private/utils/Static.h35
-rw-r--r--include/ui/ANativeObjectBase.h102
-rw-r--r--include/ui/DisplayInfo.h52
-rw-r--r--include/ui/FramebufferNativeWindow.h94
-rw-r--r--include/ui/GraphicBuffer.h158
-rw-r--r--include/ui/GraphicBufferAllocator.h96
-rw-r--r--include/ui/GraphicBufferMapper.h64
-rw-r--r--include/ui/PixelFormat.h128
-rw-r--r--include/ui/Point.h87
-rw-r--r--include/ui/Rect.h149
-rw-r--r--include/ui/Region.h202
-rw-r--r--include/utils/AndroidThreads.h136
-rw-r--r--include/utils/Atomic.h22
-rw-r--r--include/utils/BasicHashtable.h393
-rw-r--r--include/utils/BitSet.h107
-rw-r--r--include/utils/BlobCache.h251
-rw-r--r--include/utils/BufferedTextOutput.h67
-rw-r--r--include/utils/ByteOrder.h81
-rw-r--r--include/utils/CallStack.h74
-rw-r--r--include/utils/Compat.h42
-rw-r--r--include/utils/Condition.h134
-rw-r--r--include/utils/Debug.h70
-rw-r--r--include/utils/Endian.h40
-rw-r--r--include/utils/Errors.h88
-rw-r--r--include/utils/FileMap.h136
-rw-r--r--include/utils/Flattenable.h62
-rw-r--r--include/utils/Functor.h33
-rw-r--r--include/utils/GenerationCache.h247
-rw-r--r--include/utils/KeyedVector.h201
-rw-r--r--include/utils/LinearTransform.h64
-rw-r--r--include/utils/List.h332
-rw-r--r--include/utils/Log.h33
-rw-r--r--include/utils/Looper.h377
-rw-r--r--include/utils/Mutex.h137
-rw-r--r--include/utils/PropertyMap.h106
-rw-r--r--include/utils/RWLock.h126
-rw-r--r--include/utils/RefBase.h528
-rw-r--r--include/utils/SharedBuffer.h146
-rw-r--r--include/utils/Singleton.h77
-rw-r--r--include/utils/SortedVector.h283
-rw-r--r--include/utils/StopWatch.h64
-rw-r--r--include/utils/String16.h238
-rw-r--r--include/utils/String8.h383
-rw-r--r--include/utils/StringArray.h83
-rw-r--r--include/utils/StrongPointer.h220
-rw-r--r--include/utils/SystemClock.h32
-rw-r--r--include/utils/TextOutput.h190
-rw-r--r--include/utils/Thread.h113
-rw-r--r--include/utils/ThreadDefs.h123
-rw-r--r--include/utils/Timers.h144
-rw-r--r--include/utils/Tokenizer.h125
-rw-r--r--include/utils/Trace.h166
-rw-r--r--include/utils/TypeHelpers.h290
-rw-r--r--include/utils/Unicode.h168
-rw-r--r--include/utils/Vector.h421
-rw-r--r--include/utils/VectorImpl.h202
-rw-r--r--include/utils/ashmem.h41
-rw-r--r--include/utils/misc.h93
-rw-r--r--include/utils/threads.h38
98 files changed, 0 insertions, 13287 deletions
diff --git a/include/binder/Binder.h b/include/binder/Binder.h
deleted file mode 100644
index ba3ac4b..0000000
--- a/include/binder/Binder.h
+++ /dev/null
@@ -1,103 +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_BINDER_H
-#define ANDROID_BINDER_H
-
-#include <binder/IBinder.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-
-class BBinder : public IBinder
-{
-public:
- BBinder();
-
- virtual const String16& getInterfaceDescriptor() const;
- virtual bool isBinderAlive() const;
- virtual status_t pingBinder();
- virtual status_t dump(int fd, const Vector<String16>& args);
-
- virtual status_t transact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-
- virtual status_t linkToDeath(const sp<DeathRecipient>& recipient,
- void* cookie = NULL,
- uint32_t flags = 0);
-
- virtual status_t unlinkToDeath( const wp<DeathRecipient>& recipient,
- void* cookie = NULL,
- uint32_t flags = 0,
- wp<DeathRecipient>* outRecipient = NULL);
-
- virtual void attachObject( const void* objectID,
- void* object,
- void* cleanupCookie,
- object_cleanup_func func);
- virtual void* findObject(const void* objectID) const;
- virtual void detachObject(const void* objectID);
-
- virtual BBinder* localBinder();
-
-protected:
- virtual ~BBinder();
-
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-
-private:
- BBinder(const BBinder& o);
- BBinder& operator=(const BBinder& o);
-
- class Extras;
-
- Extras* mExtras;
- void* mReserved0;
-};
-
-// ---------------------------------------------------------------------------
-
-class BpRefBase : public virtual RefBase
-{
-protected:
- BpRefBase(const sp<IBinder>& o);
- virtual ~BpRefBase();
- virtual void onFirstRef();
- virtual void onLastStrongRef(const void* id);
- virtual bool onIncStrongAttempted(uint32_t flags, const void* id);
-
- inline IBinder* remote() { return mRemote; }
- inline IBinder* remote() const { return mRemote; }
-
-private:
- BpRefBase(const BpRefBase& o);
- BpRefBase& operator=(const BpRefBase& o);
-
- IBinder* const mRemote;
- RefBase::weakref_type* mRefs;
- volatile int32_t mState;
-};
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_BINDER_H
diff --git a/include/binder/BinderService.h b/include/binder/BinderService.h
deleted file mode 100644
index ca594d3..0000000
--- a/include/binder/BinderService.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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_BINDER_SERVICE_H
-#define ANDROID_BINDER_SERVICE_H
-
-#include <stdint.h>
-
-#include <utils/Errors.h>
-#include <utils/String16.h>
-
-#include <binder/IServiceManager.h>
-#include <binder/IPCThreadState.h>
-#include <binder/ProcessState.h>
-#include <binder/IServiceManager.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-
-template<typename SERVICE>
-class BinderService
-{
-public:
- static status_t publish(bool allowIsolated = false) {
- sp<IServiceManager> sm(defaultServiceManager());
- return sm->addService(String16(SERVICE::getServiceName()), new SERVICE(), allowIsolated);
- }
-
- static void publishAndJoinThreadPool(bool allowIsolated = false) {
- sp<ProcessState> proc(ProcessState::self());
- sp<IServiceManager> sm(defaultServiceManager());
- sm->addService(String16(SERVICE::getServiceName()), new SERVICE(), allowIsolated);
- ProcessState::self()->startThreadPool();
- IPCThreadState::self()->joinThreadPool();
- }
-
- static void instantiate() { publish(); }
-
- static status_t shutdown() {
- return NO_ERROR;
- }
-};
-
-
-}; // namespace android
-// ---------------------------------------------------------------------------
-#endif // ANDROID_BINDER_SERVICE_H
diff --git a/include/binder/BpBinder.h b/include/binder/BpBinder.h
deleted file mode 100644
index 7ef93aa..0000000
--- a/include/binder/BpBinder.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2005 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_BPBINDER_H
-#define ANDROID_BPBINDER_H
-
-#include <binder/IBinder.h>
-#include <utils/KeyedVector.h>
-#include <utils/threads.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-
-class BpBinder : public IBinder
-{
-public:
- BpBinder(int32_t handle);
-
- inline int32_t handle() const { return mHandle; }
-
- virtual const String16& getInterfaceDescriptor() const;
- virtual bool isBinderAlive() const;
- virtual status_t pingBinder();
- virtual status_t dump(int fd, const Vector<String16>& args);
-
- virtual status_t transact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-
- virtual status_t linkToDeath(const sp<DeathRecipient>& recipient,
- void* cookie = NULL,
- uint32_t flags = 0);
- virtual status_t unlinkToDeath( const wp<DeathRecipient>& recipient,
- void* cookie = NULL,
- uint32_t flags = 0,
- wp<DeathRecipient>* outRecipient = NULL);
-
- virtual void attachObject( const void* objectID,
- void* object,
- void* cleanupCookie,
- object_cleanup_func func);
- virtual void* findObject(const void* objectID) const;
- virtual void detachObject(const void* objectID);
-
- virtual BpBinder* remoteBinder();
-
- status_t setConstantData(const void* data, size_t size);
- void sendObituary();
-
- class ObjectManager
- {
- public:
- ObjectManager();
- ~ObjectManager();
-
- void attach( const void* objectID,
- void* object,
- void* cleanupCookie,
- IBinder::object_cleanup_func func);
- void* find(const void* objectID) const;
- void detach(const void* objectID);
-
- void kill();
-
- private:
- ObjectManager(const ObjectManager&);
- ObjectManager& operator=(const ObjectManager&);
-
- struct entry_t
- {
- void* object;
- void* cleanupCookie;
- IBinder::object_cleanup_func func;
- };
-
- KeyedVector<const void*, entry_t> mObjects;
- };
-
-protected:
- virtual ~BpBinder();
- virtual void onFirstRef();
- virtual void onLastStrongRef(const void* id);
- virtual bool onIncStrongAttempted(uint32_t flags, const void* id);
-
-private:
- const int32_t mHandle;
-
- struct Obituary {
- wp<DeathRecipient> recipient;
- void* cookie;
- uint32_t flags;
- };
-
- void reportOneDeath(const Obituary& obit);
- bool isDescriptorCached() const;
-
- mutable Mutex mLock;
- volatile int32_t mAlive;
- volatile int32_t mObitsSent;
- Vector<Obituary>* mObituaries;
- ObjectManager mObjects;
- Parcel* mConstantData;
- mutable String16 mDescriptorCache;
-};
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_BPBINDER_H
diff --git a/include/binder/IBinder.h b/include/binder/IBinder.h
deleted file mode 100644
index 81b56c2..0000000
--- a/include/binder/IBinder.h
+++ /dev/null
@@ -1,159 +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_IBINDER_H
-#define ANDROID_IBINDER_H
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-#include <utils/String16.h>
-#include <utils/Vector.h>
-
-
-#define B_PACK_CHARS(c1, c2, c3, c4) \
- ((((c1)<<24)) | (((c2)<<16)) | (((c3)<<8)) | (c4))
-
-// ---------------------------------------------------------------------------
-namespace android {
-
-class BBinder;
-class BpBinder;
-class IInterface;
-class Parcel;
-
-/**
- * Base class and low-level protocol for a remotable object.
- * You can derive from this class to create an object for which other
- * processes can hold references to it. Communication between processes
- * (method calls, property get and set) is down through a low-level
- * protocol implemented on top of the transact() API.
- */
-class IBinder : public virtual RefBase
-{
-public:
- enum {
- FIRST_CALL_TRANSACTION = 0x00000001,
- LAST_CALL_TRANSACTION = 0x00ffffff,
-
- PING_TRANSACTION = B_PACK_CHARS('_','P','N','G'),
- DUMP_TRANSACTION = B_PACK_CHARS('_','D','M','P'),
- INTERFACE_TRANSACTION = B_PACK_CHARS('_', 'N', 'T', 'F'),
-
- // Corresponds to TF_ONE_WAY -- an asynchronous call.
- FLAG_ONEWAY = 0x00000001
- };
-
- IBinder();
-
- /**
- * Check if this IBinder implements the interface named by
- * @a descriptor. If it does, the base pointer to it is returned,
- * which you can safely static_cast<> to the concrete C++ interface.
- */
- virtual sp<IInterface> queryLocalInterface(const String16& descriptor);
-
- /**
- * Return the canonical name of the interface provided by this IBinder
- * object.
- */
- virtual const String16& getInterfaceDescriptor() const = 0;
-
- virtual bool isBinderAlive() const = 0;
- virtual status_t pingBinder() = 0;
- virtual status_t dump(int fd, const Vector<String16>& args) = 0;
-
- virtual status_t transact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0) = 0;
-
- /**
- * This method allows you to add data that is transported through
- * IPC along with your IBinder pointer. When implementing a Binder
- * object, override it to write your desired data in to @a outData.
- * You can then call getConstantData() on your IBinder to retrieve
- * that data, from any process. You MUST return the number of bytes
- * written in to the parcel (including padding).
- */
- class DeathRecipient : public virtual RefBase
- {
- public:
- virtual void binderDied(const wp<IBinder>& who) = 0;
- };
-
- /**
- * Register the @a recipient for a notification if this binder
- * goes away. If this binder object unexpectedly goes away
- * (typically because its hosting process has been killed),
- * then DeathRecipient::binderDied() will be called with a reference
- * to this.
- *
- * The @a cookie is optional -- if non-NULL, it should be a
- * memory address that you own (that is, you know it is unique).
- *
- * @note You will only receive death notifications for remote binders,
- * as local binders by definition can't die without you dying as well.
- * Trying to use this function on a local binder will result in an
- * INVALID_OPERATION code being returned and nothing happening.
- *
- * @note This link always holds a weak reference to its recipient.
- *
- * @note You will only receive a weak reference to the dead
- * binder. You should not try to promote this to a strong reference.
- * (Nor should you need to, as there is nothing useful you can
- * directly do with it now that it has passed on.)
- */
- virtual status_t linkToDeath(const sp<DeathRecipient>& recipient,
- void* cookie = NULL,
- uint32_t flags = 0) = 0;
-
- /**
- * Remove a previously registered death notification.
- * The @a recipient will no longer be called if this object
- * dies. The @a cookie is optional. If non-NULL, you can
- * supply a NULL @a recipient, and the recipient previously
- * added with that cookie will be unlinked.
- */
- virtual status_t unlinkToDeath( const wp<DeathRecipient>& recipient,
- void* cookie = NULL,
- uint32_t flags = 0,
- wp<DeathRecipient>* outRecipient = NULL) = 0;
-
- virtual bool checkSubclass(const void* subclassID) const;
-
- typedef void (*object_cleanup_func)(const void* id, void* obj, void* cleanupCookie);
-
- virtual void attachObject( const void* objectID,
- void* object,
- void* cleanupCookie,
- object_cleanup_func func) = 0;
- virtual void* findObject(const void* objectID) const = 0;
- virtual void detachObject(const void* objectID) = 0;
-
- virtual BBinder* localBinder();
- virtual BpBinder* remoteBinder();
-
-protected:
- virtual ~IBinder();
-
-private:
-};
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_IBINDER_H
diff --git a/include/binder/IInterface.h b/include/binder/IInterface.h
deleted file mode 100644
index 5f9f69c..0000000
--- a/include/binder/IInterface.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (C) 2005 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_IINTERFACE_H
-#define ANDROID_IINTERFACE_H
-
-#include <binder/Binder.h>
-
-namespace android {
-
-// ----------------------------------------------------------------------
-
-class IInterface : public virtual RefBase
-{
-public:
- IInterface();
- sp<IBinder> asBinder();
- sp<const IBinder> asBinder() const;
-
-protected:
- virtual ~IInterface();
- virtual IBinder* onAsBinder() = 0;
-};
-
-// ----------------------------------------------------------------------
-
-template<typename INTERFACE>
-inline sp<INTERFACE> interface_cast(const sp<IBinder>& obj)
-{
- return INTERFACE::asInterface(obj);
-}
-
-// ----------------------------------------------------------------------
-
-template<typename INTERFACE>
-class BnInterface : public INTERFACE, public BBinder
-{
-public:
- virtual sp<IInterface> queryLocalInterface(const String16& _descriptor);
- virtual const String16& getInterfaceDescriptor() const;
-
-protected:
- virtual IBinder* onAsBinder();
-};
-
-// ----------------------------------------------------------------------
-
-template<typename INTERFACE>
-class BpInterface : public INTERFACE, public BpRefBase
-{
-public:
- BpInterface(const sp<IBinder>& remote);
-
-protected:
- virtual IBinder* onAsBinder();
-};
-
-// ----------------------------------------------------------------------
-
-#define DECLARE_META_INTERFACE(INTERFACE) \
- static const android::String16 descriptor; \
- static android::sp<I##INTERFACE> asInterface( \
- const android::sp<android::IBinder>& obj); \
- virtual const android::String16& getInterfaceDescriptor() const; \
- I##INTERFACE(); \
- virtual ~I##INTERFACE(); \
-
-
-#define IMPLEMENT_META_INTERFACE(INTERFACE, NAME) \
- const android::String16 I##INTERFACE::descriptor(NAME); \
- const android::String16& \
- I##INTERFACE::getInterfaceDescriptor() const { \
- return I##INTERFACE::descriptor; \
- } \
- android::sp<I##INTERFACE> I##INTERFACE::asInterface( \
- const android::sp<android::IBinder>& obj) \
- { \
- android::sp<I##INTERFACE> intr; \
- if (obj != NULL) { \
- intr = static_cast<I##INTERFACE*>( \
- obj->queryLocalInterface( \
- I##INTERFACE::descriptor).get()); \
- if (intr == NULL) { \
- intr = new Bp##INTERFACE(obj); \
- } \
- } \
- return intr; \
- } \
- I##INTERFACE::I##INTERFACE() { } \
- I##INTERFACE::~I##INTERFACE() { } \
-
-
-#define CHECK_INTERFACE(interface, data, reply) \
- if (!data.checkInterface(this)) { return PERMISSION_DENIED; } \
-
-
-// ----------------------------------------------------------------------
-// No user-serviceable parts after this...
-
-template<typename INTERFACE>
-inline sp<IInterface> BnInterface<INTERFACE>::queryLocalInterface(
- const String16& _descriptor)
-{
- if (_descriptor == INTERFACE::descriptor) return this;
- return NULL;
-}
-
-template<typename INTERFACE>
-inline const String16& BnInterface<INTERFACE>::getInterfaceDescriptor() const
-{
- return INTERFACE::getInterfaceDescriptor();
-}
-
-template<typename INTERFACE>
-IBinder* BnInterface<INTERFACE>::onAsBinder()
-{
- return this;
-}
-
-template<typename INTERFACE>
-inline BpInterface<INTERFACE>::BpInterface(const sp<IBinder>& remote)
- : BpRefBase(remote)
-{
-}
-
-template<typename INTERFACE>
-inline IBinder* BpInterface<INTERFACE>::onAsBinder()
-{
- return remote();
-}
-
-// ----------------------------------------------------------------------
-
-}; // namespace android
-
-#endif // ANDROID_IINTERFACE_H
diff --git a/include/binder/IMemory.h b/include/binder/IMemory.h
deleted file mode 100644
index 2d0db00..0000000
--- a/include/binder/IMemory.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2007 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_IMEMORY_H
-#define ANDROID_IMEMORY_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-
-#include <utils/RefBase.h>
-#include <utils/Errors.h>
-#include <binder/IInterface.h>
-
-namespace android {
-
-// ----------------------------------------------------------------------------
-
-class IMemoryHeap : public IInterface
-{
-public:
- DECLARE_META_INTERFACE(MemoryHeap);
-
- // flags returned by getFlags()
- enum {
- READ_ONLY = 0x00000001
- };
-
- virtual int getHeapID() const = 0;
- virtual void* getBase() const = 0;
- virtual size_t getSize() const = 0;
- virtual uint32_t getFlags() const = 0;
- virtual uint32_t getOffset() const = 0;
-
- // these are there just for backward source compatibility
- int32_t heapID() const { return getHeapID(); }
- void* base() const { return getBase(); }
- size_t virtualSize() const { return getSize(); }
-};
-
-class BnMemoryHeap : public BnInterface<IMemoryHeap>
-{
-public:
- virtual status_t onTransact(
- uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-
- BnMemoryHeap();
-protected:
- virtual ~BnMemoryHeap();
-};
-
-// ----------------------------------------------------------------------------
-
-class IMemory : public IInterface
-{
-public:
- DECLARE_META_INTERFACE(Memory);
-
- virtual sp<IMemoryHeap> getMemory(ssize_t* offset=0, size_t* size=0) const = 0;
-
- // helpers
- void* fastPointer(const sp<IBinder>& heap, ssize_t offset) const;
- void* pointer() const;
- size_t size() const;
- ssize_t offset() const;
-};
-
-class BnMemory : public BnInterface<IMemory>
-{
-public:
- virtual status_t onTransact(
- uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-
- BnMemory();
-protected:
- virtual ~BnMemory();
-};
-
-// ----------------------------------------------------------------------------
-
-}; // namespace android
-
-#endif // ANDROID_IMEMORY_H
diff --git a/include/binder/IPCThreadState.h b/include/binder/IPCThreadState.h
deleted file mode 100644
index 691ba2f..0000000
--- a/include/binder/IPCThreadState.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2005 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_IPC_THREAD_STATE_H
-#define ANDROID_IPC_THREAD_STATE_H
-
-#include <utils/Errors.h>
-#include <binder/Parcel.h>
-#include <binder/ProcessState.h>
-#include <utils/Vector.h>
-
-#ifdef HAVE_WIN32_PROC
-typedef int uid_t;
-#endif
-
-// ---------------------------------------------------------------------------
-namespace android {
-
-class IPCThreadState
-{
-public:
- static IPCThreadState* self();
- static IPCThreadState* selfOrNull(); // self(), but won't instantiate
-
- sp<ProcessState> process();
-
- status_t clearLastError();
-
- int getCallingPid();
- int getCallingUid();
- int getOrigCallingUid();
-
- void setStrictModePolicy(int32_t policy);
- int32_t getStrictModePolicy() const;
-
- void setLastTransactionBinderFlags(int32_t flags);
- int32_t getLastTransactionBinderFlags() const;
-
- int64_t clearCallingIdentity();
- void restoreCallingIdentity(int64_t token);
-
- void flushCommands();
-
- void joinThreadPool(bool isMain = true);
-
- // Stop the local process.
- void stopProcess(bool immediate = true);
-
- status_t transact(int32_t handle,
- uint32_t code, const Parcel& data,
- Parcel* reply, uint32_t flags);
-
- void incStrongHandle(int32_t handle);
- void decStrongHandle(int32_t handle);
- void incWeakHandle(int32_t handle);
- void decWeakHandle(int32_t handle);
- status_t attemptIncStrongHandle(int32_t handle);
- static void expungeHandle(int32_t handle, IBinder* binder);
- status_t requestDeathNotification( int32_t handle,
- BpBinder* proxy);
- status_t clearDeathNotification( int32_t handle,
- BpBinder* proxy);
-
- 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();
-
- status_t sendReply(const Parcel& reply, uint32_t flags);
- status_t waitForResponse(Parcel *reply,
- status_t *acquireResult=NULL);
- status_t talkWithDriver(bool doReceive=true);
- status_t writeTransactionData(int32_t cmd,
- uint32_t binderFlags,
- int32_t handle,
- uint32_t code,
- const Parcel& data,
- status_t* statusBuffer);
- status_t executeCommand(int32_t command);
-
- void clearCaller();
-
- static void threadDestructor(void *st);
- static void freeBuffer(Parcel* parcel,
- const uint8_t* data, size_t dataSize,
- const size_t* objects, size_t objectsSize,
- 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;
- pid_t mCallingPid;
- uid_t mCallingUid;
- uid_t mOrigCallingUid;
- int32_t mStrictModePolicy;
- int32_t mLastTransactionBinderFlags;
-};
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_IPC_THREAD_STATE_H
diff --git a/include/binder/IPermissionController.h b/include/binder/IPermissionController.h
deleted file mode 100644
index f9d371b..0000000
--- a/include/binder/IPermissionController.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2005 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_IPERMISSION_CONTROLLER_H
-#define ANDROID_IPERMISSION_CONTROLLER_H
-
-#include <binder/IInterface.h>
-
-namespace android {
-
-// ----------------------------------------------------------------------
-
-class IPermissionController : public IInterface
-{
-public:
- DECLARE_META_INTERFACE(PermissionController);
-
- virtual bool checkPermission(const String16& permission,
- int32_t pid, int32_t uid) = 0;
-
- enum {
- CHECK_PERMISSION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION
- };
-};
-
-// ----------------------------------------------------------------------
-
-class BnPermissionController : public BnInterface<IPermissionController>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-// ----------------------------------------------------------------------
-
-}; // namespace android
-
-#endif // ANDROID_IPERMISSION_CONTROLLER_H
-
diff --git a/include/binder/IServiceManager.h b/include/binder/IServiceManager.h
deleted file mode 100644
index 2c297d6..0000000
--- a/include/binder/IServiceManager.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) 2005 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_ISERVICE_MANAGER_H
-#define ANDROID_ISERVICE_MANAGER_H
-
-#include <binder/IInterface.h>
-#include <binder/IPermissionController.h>
-#include <utils/Vector.h>
-#include <utils/String16.h>
-
-namespace android {
-
-// ----------------------------------------------------------------------
-
-class IServiceManager : public IInterface
-{
-public:
- DECLARE_META_INTERFACE(ServiceManager);
-
- /**
- * Retrieve an existing service, blocking for a few seconds
- * if it doesn't yet exist.
- */
- virtual sp<IBinder> getService( const String16& name) const = 0;
-
- /**
- * Retrieve an existing service, non-blocking.
- */
- virtual sp<IBinder> checkService( const String16& name) const = 0;
-
- /**
- * Register a service.
- */
- virtual status_t addService( const String16& name,
- const sp<IBinder>& service,
- bool allowIsolated = false) = 0;
-
- /**
- * Return list of all existing services.
- */
- virtual Vector<String16> listServices() = 0;
-
- enum {
- GET_SERVICE_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION,
- CHECK_SERVICE_TRANSACTION,
- ADD_SERVICE_TRANSACTION,
- LIST_SERVICES_TRANSACTION,
- };
-};
-
-sp<IServiceManager> defaultServiceManager();
-
-template<typename INTERFACE>
-status_t getService(const String16& name, sp<INTERFACE>* outService)
-{
- const sp<IServiceManager> sm = defaultServiceManager();
- if (sm != NULL) {
- *outService = interface_cast<INTERFACE>(sm->getService(name));
- if ((*outService) != NULL) return NO_ERROR;
- }
- return NAME_NOT_FOUND;
-}
-
-bool checkCallingPermission(const String16& permission);
-bool checkCallingPermission(const String16& permission,
- int32_t* outPid, int32_t* outUid);
-bool checkPermission(const String16& permission, pid_t pid, uid_t uid);
-
-
-// ----------------------------------------------------------------------
-
-class BnServiceManager : public BnInterface<IServiceManager>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-// ----------------------------------------------------------------------
-
-}; // namespace android
-
-#endif // ANDROID_ISERVICE_MANAGER_H
-
diff --git a/include/binder/MemoryBase.h b/include/binder/MemoryBase.h
deleted file mode 100644
index 463e26d..0000000
--- a/include/binder/MemoryBase.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_MEMORY_BASE_H
-#define ANDROID_MEMORY_BASE_H
-
-#include <stdlib.h>
-#include <stdint.h>
-
-#include <binder/IMemory.h>
-
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-class MemoryBase : public BnMemory
-{
-public:
- MemoryBase(const sp<IMemoryHeap>& heap, ssize_t offset, size_t size);
- virtual ~MemoryBase();
- virtual sp<IMemoryHeap> getMemory(ssize_t* offset, size_t* size) const;
-
-protected:
- size_t getSize() const { return mSize; }
- ssize_t getOffset() const { return mOffset; }
- const sp<IMemoryHeap>& getHeap() const { return mHeap; }
-
-private:
- size_t mSize;
- ssize_t mOffset;
- sp<IMemoryHeap> mHeap;
-};
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_MEMORY_BASE_H
diff --git a/include/binder/MemoryDealer.h b/include/binder/MemoryDealer.h
deleted file mode 100644
index 170f20d..0000000
--- a/include/binder/MemoryDealer.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2007 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_MEMORY_DEALER_H
-#define ANDROID_MEMORY_DEALER_H
-
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <binder/IMemory.h>
-#include <binder/MemoryHeapBase.h>
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-class SimpleBestFitAllocator;
-
-// ----------------------------------------------------------------------------
-
-class MemoryDealer : public RefBase
-{
-public:
- MemoryDealer(size_t size, const char* name = 0);
-
- virtual sp<IMemory> allocate(size_t size);
- virtual void deallocate(size_t offset);
- virtual void dump(const char* what) const;
-
- sp<IMemoryHeap> getMemoryHeap() const { return heap(); }
-
-protected:
- virtual ~MemoryDealer();
-
-private:
- const sp<IMemoryHeap>& heap() const;
- SimpleBestFitAllocator* allocator() const;
-
- sp<IMemoryHeap> mHeap;
- SimpleBestFitAllocator* mAllocator;
-};
-
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_MEMORY_DEALER_H
diff --git a/include/binder/MemoryHeapBase.h b/include/binder/MemoryHeapBase.h
deleted file mode 100644
index bbbda9c..0000000
--- a/include/binder/MemoryHeapBase.h
+++ /dev/null
@@ -1,100 +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_MEMORY_HEAP_BASE_H
-#define ANDROID_MEMORY_HEAP_BASE_H
-
-#include <stdlib.h>
-#include <stdint.h>
-
-#include <binder/IMemory.h>
-
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-class MemoryHeapBase : public virtual BnMemoryHeap
-{
-public:
- enum {
- READ_ONLY = IMemoryHeap::READ_ONLY,
- // memory won't be mapped locally, but will be mapped in the remote
- // process.
- DONT_MAP_LOCALLY = 0x00000100,
- NO_CACHING = 0x00000200
- };
-
- /*
- * maps the memory referenced by fd. but DOESN'T take ownership
- * of the filedescriptor (it makes a copy with dup()
- */
- MemoryHeapBase(int fd, size_t size, uint32_t flags = 0, uint32_t offset = 0);
-
- /*
- * maps memory from the given device
- */
- MemoryHeapBase(const char* device, size_t size = 0, uint32_t flags = 0);
-
- /*
- * maps memory from ashmem, with the given name for debugging
- */
- MemoryHeapBase(size_t size, uint32_t flags = 0, char const* name = NULL);
-
- virtual ~MemoryHeapBase();
-
- /* implement IMemoryHeap interface */
- virtual int getHeapID() const;
- virtual void* getBase() const;
- virtual size_t getSize() const;
- virtual uint32_t getFlags() const;
- virtual uint32_t getOffset() const;
-
- const char* getDevice() const;
-
- /* this closes this heap -- use carefully */
- void dispose();
-
- /* this is only needed as a workaround, use only if you know
- * what you are doing */
- status_t setDevice(const char* device) {
- if (mDevice == 0)
- mDevice = device;
- return mDevice ? NO_ERROR : ALREADY_EXISTS;
- }
-
-protected:
- MemoryHeapBase();
- // init() takes ownership of fd
- status_t init(int fd, void *base, int size,
- int flags = 0, const char* device = NULL);
-
-private:
- status_t mapfd(int fd, size_t size, uint32_t offset = 0);
-
- int mFD;
- size_t mSize;
- void* mBase;
- uint32_t mFlags;
- const char* mDevice;
- bool mNeedUnmap;
- uint32_t mOffset;
-};
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_MEMORY_HEAP_BASE_H
diff --git a/include/binder/Parcel.h b/include/binder/Parcel.h
deleted file mode 100644
index 33b2f00..0000000
--- a/include/binder/Parcel.h
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * Copyright (C) 2005 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_PARCEL_H
-#define ANDROID_PARCEL_H
-
-#include <cutils/native_handle.h>
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-#include <utils/String16.h>
-#include <utils/Vector.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-
-class Flattenable;
-class IBinder;
-class IPCThreadState;
-class ProcessState;
-class String8;
-class TextOutput;
-
-struct flat_binder_object; // defined in support_p/binder_module.h
-
-class Parcel
-{
-public:
- class ReadableBlob;
- class WritableBlob;
-
- Parcel();
- ~Parcel();
-
- const uint8_t* data() const;
- size_t dataSize() const;
- size_t dataAvail() const;
- size_t dataPosition() const;
- size_t dataCapacity() const;
-
- status_t setDataSize(size_t size);
- void setDataPosition(size_t pos) const;
- status_t setDataCapacity(size_t size);
-
- status_t setData(const uint8_t* buffer, size_t len);
-
- status_t appendFrom(const Parcel *parcel,
- size_t start, size_t len);
-
- bool pushAllowFds(bool allowFds);
- void restoreAllowFds(bool lastValue);
-
- bool hasFileDescriptors() const;
-
- // Writes the RPC header.
- status_t writeInterfaceToken(const String16& interface);
-
- // Parses the RPC header, returning true if the interface name
- // in the header matches the expected interface from the caller.
- //
- // Additionally, enforceInterface does part of the work of
- // propagating the StrictMode policy mask, populating the current
- // IPCThreadState, which as an optimization may optionally be
- // passed in.
- bool enforceInterface(const String16& interface,
- IPCThreadState* threadState = NULL) const;
- bool checkInterface(IBinder*) const;
-
- void freeData();
-
- const size_t* objects() const;
- size_t objectsCount() const;
-
- status_t errorCheck() const;
- void setError(status_t err);
-
- status_t write(const void* data, size_t len);
- void* writeInplace(size_t len);
- status_t writeUnpadded(const void* data, size_t len);
- status_t writeInt32(int32_t val);
- status_t writeInt64(int64_t val);
- status_t writeFloat(float val);
- status_t writeDouble(double val);
- status_t writeIntPtr(intptr_t val);
- status_t writeCString(const char* str);
- status_t writeString8(const String8& str);
- status_t writeString16(const String16& str);
- 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
- // when this function returns).
- // Doesn't take ownership of the native_handle.
- status_t writeNativeHandle(const native_handle* handle);
-
- // Place a file descriptor into the parcel. The given fd must remain
- // valid for the lifetime of the parcel.
- // The Parcel does not take ownership of the given fd unless you ask it to.
- status_t writeFileDescriptor(int fd, bool takeOwnership = false);
-
- // Place a file descriptor into the parcel. A dup of the fd is made, which
- // will be closed once the parcel is destroyed.
- status_t writeDupFileDescriptor(int fd);
-
- // Writes a blob to the parcel.
- // If the blob is small, then it is stored in-place, otherwise it is
- // transferred by way of an anonymous shared memory region.
- // The caller should call release() on the blob after writing its contents.
- status_t writeBlob(size_t len, WritableBlob* outBlob);
-
- status_t writeObject(const flat_binder_object& val, bool nullMetaData);
-
- // Like Parcel.java's writeNoException(). Just writes a zero int32.
- // Currently the native implementation doesn't do any of the StrictMode
- // stack gathering and serialization that the Java implementation does.
- status_t writeNoException();
-
- void remove(size_t start, size_t amt);
-
- status_t read(void* outData, size_t len) const;
- const void* readInplace(size_t len) const;
- int32_t readInt32() const;
- status_t readInt32(int32_t *pArg) const;
- int64_t readInt64() const;
- status_t readInt64(int64_t *pArg) const;
- float readFloat() const;
- status_t readFloat(float *pArg) const;
- double readDouble() const;
- status_t readDouble(double *pArg) const;
- intptr_t readIntPtr() const;
- status_t readIntPtr(intptr_t *pArg) const;
-
- const char* readCString() const;
- String8 readString8() const;
- String16 readString16() const;
- const char16_t* readString16Inplace(size_t* outLen) const;
- sp<IBinder> readStrongBinder() const;
- wp<IBinder> readWeakBinder() const;
- status_t read(Flattenable& val) const;
-
- // Like Parcel.java's readExceptionCode(). Reads the first int32
- // off of a Parcel's header, returning 0 or the negative error
- // code on exceptions, but also deals with skipping over rich
- // response headers. Callers should use this to read & parse the
- // response headers rather than doing it by hand.
- int32_t readExceptionCode() const;
-
- // Retrieve native_handle from the parcel. This returns a copy of the
- // parcel's native_handle (the caller takes ownership). The caller
- // must free the native_handle with native_handle_close() and
- // native_handle_delete().
- native_handle* readNativeHandle() const;
-
-
- // Retrieve a file descriptor from the parcel. This returns the raw fd
- // in the parcel, which you do not own -- use dup() to get your own copy.
- int readFileDescriptor() const;
-
- // Reads a blob from the parcel.
- // The caller should call release() on the blob after reading its contents.
- status_t readBlob(size_t len, ReadableBlob* outBlob) const;
-
- const flat_binder_object* readObject(bool nullMetaData) const;
-
- // Explicitly close all file descriptors in the parcel.
- void closeFileDescriptors();
-
- typedef void (*release_func)(Parcel* parcel,
- const uint8_t* data, size_t dataSize,
- const size_t* objects, size_t objectsSize,
- void* cookie);
-
- const uint8_t* ipcData() const;
- size_t ipcDataSize() const;
- const size_t* ipcObjects() const;
- size_t ipcObjectsCount() const;
- void ipcSetDataReference(const uint8_t* data, size_t dataSize,
- const size_t* objects, size_t objectsCount,
- release_func relFunc, void* relCookie);
-
- void print(TextOutput& to, uint32_t flags = 0) const;
-
-private:
- Parcel(const Parcel& o);
- Parcel& operator=(const Parcel& o);
-
- status_t finishWrite(size_t len);
- void releaseObjects();
- void acquireObjects();
- status_t growData(size_t len);
- status_t restartWrite(size_t desired);
- status_t continueWrite(size_t desired);
- void freeDataNoInit();
- void initState();
- void scanForFds() const;
-
- template<class T>
- status_t readAligned(T *pArg) const;
-
- template<class T> T readAligned() const;
-
- template<class T>
- status_t writeAligned(T val);
-
- status_t mError;
- uint8_t* mData;
- size_t mDataSize;
- size_t mDataCapacity;
- mutable size_t mDataPos;
- size_t* mObjects;
- size_t mObjectsSize;
- size_t mObjectsCapacity;
- mutable size_t mNextObjectHint;
-
- mutable bool mFdsKnown;
- mutable bool mHasFds;
- bool mAllowFds;
-
- release_func mOwner;
- void* mOwnerCookie;
-
- class Blob {
- public:
- Blob();
- ~Blob();
-
- void release();
- inline size_t size() const { return mSize; }
-
- protected:
- void init(bool mapped, void* data, size_t size);
- void clear();
-
- bool mMapped;
- void* mData;
- size_t mSize;
- };
-
-public:
- class ReadableBlob : public Blob {
- friend class Parcel;
- public:
- inline const void* data() const { return mData; }
- };
-
- class WritableBlob : public Blob {
- friend class Parcel;
- public:
- inline void* data() { return mData; }
- };
-};
-
-// ---------------------------------------------------------------------------
-
-inline TextOutput& operator<<(TextOutput& to, const Parcel& parcel)
-{
- parcel.print(to);
- return to;
-}
-
-// ---------------------------------------------------------------------------
-
-// Generic acquire and release of objects.
-void acquire_object(const sp<ProcessState>& proc,
- const flat_binder_object& obj, const void* who);
-void release_object(const sp<ProcessState>& proc,
- const flat_binder_object& obj, const void* who);
-
-void flatten_binder(const sp<ProcessState>& proc,
- const sp<IBinder>& binder, flat_binder_object* out);
-void flatten_binder(const sp<ProcessState>& proc,
- const wp<IBinder>& binder, flat_binder_object* out);
-status_t unflatten_binder(const sp<ProcessState>& proc,
- const flat_binder_object& flat, sp<IBinder>* out);
-status_t unflatten_binder(const sp<ProcessState>& proc,
- const flat_binder_object& flat, wp<IBinder>* out);
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_PARCEL_H
diff --git a/include/binder/PermissionCache.h b/include/binder/PermissionCache.h
deleted file mode 100644
index 1171d48..0000000
--- a/include/binder/PermissionCache.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2009 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 BINDER_PERMISSION_H
-#define BINDER_PERMISSION_H
-
-#include <stdint.h>
-#include <unistd.h>
-
-#include <utils/String16.h>
-#include <utils/Singleton.h>
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-/*
- * PermissionCache caches permission checks for a given uid.
- *
- * Currently the cache is not updated when there is a permission change,
- * for instance when an application is uninstalled.
- *
- * IMPORTANT: for the reason stated above, only system permissions are safe
- * to cache. This restriction may be lifted at a later time.
- *
- */
-
-class PermissionCache : Singleton<PermissionCache> {
- struct Entry {
- String16 name;
- uid_t uid;
- bool granted;
- inline bool operator < (const Entry& e) const {
- return (uid == e.uid) ? (name < e.name) : (uid < e.uid);
- }
- };
- mutable Mutex mLock;
- // we pool all the permission names we see, as many permissions checks
- // will have identical names
- SortedVector< String16 > mPermissionNamesPool;
- // this is our cache per say. it stores pooled names.
- SortedVector< Entry > mCache;
-
- // free the whole cache, but keep the permission name pool
- void purge();
-
- status_t check(bool* granted,
- const String16& permission, uid_t uid) const;
-
- void cache(const String16& permission, uid_t uid, bool granted);
-
-public:
- PermissionCache();
-
- static bool checkCallingPermission(const String16& permission);
-
- static bool checkCallingPermission(const String16& permission,
- int32_t* outPid, int32_t* outUid);
-
- static bool checkPermission(const String16& permission,
- pid_t pid, uid_t uid);
-};
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif /* BINDER_PERMISSION_H */
diff --git a/include/binder/ProcessState.h b/include/binder/ProcessState.h
deleted file mode 100644
index 9725822..0000000
--- a/include/binder/ProcessState.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2005 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_PROCESS_STATE_H
-#define ANDROID_PROCESS_STATE_H
-
-#include <binder/IBinder.h>
-#include <utils/KeyedVector.h>
-#include <utils/String8.h>
-#include <utils/String16.h>
-
-#include <utils/threads.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-
-// Global variables
-extern int mArgC;
-extern const char* const* mArgV;
-extern int mArgLen;
-
-class IPCThreadState;
-
-class ProcessState : public virtual RefBase
-{
-public:
- static sp<ProcessState> self();
-
- void setContextObject(const sp<IBinder>& object);
- sp<IBinder> getContextObject(const sp<IBinder>& caller);
-
- void setContextObject(const sp<IBinder>& object,
- const String16& name);
- sp<IBinder> getContextObject(const String16& name,
- const sp<IBinder>& caller);
-
- void startThreadPool();
-
- typedef bool (*context_check_func)(const String16& name,
- const sp<IBinder>& caller,
- void* userData);
-
- bool isContextManager(void) const;
- bool becomeContextManager(
- context_check_func checkFunc,
- void* userData);
-
- sp<IBinder> getStrongProxyForHandle(int32_t handle);
- wp<IBinder> getWeakProxyForHandle(int32_t handle);
- void expungeHandle(int32_t handle, IBinder* binder);
-
- void setArgs(int argc, const char* const argv[]);
- int getArgC() const;
- const char* const* getArgV() const;
-
- void setArgV0(const char* txt);
-
- void spawnPooledThread(bool isMain);
-
-private:
- friend class IPCThreadState;
-
- ProcessState();
- ~ProcessState();
-
- ProcessState(const ProcessState& o);
- ProcessState& operator=(const ProcessState& o);
-
- struct handle_entry {
- IBinder* binder;
- RefBase::weakref_type* refs;
- };
-
- handle_entry* lookupHandleLocked(int32_t handle);
-
- int mDriverFD;
- void* mVMStart;
-
- mutable Mutex mLock; // protects everything below.
-
- Vector<handle_entry>mHandleToObject;
-
- bool mManagesContexts;
- context_check_func mBinderContextCheckFunc;
- void* mBinderContextUserData;
-
- KeyedVector<String16, sp<IBinder> >
- mContexts;
-
-
- String8 mRootDir;
- bool mThreadPoolStarted;
- volatile int32_t mThreadPoolSeq;
-};
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_PROCESS_STATE_H
diff --git a/include/gui/BitTube.h b/include/gui/BitTube.h
deleted file mode 100644
index 76389a0..0000000
--- a/include/gui/BitTube.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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_GUI_SENSOR_CHANNEL_H
-#define ANDROID_GUI_SENSOR_CHANNEL_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-
-
-namespace android {
-// ----------------------------------------------------------------------------
-class Parcel;
-
-class BitTube : public RefBase
-{
-public:
-
- BitTube();
- BitTube(const Parcel& data);
- virtual ~BitTube();
-
- status_t initCheck() const;
- int getFd() const;
- ssize_t write(void const* vaddr, size_t size);
- ssize_t read(void* vaddr, size_t size);
-
- status_t writeToParcel(Parcel* reply) const;
-
-private:
- int mSendFd;
- mutable int mReceiveFd;
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_GUI_SENSOR_CHANNEL_H
diff --git a/include/gui/BufferQueue.h b/include/gui/BufferQueue.h
deleted file mode 100644
index 8c21a28..0000000
--- a/include/gui/BufferQueue.h
+++ /dev/null
@@ -1,426 +0,0 @@
-/*
- * Copyright (C) 2012 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_GUI_BUFFERQUEUE_H
-#define ANDROID_GUI_BUFFERQUEUE_H
-
-#include <EGL/egl.h>
-
-#include <gui/IGraphicBufferAlloc.h>
-#include <gui/ISurfaceTexture.h>
-
-#include <ui/GraphicBuffer.h>
-
-#include <utils/String8.h>
-#include <utils/Vector.h>
-#include <utils/threads.h>
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-class BufferQueue : public BnSurfaceTexture {
-public:
- enum { MIN_UNDEQUEUED_BUFFERS = 2 };
- enum {
- MIN_ASYNC_BUFFER_SLOTS = MIN_UNDEQUEUED_BUFFERS + 1,
- MIN_SYNC_BUFFER_SLOTS = MIN_UNDEQUEUED_BUFFERS
- };
- enum { NUM_BUFFER_SLOTS = 32 };
- enum { NO_CONNECTED_API = 0 };
- enum { INVALID_BUFFER_SLOT = -1 };
-
- struct FrameAvailableListener : public virtual RefBase {
- // onFrameAvailable() is called from queueBuffer() each time an
- // additional frame becomes available for consumption. This means that
- // frames that are queued while in asynchronous mode only trigger the
- // callback if no previous frames are pending. Frames queued while in
- // synchronous mode always trigger the callback.
- //
- // This is called without any lock held and can be called concurrently
- // by multiple threads.
- virtual void onFrameAvailable() = 0;
- };
-
- // BufferQueue manages a pool of gralloc memory slots to be used
- // by producers and consumers.
- // allowSynchronousMode specifies whether or not synchronous mode can be
- // enabled.
- BufferQueue(bool allowSynchronousMode = true);
- virtual ~BufferQueue();
-
- virtual int query(int what, int* value);
-
- // setBufferCount updates the number of available buffer slots. After
- // calling this all buffer slots are both unallocated and owned by the
- // BufferQueue object (i.e. they are not owned by the client).
- virtual status_t setBufferCount(int bufferCount);
-
- virtual status_t requestBuffer(int slot, sp<GraphicBuffer>* buf);
-
- // dequeueBuffer gets the next buffer slot index for the client to use. If a
- // buffer slot is available then that slot index is written to the location
- // pointed to by the buf argument and a status of OK is returned. If no
- // slot is available then a status of -EBUSY is returned and buf is
- // unmodified.
- // The width and height parameters must be no greater than the minimum of
- // GL_MAX_VIEWPORT_DIMS and GL_MAX_TEXTURE_SIZE (see: glGetIntegerv).
- // An error due to invalid dimensions might not be reported until
- // updateTexImage() is called.
- virtual status_t dequeueBuffer(int *buf, uint32_t width, uint32_t height,
- uint32_t format, uint32_t usage);
-
- // queueBuffer returns a filled buffer to the BufferQueue. In addition, a
- // timestamp must be provided for the buffer. The timestamp is in
- // nanoseconds, and must be monotonically increasing. Its other semantics
- // (zero point, etc) are client-dependent and should be documented by the
- // client.
- virtual status_t queueBuffer(int buf, int64_t timestamp,
- uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform);
- virtual void cancelBuffer(int buf);
- virtual status_t setCrop(const Rect& reg);
- virtual status_t setTransform(uint32_t transform);
- virtual status_t setScalingMode(int mode);
-
- // setSynchronousMode set whether dequeueBuffer is synchronous or
- // asynchronous. In synchronous mode, dequeueBuffer blocks until
- // a buffer is available, the currently bound buffer can be dequeued and
- // queued buffers will be retired in order.
- // The default mode is asynchronous.
- virtual status_t setSynchronousMode(bool enabled);
-
- // connect attempts to connect a producer client API to the BufferQueue.
- // This must be called before any other ISurfaceTexture methods are called
- // except for getAllocator.
- //
- // This method will fail if the connect was previously called on the
- // BufferQueue and no corresponding disconnect call was made.
- virtual status_t connect(int api,
- uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform);
-
- // disconnect attempts to disconnect a producer client API from the
- // BufferQueue. Calling this method will cause any subsequent calls to other
- // ISurfaceTexture methods to fail except for getAllocator and connect.
- // Successfully calling connect after this will allow the other methods to
- // succeed again.
- //
- // This method will fail if the the BufferQueue is not currently
- // connected to the specified client API.
- virtual status_t disconnect(int api);
-
- // dump our state in a String
- virtual void dump(String8& result) const;
- virtual void dump(String8& result, const char* prefix, char* buffer, size_t SIZE) const;
-
- // public facing structure for BufferSlot
- struct BufferItem {
-
- BufferItem()
- :
- mTransform(0),
- mScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE),
- mTimestamp(0),
- mFrameNumber(0),
- mBuf(INVALID_BUFFER_SLOT) {
- mCrop.makeInvalid();
- }
- // mGraphicBuffer points to the buffer allocated for this slot or is NULL
- // if no buffer has been allocated.
- sp<GraphicBuffer> mGraphicBuffer;
-
- // mCrop is the current crop rectangle for this buffer slot. This gets
- // set to mNextCrop each time queueBuffer gets called for this buffer.
- Rect mCrop;
-
- // mTransform is the current transform flags for this buffer slot. This
- // gets set to mNextTransform each time queueBuffer gets called for this
- // slot.
- uint32_t mTransform;
-
- // mScalingMode is the current scaling mode for this buffer slot. This
- // gets set to mNextScalingMode each time queueBuffer gets called for
- // this slot.
- uint32_t mScalingMode;
-
- // mTimestamp is the current timestamp for this buffer slot. This gets
- // to set by queueBuffer each time this slot is queued.
- int64_t mTimestamp;
-
- // mFrameNumber is the number of the queued frame for this slot.
- uint64_t mFrameNumber;
-
- // buf is the slot index of this buffer
- int mBuf;
-
- };
-
- // The following public functions is the consumer facing interface
-
- // acquire consumes a buffer by transferring its ownership to a consumer.
- // buffer contains the GraphicBuffer and its corresponding information.
- // buffer.mGraphicsBuffer will be NULL when the buffer has been already
- // acquired by the consumer.
-
- status_t acquire(BufferItem *buffer);
-
- // releaseBuffer releases a buffer slot from the consumer back to the
- // BufferQueue pending a fence sync.
- status_t releaseBuffer(int buf, EGLDisplay display, EGLSyncKHR fence);
-
- // consumerDisconnect disconnects a consumer from the BufferQueue. All
- // buffers will be freed.
- status_t consumerDisconnect();
-
- // setDefaultBufferSize is used to set the size of buffers returned by
- // requestBuffers when a with and height of zero is requested.
- status_t setDefaultBufferSize(uint32_t w, uint32_t h);
-
- // setBufferCountServer set the buffer count. If the client has requested
- // a buffer count using setBufferCount, the server-buffer count will
- // take effect once the client sets the count back to zero.
- status_t setBufferCountServer(int bufferCount);
-
- // isSynchronousMode returns whether the SurfaceTexture is currently in
- // synchronous mode.
- bool isSynchronousMode() const;
-
- // setConsumerName sets the name used in logging
- void setConsumerName(const String8& name);
-
- // setFrameAvailableListener sets the listener object that will be notified
- // when a new frame becomes available.
- void setFrameAvailableListener(const sp<FrameAvailableListener>& listener);
-
-
-private:
- // freeBufferLocked frees the resources (both GraphicBuffer and EGLImage)
- // for the given slot.
- void freeBufferLocked(int index);
-
- // freeAllBuffersLocked frees the resources (both GraphicBuffer and
- // EGLImage) for all slots.
- void freeAllBuffersLocked();
-
- // freeAllBuffersExceptHeadLocked frees the resources (both GraphicBuffer
- // and EGLImage) for all slots except the head of mQueue
- void freeAllBuffersExceptHeadLocked();
-
- // drainQueueLocked drains the buffer queue if we're in synchronous mode
- // returns immediately otherwise. It returns NO_INIT if the BufferQueue
- // became abandoned or disconnected during this call.
- status_t drainQueueLocked();
-
- // drainQueueAndFreeBuffersLocked drains the buffer queue if we're in
- // synchronous mode and free all buffers. In asynchronous mode, all buffers
- // are freed except the current buffer.
- status_t drainQueueAndFreeBuffersLocked();
-
- status_t setBufferCountServerLocked(int bufferCount);
-
- struct BufferSlot {
-
- BufferSlot()
- : mEglDisplay(EGL_NO_DISPLAY),
- mBufferState(BufferSlot::FREE),
- mRequestBufferCalled(false),
- mTransform(0),
- mScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE),
- mTimestamp(0),
- mFrameNumber(0),
- mFence(EGL_NO_SYNC_KHR),
- mAcquireCalled(false) {
- mCrop.makeInvalid();
- }
-
- // mGraphicBuffer points to the buffer allocated for this slot or is NULL
- // if no buffer has been allocated.
- sp<GraphicBuffer> mGraphicBuffer;
-
- // mEglDisplay is the EGLDisplay used to create mEglImage.
- EGLDisplay mEglDisplay;
-
- // BufferState represents the different states in which a buffer slot
- // can be.
- enum BufferState {
- // FREE indicates that the buffer is not currently being used and
- // will not be used in the future until it gets dequeued and
- // subsequently queued by the client.
- // aka "owned by BufferQueue, ready to be dequeued"
- FREE = 0,
-
- // DEQUEUED indicates that the buffer has been dequeued by the
- // client, but has not yet been queued or canceled. The buffer is
- // considered 'owned' by the client, and the server should not use
- // it for anything.
- //
- // Note that when in synchronous-mode (mSynchronousMode == true),
- // the buffer that's currently attached to the texture may be
- // dequeued by the client. That means that the current buffer can
- // be in either the DEQUEUED or QUEUED state. In asynchronous mode,
- // however, the current buffer is always in the QUEUED state.
- // aka "owned by producer, ready to be queued"
- DEQUEUED = 1,
-
- // QUEUED indicates that the buffer has been queued by the client,
- // and has not since been made available for the client to dequeue.
- // Attaching the buffer to the texture does NOT transition the
- // buffer away from the QUEUED state. However, in Synchronous mode
- // the current buffer may be dequeued by the client under some
- // circumstances. See the note about the current buffer in the
- // documentation for DEQUEUED.
- // aka "owned by BufferQueue, ready to be acquired"
- QUEUED = 2,
-
- // aka "owned by consumer, ready to be released"
- ACQUIRED = 3
- };
-
- // mBufferState is the current state of this buffer slot.
- BufferState mBufferState;
-
- // mRequestBufferCalled is used for validating that the client did
- // call requestBuffer() when told to do so. Technically this is not
- // needed but useful for debugging and catching client bugs.
- bool mRequestBufferCalled;
-
- // mCrop is the current crop rectangle for this buffer slot. This gets
- // set to mNextCrop each time queueBuffer gets called for this buffer.
- Rect mCrop;
-
- // mTransform is the current transform flags for this buffer slot. This
- // gets set to mNextTransform each time queueBuffer gets called for this
- // slot.
- uint32_t mTransform;
-
- // mScalingMode is the current scaling mode for this buffer slot. This
- // gets set to mNextScalingMode each time queueBuffer gets called for
- // this slot.
- uint32_t mScalingMode;
-
- // mTimestamp is the current timestamp for this buffer slot. This gets
- // to set by queueBuffer each time this slot is queued.
- int64_t mTimestamp;
-
- // mFrameNumber is the number of the queued frame for this slot.
- uint64_t mFrameNumber;
-
- // mFence is the EGL sync object that must signal before the buffer
- // associated with this buffer slot may be dequeued. It is initialized
- // to EGL_NO_SYNC_KHR when the buffer is created and (optionally, based
- // on a compile-time option) set to a new sync object in updateTexImage.
- EGLSyncKHR mFence;
-
- // Indicates whether this buffer has been seen by a consumer yet
- bool mAcquireCalled;
- };
-
- // mSlots is the array of buffer slots that must be mirrored on the client
- // side. This allows buffer ownership to be transferred between the client
- // and server without sending a GraphicBuffer over binder. The entire array
- // is initialized to NULL at construction time, and buffers are allocated
- // for a slot when requestBuffer is called with that slot's index.
- BufferSlot mSlots[NUM_BUFFER_SLOTS];
-
- // mDefaultWidth holds the default width of allocated buffers. It is used
- // in requestBuffers() if a width and height of zero is specified.
- uint32_t mDefaultWidth;
-
- // mDefaultHeight holds the default height of allocated buffers. It is used
- // in requestBuffers() if a width and height of zero is specified.
- uint32_t mDefaultHeight;
-
- // mPixelFormat holds the pixel format of allocated buffers. It is used
- // in requestBuffers() if a format of zero is specified.
- uint32_t mPixelFormat;
-
- // mBufferCount is the number of buffer slots that the client and server
- // must maintain. It defaults to MIN_ASYNC_BUFFER_SLOTS and can be changed
- // by calling setBufferCount or setBufferCountServer
- int mBufferCount;
-
- // mClientBufferCount is the number of buffer slots requested by the client.
- // The default is zero, which means the client doesn't care how many buffers
- // there is.
- int mClientBufferCount;
-
- // mServerBufferCount buffer count requested by the server-side
- int mServerBufferCount;
-
- // mNextCrop is the crop rectangle that will be used for the next buffer
- // that gets queued. It is set by calling setCrop.
- Rect mNextCrop;
-
- // mNextTransform is the transform identifier that will be used for the next
- // buffer that gets queued. It is set by calling setTransform.
- uint32_t mNextTransform;
-
- // mNextScalingMode is the scaling mode that will be used for the next
- // buffers that get queued. It is set by calling setScalingMode.
- int mNextScalingMode;
-
- // mGraphicBufferAlloc is the connection to SurfaceFlinger that is used to
- // allocate new GraphicBuffer objects.
- sp<IGraphicBufferAlloc> mGraphicBufferAlloc;
-
- // 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.
- sp<FrameAvailableListener> mFrameAvailableListener;
-
- // mSynchronousMode whether we're in synchronous mode or not
- bool mSynchronousMode;
-
- // mAllowSynchronousMode whether we allow synchronous mode or not
- const bool mAllowSynchronousMode;
-
- // mConnectedApi indicates the API that is currently connected to this
- // BufferQueue. It defaults to NO_CONNECTED_API (= 0), and gets updated
- // by the connect and disconnect methods.
- int mConnectedApi;
-
- // mDequeueCondition condition used for dequeueBuffer in synchronous mode
- mutable Condition mDequeueCondition;
-
- // mQueue is a FIFO of queued buffers used in synchronous mode
- typedef Vector<int> Fifo;
- Fifo mQueue;
-
- // mAbandoned indicates that the BufferQueue will no longer be used to
- // consume images buffers pushed to it using the ISurfaceTexture interface.
- // It is initialized to false, and set to true in the abandon method. A
- // BufferQueue that has been abandoned will return the NO_INIT error from
- // all ISurfaceTexture methods capable of returning an error.
- bool mAbandoned;
-
- // mName is a string used to identify the BufferQueue in log messages.
- // It is set by the setName method.
- String8 mConsumerName;
-
- // mMutex is the mutex used to prevent concurrent access to the member
- // variables of BufferQueue objects. It must be locked whenever the
- // member variables are accessed.
- mutable Mutex mMutex;
-
- // mFrameCounter is the free running counter, incremented for every buffer queued
- // with the surface Texture.
- uint64_t mFrameCounter;
-
- bool mBufferHasBeenQueued;
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_GUI_BUFFERQUEUE_H
diff --git a/include/gui/DisplayEventReceiver.h b/include/gui/DisplayEventReceiver.h
deleted file mode 100644
index 7bca8d6..0000000
--- a/include/gui/DisplayEventReceiver.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2011 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_GUI_DISPLAY_EVENT_H
-#define ANDROID_GUI_DISPLAY_EVENT_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-#include <utils/Timers.h>
-
-#include <binder/IInterface.h>
-
-// ----------------------------------------------------------------------------
-
-namespace android {
-
-// ----------------------------------------------------------------------------
-
-class BitTube;
-class IDisplayEventConnection;
-
-// ----------------------------------------------------------------------------
-
-class DisplayEventReceiver {
-public:
- enum {
- DISPLAY_EVENT_VSYNC = 'vsyn'
- };
-
- struct Event {
-
- struct Header {
- uint32_t type;
- nsecs_t timestamp;
- };
-
- struct VSync {
- uint32_t count;
- };
-
- Header header;
- union {
- VSync vsync;
- };
- };
-
-public:
- /*
- * DisplayEventReceiver creates and registers an event connection with
- * SurfaceFlinger. VSync events are disabled by default. Call setVSyncRate
- * or requestNextVsync to receive them.
- * Other events start being delivered immediately.
- */
- DisplayEventReceiver();
-
- /*
- * ~DisplayEventReceiver severs the connection with SurfaceFlinger, new events
- * stop being delivered immediately. Note that the queue could have
- * some events pending. These will be delivered.
- */
- ~DisplayEventReceiver();
-
- /*
- * initCheck returns the state of DisplayEventReceiver after construction.
- */
- status_t initCheck() const;
-
- /*
- * getFd returns the file descriptor to use to receive events.
- * OWNERSHIP IS RETAINED by DisplayEventReceiver. DO NOT CLOSE this
- * file-descriptor.
- */
- int getFd() const;
-
- /*
- * getEvents reads event from the queue and returns how many events were
- * read. Returns 0 if there are no more events or a negative error code.
- * If NOT_ENOUGH_DATA is returned, the object has become invalid forever, it
- * should be destroyed and getEvents() shouldn't be called again.
- */
- ssize_t getEvents(Event* events, size_t count);
- static ssize_t getEvents(const sp<BitTube>& dataChannel,
- Event* events, size_t count);
-
- /*
- * setVsyncRate() sets the Event::VSync delivery rate. A value of
- * 1 returns every Event::VSync. A value of 2 returns every other event,
- * etc... a value of 0 returns no event unless requestNextVsync() has
- * been called.
- */
- status_t setVsyncRate(uint32_t count);
-
- /*
- * requestNextVsync() schedules the next Event::VSync. It has no effect
- * if the vsync rate is > 0.
- */
- status_t requestNextVsync();
-
-private:
- sp<IDisplayEventConnection> mEventConnection;
- sp<BitTube> mDataChannel;
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_GUI_DISPLAY_EVENT_H
diff --git a/include/gui/IDisplayEventConnection.h b/include/gui/IDisplayEventConnection.h
deleted file mode 100644
index 86247de..0000000
--- a/include/gui/IDisplayEventConnection.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2011 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_GUI_IDISPLAY_EVENT_CONNECTION_H
-#define ANDROID_GUI_IDISPLAY_EVENT_CONNECTION_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-
-#include <binder/IInterface.h>
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-class BitTube;
-
-class IDisplayEventConnection : public IInterface
-{
-public:
-
- DECLARE_META_INTERFACE(DisplayEventConnection);
-
- /*
- * getDataChannel() returns a BitTube where to receive the events from
- */
- virtual sp<BitTube> getDataChannel() const = 0;
-
- /*
- * setVsyncRate() sets the vsync event delivery rate. A value of
- * 1 returns every vsync events. A value of 2 returns every other events,
- * etc... a value of 0 returns no event unless requestNextVsync() has
- * been called.
- */
- virtual void setVsyncRate(uint32_t count) = 0;
-
- /*
- * requestNextVsync() schedules the next vsync event. It has no effect
- * if the vsync rate is > 0.
- */
- virtual void requestNextVsync() = 0; // asynchronous
-};
-
-// ----------------------------------------------------------------------------
-
-class BnDisplayEventConnection : public BnInterface<IDisplayEventConnection>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_GUI_IDISPLAY_EVENT_CONNECTION_H
diff --git a/include/gui/IGraphicBufferAlloc.h b/include/gui/IGraphicBufferAlloc.h
deleted file mode 100644
index cee41d9..0000000
--- a/include/gui/IGraphicBufferAlloc.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2011 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_GUI_IGRAPHIC_BUFFER_ALLOC_H
-#define ANDROID_GUI_IGRAPHIC_BUFFER_ALLOC_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <binder/IInterface.h>
-#include <ui/PixelFormat.h>
-#include <utils/RefBase.h>
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-class GraphicBuffer;
-
-class IGraphicBufferAlloc : public IInterface
-{
-public:
- DECLARE_META_INTERFACE(GraphicBufferAlloc);
-
- /* Create a new GraphicBuffer for the client to use.
- */
- virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h,
- PixelFormat format, uint32_t usage, status_t* error) = 0;
-};
-
-// ----------------------------------------------------------------------------
-
-class BnGraphicBufferAlloc : public BnInterface<IGraphicBufferAlloc>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-// ----------------------------------------------------------------------------
-
-}; // namespace android
-
-#endif // ANDROID_GUI_IGRAPHIC_BUFFER_ALLOC_H
diff --git a/include/gui/ISensorEventConnection.h b/include/gui/ISensorEventConnection.h
deleted file mode 100644
index 749065e..0000000
--- a/include/gui/ISensorEventConnection.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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_GUI_ISENSOR_EVENT_CONNECTION_H
-#define ANDROID_GUI_ISENSOR_EVENT_CONNECTION_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-
-#include <binder/IInterface.h>
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-class BitTube;
-
-class ISensorEventConnection : public IInterface
-{
-public:
- DECLARE_META_INTERFACE(SensorEventConnection);
-
- virtual sp<BitTube> getSensorChannel() const = 0;
- virtual status_t enableDisable(int handle, bool enabled) = 0;
- virtual status_t setEventRate(int handle, nsecs_t ns) = 0;
-};
-
-// ----------------------------------------------------------------------------
-
-class BnSensorEventConnection : public BnInterface<ISensorEventConnection>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_GUI_ISENSOR_EVENT_CONNECTION_H
diff --git a/include/gui/ISensorServer.h b/include/gui/ISensorServer.h
deleted file mode 100644
index 9c8afc5..0000000
--- a/include/gui/ISensorServer.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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_GUI_ISENSORSERVER_H
-#define ANDROID_GUI_ISENSORSERVER_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-
-#include <binder/IInterface.h>
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-class Sensor;
-class ISensorEventConnection;
-
-class ISensorServer : public IInterface
-{
-public:
- DECLARE_META_INTERFACE(SensorServer);
-
- virtual Vector<Sensor> getSensorList() = 0;
- virtual sp<ISensorEventConnection> createSensorEventConnection() = 0;
-};
-
-// ----------------------------------------------------------------------------
-
-class BnSensorServer : public BnInterface<ISensorServer>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_GUI_ISENSORSERVER_H
diff --git a/include/gui/ISurface.h b/include/gui/ISurface.h
deleted file mode 100644
index c0ff9fc..0000000
--- a/include/gui/ISurface.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2007 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_GUI_ISURFACE_H
-#define ANDROID_GUI_ISURFACE_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-
-#include <binder/IInterface.h>
-
-#include <ui/PixelFormat.h>
-
-namespace android {
-
-typedef int32_t SurfaceID;
-
-class ISurfaceTexture;
-
-class ISurface : public IInterface
-{
-protected:
- enum {
- GET_SURFACE_TEXTURE = IBinder::FIRST_CALL_TRANSACTION,
- };
-
-public:
- DECLARE_META_INTERFACE(Surface);
-
- virtual sp<ISurfaceTexture> getSurfaceTexture() const = 0;
-};
-
-// ----------------------------------------------------------------------------
-
-class BnSurface : public BnInterface<ISurface>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-// ----------------------------------------------------------------------------
-
-}; // namespace android
-
-#endif // ANDROID_GUI_ISURFACE_H
diff --git a/include/gui/ISurfaceComposer.h b/include/gui/ISurfaceComposer.h
deleted file mode 100644
index f3c0ecb..0000000
--- a/include/gui/ISurfaceComposer.h
+++ /dev/null
@@ -1,174 +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_GUI_ISURFACE_COMPOSER_H
-#define ANDROID_GUI_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 <gui/IGraphicBufferAlloc.h>
-#include <gui/ISurfaceComposerClient.h>
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-class ComposerState;
-class IDisplayEventConnection;
-class IMemoryHeap;
-
-class ISurfaceComposer : public IInterface
-{
-public:
- DECLARE_META_INTERFACE(SurfaceComposer);
-
- enum { // (keep in sync with Surface.java)
- eHidden = 0x00000004,
- eDestroyBackbuffer = 0x00000020,
- eSecure = 0x00000080,
- eNonPremultiplied = 0x00000100,
- eOpaque = 0x00000400,
- eProtectedByApp = 0x00000800,
- eProtectedByDRM = 0x00001000,
-
- eFXSurfaceNormal = 0x00000000,
- eFXSurfaceBlur = 0x00010000,
- eFXSurfaceDim = 0x00020000,
- eFXSurfaceScreenshot= 0x00030000,
- eFXSurfaceMask = 0x000F0000,
- };
-
- enum {
- ePositionChanged = 0x00000001,
- eLayerChanged = 0x00000002,
- eSizeChanged = 0x00000004,
- eAlphaChanged = 0x00000008,
- eMatrixChanged = 0x00000010,
- eTransparentRegionChanged = 0x00000020,
- eVisibilityChanged = 0x00000040,
- eFreezeTintChanged = 0x00000080,
- };
-
- enum {
- eLayerHidden = 0x01,
- eLayerFrozen = 0x02,
- eLayerDither = 0x04,
- eLayerFilter = 0x08,
- eLayerBlurFreeze = 0x10
- };
-
- enum {
- eOrientationDefault = 0,
- eOrientation90 = 1,
- eOrientation180 = 2,
- eOrientation270 = 3,
- eOrientationUnchanged = 4,
- eOrientationSwapMask = 0x01
- };
-
- enum {
- eSynchronous = 0x01,
- };
-
- enum {
- eElectronBeamAnimationOn = 0x01,
- eElectronBeamAnimationOff = 0x10
- };
-
- /* create connection with surface flinger, requires
- * ACCESS_SURFACE_FLINGER permission
- */
- virtual sp<ISurfaceComposerClient> createConnection() = 0;
-
- /* create a graphic buffer allocator
- */
- virtual sp<IGraphicBufferAlloc> createGraphicBufferAlloc() = 0;
-
- /* retrieve the control block */
- virtual sp<IMemoryHeap> getCblk() const = 0;
-
- /* open/close transactions. requires ACCESS_SURFACE_FLINGER permission */
- virtual void setTransactionState(const Vector<ComposerState>& state,
- int orientation, uint32_t flags) = 0;
-
- /* signal that we're done booting.
- * Requires ACCESS_SURFACE_FLINGER permission
- */
- virtual void bootFinished() = 0;
-
- /* Capture the specified screen. requires READ_FRAME_BUFFER permission
- * This function will fail if there is a secure window on screen.
- */
- virtual status_t captureScreen(DisplayID dpy,
- sp<IMemoryHeap>* heap,
- uint32_t* width, uint32_t* height, PixelFormat* format,
- uint32_t reqWidth, uint32_t reqHeight,
- uint32_t minLayerZ, uint32_t maxLayerZ) = 0;
-
- /* triggers screen off animation */
- virtual status_t turnElectronBeamOff(int32_t mode) = 0;
-
- /* triggers screen on animation */
- virtual status_t turnElectronBeamOn(int32_t mode) = 0;
-
- /* verify that an ISurfaceTexture was created by SurfaceFlinger.
- */
- virtual bool authenticateSurfaceTexture(
- const sp<ISurfaceTexture>& surface) const = 0;
-
- /* return an IDisplayEventConnection */
- virtual sp<IDisplayEventConnection> createDisplayEventConnection() = 0;
-};
-
-// ----------------------------------------------------------------------------
-
-class BnSurfaceComposer : public BnInterface<ISurfaceComposer>
-{
-public:
- enum {
- // Note: BOOT_FINISHED must remain this value, it is called from
- // Java by ActivityManagerService.
- BOOT_FINISHED = IBinder::FIRST_CALL_TRANSACTION,
- CREATE_CONNECTION,
- CREATE_GRAPHIC_BUFFER_ALLOC,
- GET_CBLK,
- SET_TRANSACTION_STATE,
- SET_ORIENTATION,
- CAPTURE_SCREEN,
- TURN_ELECTRON_BEAM_OFF,
- TURN_ELECTRON_BEAM_ON,
- AUTHENTICATE_SURFACE,
- CREATE_DISPLAY_EVENT_CONNECTION,
- };
-
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-// ----------------------------------------------------------------------------
-
-}; // namespace android
-
-#endif // ANDROID_GUI_ISURFACE_COMPOSER_H
diff --git a/include/gui/ISurfaceComposerClient.h b/include/gui/ISurfaceComposerClient.h
deleted file mode 100644
index c793933..0000000
--- a/include/gui/ISurfaceComposerClient.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2007 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_GUI_ISURFACE_COMPOSER_CLIENT_H
-#define ANDROID_GUI_ISURFACE_COMPOSER_CLIENT_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-
-#include <binder/IInterface.h>
-
-#include <ui/PixelFormat.h>
-
-#include <gui/ISurface.h>
-
-namespace android {
-
-// ----------------------------------------------------------------------------
-
-typedef int32_t DisplayID;
-
-// ----------------------------------------------------------------------------
-
-class ISurfaceComposerClient : public IInterface
-{
-public:
- DECLARE_META_INTERFACE(SurfaceComposerClient);
-
- struct surface_data_t {
- int32_t token;
- int32_t identity;
- status_t readFromParcel(const Parcel& parcel);
- status_t writeToParcel(Parcel* parcel) const;
- };
-
- /*
- * Requires ACCESS_SURFACE_FLINGER permission
- */
- virtual sp<ISurface> createSurface( surface_data_t* data,
- const String8& name,
- DisplayID display,
- uint32_t w,
- uint32_t h,
- PixelFormat format,
- uint32_t flags) = 0;
-
- /*
- * Requires ACCESS_SURFACE_FLINGER permission
- */
- virtual status_t destroySurface(SurfaceID sid) = 0;
-};
-
-// ----------------------------------------------------------------------------
-
-class BnSurfaceComposerClient : public BnInterface<ISurfaceComposerClient>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-// ----------------------------------------------------------------------------
-
-}; // namespace android
-
-#endif // ANDROID_GUI_ISURFACE_COMPOSER_CLIENT_H
diff --git a/include/gui/ISurfaceTexture.h b/include/gui/ISurfaceTexture.h
deleted file mode 100644
index 50626a0..0000000
--- a/include/gui/ISurfaceTexture.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * 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_GUI_ISURFACETEXTURE_H
-#define ANDROID_GUI_ISURFACETEXTURE_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-
-#include <binder/IInterface.h>
-
-#include <ui/GraphicBuffer.h>
-#include <ui/Rect.h>
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-class SurfaceTextureClient;
-
-class ISurfaceTexture : public IInterface
-{
-public:
- DECLARE_META_INTERFACE(SurfaceTexture);
-
-protected:
- friend class SurfaceTextureClient;
-
- enum {
- BUFFER_NEEDS_REALLOCATION = 0x1,
- RELEASE_ALL_BUFFERS = 0x2,
- };
-
- // requestBuffer requests a new buffer for the given index. The server (i.e.
- // the ISurfaceTexture implementation) assigns the newly created buffer to
- // the given slot index, and the client is expected to mirror the
- // slot->buffer mapping so that it's not necessary to transfer a
- // GraphicBuffer for every dequeue operation.
- virtual status_t requestBuffer(int slot, sp<GraphicBuffer>* buf) = 0;
-
- // setBufferCount sets the number of buffer slots available. Calling this
- // will also cause all buffer slots to be emptied. The caller should empty
- // its mirrored copy of the buffer slots when calling this method.
- virtual status_t setBufferCount(int bufferCount) = 0;
-
- // dequeueBuffer requests a new buffer slot for the client to use. Ownership
- // of the slot is transfered to the client, meaning that the server will not
- // use the contents of the buffer associated with that slot. The slot index
- // returned may or may not contain a buffer. If the slot is empty the client
- // should call requestBuffer to assign a new buffer to that slot. The client
- // is expected to either call cancelBuffer on the dequeued slot or to fill
- // in the contents of its associated buffer contents and call queueBuffer.
- // If dequeueBuffer return BUFFER_NEEDS_REALLOCATION, the client is
- // expected to call requestBuffer immediately.
- virtual status_t dequeueBuffer(int *slot, uint32_t w, uint32_t h,
- uint32_t format, uint32_t usage) = 0;
-
- // queueBuffer indicates that the client has finished filling in the
- // contents of the buffer associated with slot and transfers ownership of
- // that slot back to the server. It is not valid to call queueBuffer on a
- // slot that is not owned by the client or one for which a buffer associated
- // via requestBuffer. In addition, a timestamp must be provided by the
- // client for this buffer. The timestamp is measured in nanoseconds, and
- // must be monotonically increasing. Its other properties (zero point, etc)
- // are client-dependent, and should be documented by the client.
- //
- // outWidth, outHeight and outTransform are filled with the default width
- // and height of the window and current transform applied to buffers,
- // respectively.
- virtual status_t queueBuffer(int slot, int64_t timestamp,
- uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) = 0;
-
- // cancelBuffer indicates that the client does not wish to fill in the
- // buffer associated with slot and transfers ownership of the slot back to
- // the server.
- virtual void cancelBuffer(int slot) = 0;
-
- virtual status_t setCrop(const Rect& reg) = 0;
- virtual status_t setTransform(uint32_t transform) = 0;
- virtual status_t setScalingMode(int mode) = 0;
-
- // query retrieves some information for this surface
- // 'what' tokens allowed are that of android_natives.h
- virtual int query(int what, int* value) = 0;
-
- // setSynchronousMode set whether dequeueBuffer is synchronous or
- // asynchronous. In synchronous mode, dequeueBuffer blocks until
- // a buffer is available, the currently bound buffer can be dequeued and
- // queued buffers will be retired in order.
- // The default mode is asynchronous.
- virtual status_t setSynchronousMode(bool enabled) = 0;
-
- // connect attempts to connect a client API to the SurfaceTexture. This
- // must be called before any other ISurfaceTexture methods are called except
- // for getAllocator.
- //
- // This method will fail if the connect was previously called on the
- // SurfaceTexture and no corresponding disconnect call was made.
- //
- // outWidth, outHeight and outTransform are filled with the default width
- // and height of the window and current transform applied to buffers,
- // respectively.
- virtual status_t connect(int api,
- uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) = 0;
-
- // disconnect attempts to disconnect a client API from the SurfaceTexture.
- // Calling this method will cause any subsequent calls to other
- // ISurfaceTexture methods to fail except for getAllocator and connect.
- // Successfully calling connect after this will allow the other methods to
- // succeed again.
- //
- // This method will fail if the the SurfaceTexture is not currently
- // connected to the specified client API.
- virtual status_t disconnect(int api) = 0;
-};
-
-// ----------------------------------------------------------------------------
-
-class BnSurfaceTexture : public BnInterface<ISurfaceTexture>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_GUI_ISURFACETEXTURE_H
diff --git a/include/gui/Sensor.h b/include/gui/Sensor.h
deleted file mode 100644
index e59757a..0000000
--- a/include/gui/Sensor.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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_GUI_SENSOR_H
-#define ANDROID_GUI_SENSOR_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/Flattenable.h>
-#include <utils/String8.h>
-#include <utils/Timers.h>
-
-#include <hardware/sensors.h>
-
-#include <android/sensor.h>
-
-// ----------------------------------------------------------------------------
-// Concrete types for the NDK
-struct ASensor { };
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-class Parcel;
-
-// ----------------------------------------------------------------------------
-
-class Sensor : public ASensor, public Flattenable
-{
-public:
- enum {
- TYPE_ACCELEROMETER = ASENSOR_TYPE_ACCELEROMETER,
- TYPE_MAGNETIC_FIELD = ASENSOR_TYPE_MAGNETIC_FIELD,
- TYPE_GYROSCOPE = ASENSOR_TYPE_GYROSCOPE,
- TYPE_LIGHT = ASENSOR_TYPE_LIGHT,
- TYPE_PROXIMITY = ASENSOR_TYPE_PROXIMITY
- };
-
- Sensor();
- Sensor(struct sensor_t const* hwSensor);
- virtual ~Sensor();
-
- const String8& getName() const;
- const String8& getVendor() const;
- int32_t getHandle() const;
- int32_t getType() const;
- float getMinValue() const;
- float getMaxValue() const;
- float getResolution() const;
- float getPowerUsage() const;
- int32_t getMinDelay() const;
- nsecs_t getMinDelayNs() const;
- int32_t getVersion() const;
-
- // Flattenable interface
- virtual size_t getFlattenedSize() const;
- virtual size_t getFdCount() const;
- virtual status_t flatten(void* buffer, size_t size,
- int fds[], size_t count) const;
- virtual status_t unflatten(void const* buffer, size_t size,
- int fds[], size_t count);
-
-private:
- String8 mName;
- String8 mVendor;
- int32_t mHandle;
- int32_t mType;
- float mMinValue;
- float mMaxValue;
- float mResolution;
- float mPower;
- int32_t mMinDelay;
- int32_t mVersion;
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_GUI_SENSOR_H
diff --git a/include/gui/SensorEventQueue.h b/include/gui/SensorEventQueue.h
deleted file mode 100644
index ef7c6e3..0000000
--- a/include/gui/SensorEventQueue.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_SENSOR_EVENT_QUEUE_H
-#define ANDROID_SENSOR_EVENT_QUEUE_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-#include <utils/Timers.h>
-
-#include <gui/BitTube.h>
-
-// ----------------------------------------------------------------------------
-
-struct ALooper;
-struct ASensorEvent;
-
-// Concrete types for the NDK
-struct ASensorEventQueue {
- ALooper* looper;
-};
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-class ISensorEventConnection;
-class Sensor;
-class Looper;
-
-// ----------------------------------------------------------------------------
-
-class SensorEventQueue : public ASensorEventQueue, public RefBase
-{
-public:
- SensorEventQueue(const sp<ISensorEventConnection>& connection);
- virtual ~SensorEventQueue();
- virtual void onFirstRef();
-
- int getFd() const;
- ssize_t write(ASensorEvent const* events, size_t numEvents);
- ssize_t read(ASensorEvent* events, size_t numEvents);
-
- status_t waitForEvent() const;
- status_t wake() const;
-
- status_t enableSensor(Sensor const* sensor) const;
- status_t disableSensor(Sensor const* sensor) const;
- status_t setEventRate(Sensor const* sensor, nsecs_t ns) const;
-
- // these are here only to support SensorManager.java
- status_t enableSensor(int32_t handle, int32_t us) const;
- status_t disableSensor(int32_t handle) const;
-
-private:
- sp<Looper> getLooper() const;
- sp<ISensorEventConnection> mSensorEventConnection;
- sp<BitTube> mSensorChannel;
- mutable Mutex mLock;
- mutable sp<Looper> mLooper;
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_SENSOR_EVENT_QUEUE_H
diff --git a/include/gui/SensorManager.h b/include/gui/SensorManager.h
deleted file mode 100644
index 3176462..0000000
--- a/include/gui/SensorManager.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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_GUI_SENSOR_MANAGER_H
-#define ANDROID_GUI_SENSOR_MANAGER_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <binder/IBinder.h>
-
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-#include <utils/Singleton.h>
-#include <utils/Vector.h>
-
-#include <gui/SensorEventQueue.h>
-
-// ----------------------------------------------------------------------------
-// Concrete types for the NDK
-struct ASensorManager { };
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-class ISensorServer;
-class Sensor;
-class SensorEventQueue;
-
-// ----------------------------------------------------------------------------
-
-class SensorManager :
- public ASensorManager,
- public Singleton<SensorManager>
-{
-public:
- SensorManager();
- ~SensorManager();
-
- ssize_t getSensorList(Sensor const* const** list) const;
- Sensor const* getDefaultSensor(int type);
- sp<SensorEventQueue> createEventQueue();
-
-private:
- // DeathRecipient interface
- void sensorManagerDied();
-
- status_t assertStateLocked() const;
-
-private:
- mutable Mutex mLock;
- mutable sp<ISensorServer> mSensorServer;
- mutable Sensor const** mSensorList;
- mutable Vector<Sensor> mSensors;
- mutable sp<IBinder::DeathRecipient> mDeathObserver;
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_GUI_SENSOR_MANAGER_H
diff --git a/include/gui/Surface.h b/include/gui/Surface.h
deleted file mode 100644
index 1f90c59..0000000
--- a/include/gui/Surface.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (C) 2007 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_GUI_SURFACE_H
-#define ANDROID_GUI_SURFACE_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/KeyedVector.h>
-#include <utils/RefBase.h>
-#include <utils/threads.h>
-
-#include <ui/PixelFormat.h>
-#include <ui/Region.h>
-
-#include <gui/SurfaceTextureClient.h>
-#include <gui/ISurface.h>
-#include <gui/ISurfaceComposerClient.h>
-
-#define ANDROID_VIEW_SURFACE_JNI_ID "mNativeSurface"
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-class ISurfaceTexture;
-class Surface;
-class SurfaceComposerClient;
-
-// ---------------------------------------------------------------------------
-
-class SurfaceControl : public RefBase
-{
-public:
- static bool isValid(const sp<SurfaceControl>& surface) {
- return (surface != 0) && surface->isValid();
- }
- bool isValid() {
- return mToken>=0 && mClient!=0;
- }
- static bool isSameSurface(
- const sp<SurfaceControl>& lhs, const sp<SurfaceControl>& rhs);
-
- uint32_t getIdentity() const { return mIdentity; }
-
- // release surface data from java
- void clear();
-
- status_t setLayer(int32_t layer);
- status_t setPosition(int32_t x, int32_t y);
- status_t setSize(uint32_t w, uint32_t h);
- status_t hide();
- status_t show(int32_t layer = -1);
- status_t freeze();
- status_t unfreeze();
- status_t setFlags(uint32_t flags, uint32_t mask);
- status_t setTransparentRegionHint(const Region& transparent);
- status_t setAlpha(float alpha=1.0f);
- status_t setMatrix(float dsdx, float dtdx, float dsdy, float dtdy);
- status_t setFreezeTint(uint32_t tint);
-
- static status_t writeSurfaceToParcel(
- const sp<SurfaceControl>& control, Parcel* parcel);
-
- sp<Surface> getSurface() const;
-
-private:
- // can't be copied
- SurfaceControl& operator = (SurfaceControl& rhs);
- SurfaceControl(const SurfaceControl& rhs);
-
- friend class SurfaceComposerClient;
- friend class Surface;
-
- SurfaceControl(
- const sp<SurfaceComposerClient>& client,
- const sp<ISurface>& surface,
- const ISurfaceComposerClient::surface_data_t& data);
-
- ~SurfaceControl();
-
- status_t validate() const;
- void destroy();
-
- sp<SurfaceComposerClient> mClient;
- sp<ISurface> mSurface;
- SurfaceID mToken;
- uint32_t mIdentity;
- mutable Mutex mLock;
-
- mutable sp<Surface> mSurfaceData;
-};
-
-// ---------------------------------------------------------------------------
-
-class Surface : public SurfaceTextureClient
-{
-public:
- struct SurfaceInfo {
- uint32_t w;
- uint32_t h;
- uint32_t s;
- uint32_t usage;
- PixelFormat format;
- void* bits;
- uint32_t reserved[2];
- };
-
- explicit Surface(const sp<ISurfaceTexture>& st);
-
- static status_t writeToParcel(const sp<Surface>& control, Parcel* parcel);
-
- static sp<Surface> readFromParcel(const Parcel& data);
- static bool isValid(const sp<Surface>& surface) {
- return (surface != 0) && surface->isValid();
- }
-
- bool isValid();
- uint32_t getIdentity() const { return mIdentity; }
- sp<ISurfaceTexture> getSurfaceTexture();
-
- // the lock/unlock APIs must be used from the same thread
- status_t lock(SurfaceInfo* info, Region* dirty = NULL);
- status_t unlockAndPost();
-
- sp<IBinder> asBinder() const;
-
-private:
- // this is just to be able to write some unit tests
- friend class Test;
- friend class SurfaceControl;
-
- // can't be copied
- Surface& operator = (Surface& rhs);
- Surface(const Surface& rhs);
-
- explicit Surface(const sp<SurfaceControl>& control);
- Surface(const Parcel& data, const sp<IBinder>& ref);
- ~Surface();
-
- /*
- * private stuff...
- */
- void init(const sp<ISurfaceTexture>& surfaceTexture);
-
- static void cleanCachedSurfacesLocked();
-
- virtual int query(int what, int* value) const;
-
- // constants
- sp<ISurface> mSurface;
- uint32_t mIdentity;
-
- // A cache of Surface objects that have been deserialized into this process.
- static Mutex sCachedSurfacesLock;
- static DefaultKeyedVector<wp<IBinder>, wp<Surface> > sCachedSurfaces;
-};
-
-}; // namespace android
-
-#endif // ANDROID_GUI_SURFACE_H
diff --git a/include/gui/SurfaceComposerClient.h b/include/gui/SurfaceComposerClient.h
deleted file mode 100644
index d971031..0000000
--- a/include/gui/SurfaceComposerClient.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (C) 2007 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_GUI_SURFACE_COMPOSER_CLIENT_H
-#define ANDROID_GUI_SURFACE_COMPOSER_CLIENT_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <binder/IBinder.h>
-
-#include <utils/RefBase.h>
-#include <utils/Singleton.h>
-#include <utils/SortedVector.h>
-#include <utils/threads.h>
-
-#include <ui/PixelFormat.h>
-
-#include <gui/Surface.h>
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-class DisplayInfo;
-class Composer;
-class IMemoryHeap;
-class ISurfaceComposerClient;
-class Region;
-
-// ---------------------------------------------------------------------------
-
-class SurfaceComposerClient : public RefBase
-{
- friend class Composer;
-public:
- SurfaceComposerClient();
- virtual ~SurfaceComposerClient();
-
- // Always make sure we could initialize
- status_t initCheck() const;
-
- // Return the connection of this client
- sp<IBinder> connection() const;
-
- // Forcibly remove connection before all references have gone away.
- void dispose();
-
- // ------------------------------------------------------------------------
- // surface creation / destruction
-
- //! Create a surface
- sp<SurfaceControl> createSurface(
- 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
- PixelFormat format, // pixel-format desired
- uint32_t flags = 0 // usage flags
- );
-
- sp<SurfaceControl> createSurface(
- 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
- // several surfaces can be updated in one transaction, all changes are
- // committed at once when the transaction is closed.
- // closeGlobalTransaction() usually requires an IPC with the server.
-
- //! Open a composer transaction on all active SurfaceComposerClients.
- static void openGlobalTransaction();
-
- //! Close a composer transaction on all active SurfaceComposerClients.
- static void closeGlobalTransaction(bool synchronous = false);
-
- //! Freeze the specified display but not transactions.
- static status_t freezeDisplay(DisplayID dpy, uint32_t flags = 0);
-
- //! Resume updates on the specified display.
- static status_t unfreezeDisplay(DisplayID dpy, uint32_t flags = 0);
-
- //! Set the orientation of the given display
- static int setOrientation(DisplayID dpy, int orientation, uint32_t flags);
-
- // Query the number of displays
- static ssize_t getNumberOfDisplays();
-
- // Get information about a display
- static status_t getDisplayInfo(DisplayID dpy, DisplayInfo* info);
- static ssize_t getDisplayWidth(DisplayID dpy);
- static ssize_t getDisplayHeight(DisplayID dpy);
- static ssize_t getDisplayOrientation(DisplayID dpy);
-
- status_t linkToComposerDeath(const sp<IBinder::DeathRecipient>& recipient,
- void* cookie = NULL, uint32_t flags = 0);
-
- status_t hide(SurfaceID id);
- status_t show(SurfaceID id, int32_t layer = -1);
- status_t freeze(SurfaceID id);
- status_t unfreeze(SurfaceID id);
- status_t setFlags(SurfaceID id, uint32_t flags, uint32_t mask);
- status_t setTransparentRegionHint(SurfaceID id, const Region& transparent);
- status_t setLayer(SurfaceID id, int32_t layer);
- status_t setAlpha(SurfaceID id, float alpha=1.0f);
- status_t setFreezeTint(SurfaceID id, uint32_t tint);
- status_t setMatrix(SurfaceID id, float dsdx, float dtdx, float dsdy, float dtdy);
- status_t setPosition(SurfaceID id, float x, float y);
- status_t setSize(SurfaceID id, uint32_t w, uint32_t h);
- status_t destroySurface(SurfaceID sid);
-
-private:
- virtual void onFirstRef();
- Composer& getComposer();
-
- mutable Mutex mLock;
- status_t mStatus;
- sp<ISurfaceComposerClient> mClient;
- Composer& mComposer;
-};
-
-// ---------------------------------------------------------------------------
-
-class ScreenshotClient
-{
- sp<IMemoryHeap> mHeap;
- uint32_t mWidth;
- uint32_t mHeight;
- PixelFormat mFormat;
-public:
- ScreenshotClient();
-
- // frees the previous screenshot and capture a new one
- status_t update();
- status_t update(uint32_t reqWidth, uint32_t reqHeight);
- status_t update(uint32_t reqWidth, uint32_t reqHeight,
- uint32_t minLayerZ, uint32_t maxLayerZ);
-
- // release memory occupied by the screenshot
- void release();
-
- // pixels are valid until this object is freed or
- // release() or update() is called
- void const* getPixels() const;
-
- uint32_t getWidth() const;
- uint32_t getHeight() const;
- PixelFormat getFormat() const;
- uint32_t getStride() const;
- // size of allocated memory in bytes
- size_t getSize() const;
-};
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_GUI_SURFACE_COMPOSER_CLIENT_H
diff --git a/include/gui/SurfaceTexture.h b/include/gui/SurfaceTexture.h
deleted file mode 100644
index 5531e53..0000000
--- a/include/gui/SurfaceTexture.h
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * 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_GUI_SURFACETEXTURE_H
-#define ANDROID_GUI_SURFACETEXTURE_H
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <gui/ISurfaceTexture.h>
-#include <gui/BufferQueue.h>
-
-#include <ui/GraphicBuffer.h>
-
-#include <utils/String8.h>
-#include <utils/Vector.h>
-#include <utils/threads.h>
-
-#define ANDROID_GRAPHICS_SURFACETEXTURE_JNI_ID "mSurfaceTexture"
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-
-class String8;
-
-class SurfaceTexture : public BufferQueue {
-public:
-
- // SurfaceTexture constructs a new SurfaceTexture object. tex indicates the
- // name of the OpenGL ES texture to which images are to be streamed. This
- // texture name cannot be changed once the SurfaceTexture is created.
- // allowSynchronousMode specifies whether or not synchronous mode can be
- // enabled. texTarget specifies the OpenGL ES texture target to which the
- // texture will be bound in updateTexImage. useFenceSync specifies whether
- // fences should be used to synchronize access to buffers if that behavior
- // is enabled at compile-time.
- SurfaceTexture(GLuint tex, bool allowSynchronousMode = true,
- GLenum texTarget = GL_TEXTURE_EXTERNAL_OES, bool useFenceSync = true);
-
- virtual ~SurfaceTexture();
-
-
-
- // updateTexImage sets the image contents of the target texture to that of
- // the most recently queued buffer.
- //
- // This call may only be made while the OpenGL ES context to which the
- // target texture belongs is bound to the calling thread.
- status_t updateTexImage();
-
- // setBufferCountServer set the buffer count. If the client has requested
- // a buffer count using setBufferCount, the server-buffer count will
- // take effect once the client sets the count back to zero.
- status_t setBufferCountServer(int bufferCount);
-
- // getTransformMatrix retrieves the 4x4 texture coordinate transform matrix
- // associated with the texture image set by the most recent call to
- // updateTexImage.
- //
- // This transform matrix maps 2D homogeneous texture coordinates of the form
- // (s, t, 0, 1) with s and t in the inclusive range [0, 1] to the texture
- // coordinate that should be used to sample that location from the texture.
- // Sampling the texture outside of the range of this transform is undefined.
- //
- // This transform is necessary to compensate for transforms that the stream
- // content producer may implicitly apply to the content. By forcing users of
- // a SurfaceTexture to apply this transform we avoid performing an extra
- // copy of the data that would be needed to hide the transform from the
- // user.
- //
- // The matrix is stored in column-major order so that it may be passed
- // directly to OpenGL ES via the glLoadMatrixf or glUniformMatrix4fv
- // functions.
- void getTransformMatrix(float mtx[16]);
-
- // getTimestamp retrieves the timestamp associated with the texture image
- // set by the most recent call to updateTexImage.
- //
- // The timestamp is in nanoseconds, and is monotonically increasing. Its
- // other semantics (zero point, etc) are source-dependent and should be
- // documented by the source.
- int64_t getTimestamp();
-
- // setFrameAvailableListener sets the listener object that will be notified
- // when a new frame becomes available.
- void setFrameAvailableListener(const sp<FrameAvailableListener>& listener);
-
- // getAllocator retrieves the binder object that must be referenced as long
- // as the GraphicBuffers dequeued from this SurfaceTexture are referenced.
- // Holding this binder reference prevents SurfaceFlinger from freeing the
- // buffers before the client is done with them.
- sp<IBinder> getAllocator();
-
- // setDefaultBufferSize is used to set the size of buffers returned by
- // requestBuffers when a with and height of zero is requested.
- // A call to setDefaultBufferSize() may trigger requestBuffers() to
- // be called from the client.
- // The width and height parameters must be no greater than the minimum of
- // GL_MAX_VIEWPORT_DIMS and GL_MAX_TEXTURE_SIZE (see: glGetIntegerv).
- // An error due to invalid dimensions might not be reported until
- // updateTexImage() is called.
- status_t setDefaultBufferSize(uint32_t width, uint32_t height);
-
- // 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;
-
- // getCurrentScalingMode returns the scaling mode of the current buffer
- uint32_t getCurrentScalingMode() const;
-
- // isSynchronousMode returns whether the SurfaceTexture is currently in
- // synchronous mode.
- bool isSynchronousMode() const;
-
- // abandon frees all the buffers and puts the SurfaceTexture into the
- // 'abandoned' state. Once put in this state the SurfaceTexture can never
- // leave it. When in the 'abandoned' state, all methods of the
- // ISurfaceTexture interface will fail with the NO_INIT error.
- //
- // Note that while calling this method causes all the buffers to be freed
- // from the perspective of the the SurfaceTexture, if there are additional
- // references on the buffers (e.g. if a buffer is referenced by a client or
- // by OpenGL ES as a texture) then those buffer will remain allocated.
- void abandon();
-
- // set the name of the SurfaceTexture that will be used to identify it in
- // log messages.
- void setName(const String8& name);
-
- // dump our state in a String
- virtual void dump(String8& result) const;
- virtual void dump(String8& result, const char* prefix, char* buffer, size_t SIZE) const;
-
-protected:
-
- static bool isExternalFormat(uint32_t format);
-
-private:
-
- // createImage creates a new EGLImage from a GraphicBuffer.
- EGLImageKHR createImage(EGLDisplay dpy,
- const sp<GraphicBuffer>& graphicBuffer);
-
- // computeCurrentTransformMatrix computes the transform matrix for the
- // current texture. It uses mCurrentTransform and the current GraphicBuffer
- // to compute this matrix and stores it in mCurrentTransformMatrix.
- void computeCurrentTransformMatrix();
-
- // 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 support the getCurrentBuffer method.
- sp<GraphicBuffer> mCurrentTextureBuf;
-
- // mCurrentCrop is the crop rectangle that applies to the current texture.
- // It gets set each time updateTexImage is called.
- Rect mCurrentCrop;
-
- // mCurrentTransform is the transform identifier for the current texture. It
- // gets set each time updateTexImage is called.
- uint32_t mCurrentTransform;
-
- // mCurrentScalingMode is the scaling mode for the current texture. It gets
- // set to each time updateTexImage is called.
- uint32_t mCurrentScalingMode;
-
- // mCurrentTransformMatrix is the transform matrix for the current texture.
- // It gets computed by computeTransformMatrix each time updateTexImage is
- // called.
- float mCurrentTransformMatrix[16];
-
- // mCurrentTimestamp is the timestamp for the current texture. It
- // gets set each time updateTexImage is called.
- int64_t mCurrentTimestamp;
-
- // mTexName is the name of the OpenGL texture to which streamed images will
- // be bound when updateTexImage is called. It is set at construction time
- // changed with a call to setTexName.
- const GLuint mTexName;
-
- // mUseFenceSync indicates whether creation of the EGL_KHR_fence_sync
- // extension should be used to prevent buffers from being dequeued before
- // it's safe for them to be written. It gets set at construction time and
- // never changes.
- const bool mUseFenceSync;
-
- // mTexTarget is the GL texture target with which the GL texture object is
- // associated. It is set in the constructor and never changed. It is
- // almost always GL_TEXTURE_EXTERNAL_OES except for one use case in Android
- // Browser. In that case it is set to GL_TEXTURE_2D to allow
- // glCopyTexSubImage to read from the texture. This is a hack to work
- // around a GL driver limitation on the number of FBO attachments, which the
- // browser's tile cache exceeds.
- const GLenum mTexTarget;
-
- // SurfaceTexture maintains EGL information about GraphicBuffers that corresponds
- // directly with BufferQueue's buffers
- struct EGLSlot {
- EGLSlot()
- : mEglImage(EGL_NO_IMAGE_KHR),
- mEglDisplay(EGL_NO_DISPLAY),
- mFence(EGL_NO_SYNC_KHR) {
- }
-
- sp<GraphicBuffer> mGraphicBuffer;
-
- // mEglImage is the EGLImage created from mGraphicBuffer.
- EGLImageKHR mEglImage;
-
- // mEglDisplay is the EGLDisplay used to create mEglImage.
- EGLDisplay mEglDisplay;
-
- // mFence is the EGL sync object that must signal before the buffer
- // associated with this buffer slot may be dequeued. It is initialized
- // to EGL_NO_SYNC_KHR when the buffer is created and (optionally, based
- // on a compile-time option) set to a new sync object in updateTexImage.
- EGLSyncKHR mFence;
- };
-
- EGLSlot mEGLSlots[NUM_BUFFER_SLOTS];
-
- // mAbandoned indicates that the BufferQueue will no longer be used to
- // consume images buffers pushed to it using the ISurfaceTexture interface.
- // It is initialized to false, and set to true in the abandon method. A
- // BufferQueue that has been abandoned will return the NO_INIT error from
- // all ISurfaceTexture methods capable of returning an error.
- bool mAbandoned;
-
- // mName is a string used to identify the SurfaceTexture in log messages.
- // It can be set by the setName method.
- String8 mName;
-
- // 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.
- mutable Mutex mMutex;
-
- // mCurrentTexture is the buffer slot index of the buffer that is currently
- // bound to the OpenGL texture. It is initialized to INVALID_BUFFER_SLOT,
- // indicating that no buffer slot is currently bound to the texture. Note,
- // however, that a value of INVALID_BUFFER_SLOT does not necessarily mean
- // that no buffer is bound to the texture. A call to setBufferCount will
- // reset mCurrentTexture to INVALID_BUFFER_SLOT.
- int mCurrentTexture;
-
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_GUI_SURFACETEXTURE_H
diff --git a/include/gui/SurfaceTextureClient.h b/include/gui/SurfaceTextureClient.h
deleted file mode 100644
index aa7fe48..0000000
--- a/include/gui/SurfaceTextureClient.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * 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_GUI_SURFACETEXTURECLIENT_H
-#define ANDROID_GUI_SURFACETEXTURECLIENT_H
-
-#include <gui/ISurfaceTexture.h>
-#include <gui/SurfaceTexture.h>
-
-#include <ui/ANativeObjectBase.h>
-#include <ui/Region.h>
-
-#include <utils/RefBase.h>
-#include <utils/threads.h>
-
-namespace android {
-
-class Surface;
-
-class SurfaceTextureClient
- : public ANativeObjectBase<ANativeWindow, SurfaceTextureClient, RefBase>
-{
-public:
- SurfaceTextureClient(const sp<ISurfaceTexture>& surfaceTexture);
-
- sp<ISurfaceTexture> getISurfaceTexture() const;
-
-protected:
- SurfaceTextureClient();
- virtual ~SurfaceTextureClient();
- void setISurfaceTexture(const sp<ISurfaceTexture>& surfaceTexture);
-
-private:
- // can't be copied
- SurfaceTextureClient& operator = (const SurfaceTextureClient& rhs);
- SurfaceTextureClient(const SurfaceTextureClient& rhs);
- void init();
-
- // ANativeWindow hooks
- static int hook_cancelBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
- static int hook_dequeueBuffer(ANativeWindow* window, ANativeWindowBuffer** buffer);
- static int hook_lockBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
- static int hook_perform(ANativeWindow* window, int operation, ...);
- static int hook_query(const ANativeWindow* window, int what, int* value);
- static int hook_queueBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
- static int hook_setSwapInterval(ANativeWindow* window, int interval);
-
- int dispatchConnect(va_list args);
- int dispatchDisconnect(va_list args);
- int dispatchSetBufferCount(va_list args);
- int dispatchSetBuffersGeometry(va_list args);
- int dispatchSetBuffersDimensions(va_list args);
- int dispatchSetBuffersFormat(va_list args);
- int dispatchSetScalingMode(va_list args);
- int dispatchSetBuffersTransform(va_list args);
- int dispatchSetBuffersTimestamp(va_list args);
- int dispatchSetCrop(va_list args);
- int dispatchSetUsage(va_list args);
- int dispatchLock(va_list args);
- int dispatchUnlockAndPost(va_list args);
-
-protected:
- virtual int cancelBuffer(ANativeWindowBuffer* buffer);
- virtual int dequeueBuffer(ANativeWindowBuffer** buffer);
- virtual int lockBuffer(ANativeWindowBuffer* buffer);
- virtual int perform(int operation, va_list args);
- virtual int query(int what, int* value) const;
- virtual int queueBuffer(ANativeWindowBuffer* buffer);
- virtual int setSwapInterval(int interval);
-
- virtual int connect(int api);
- virtual int disconnect(int api);
- virtual int setBufferCount(int bufferCount);
- virtual int setBuffersDimensions(int w, int h);
- virtual int setBuffersFormat(int format);
- virtual int setScalingMode(int mode);
- virtual int setBuffersTransform(int transform);
- virtual int setBuffersTimestamp(int64_t timestamp);
- virtual int setCrop(Rect const* rect);
- virtual int setUsage(uint32_t reqUsage);
- virtual int lock(ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds);
- virtual int unlockAndPost();
-
- enum { MIN_UNDEQUEUED_BUFFERS = SurfaceTexture::MIN_UNDEQUEUED_BUFFERS };
- enum { NUM_BUFFER_SLOTS = SurfaceTexture::NUM_BUFFER_SLOTS };
- enum { DEFAULT_FORMAT = PIXEL_FORMAT_RGBA_8888 };
-
-private:
- void freeAllBuffers();
- int getSlotFromBufferLocked(android_native_buffer_t* buffer) const;
-
- // mSurfaceTexture is the interface to the surface texture server. All
- // operations on the surface texture client ultimately translate into
- // interactions with the server using this interface.
- sp<ISurfaceTexture> mSurfaceTexture;
-
- // mSlots stores the buffers that have been allocated for each buffer slot.
- // It is initialized to null pointers, and gets filled in with the result of
- // ISurfaceTexture::requestBuffer when the client dequeues a buffer from a
- // slot that has not yet been used. The buffer allocated to a slot will also
- // be replaced if the requested buffer usage or geometry differs from that
- // of the buffer allocated to a slot.
- sp<GraphicBuffer> mSlots[NUM_BUFFER_SLOTS];
-
- // mReqWidth is the buffer width that will be requested at the next dequeue
- // operation. It is initialized to 1.
- uint32_t mReqWidth;
-
- // mReqHeight is the buffer height that will be requested at the next deuque
- // operation. It is initialized to 1.
- uint32_t mReqHeight;
-
- // mReqFormat is the buffer pixel format that will be requested at the next
- // deuque operation. It is initialized to PIXEL_FORMAT_RGBA_8888.
- uint32_t mReqFormat;
-
- // mReqUsage is the set of buffer usage flags that will be requested
- // at the next deuque operation. It is initialized to 0.
- uint32_t mReqUsage;
-
- // mTimestamp is the timestamp that will be used for the next buffer queue
- // operation. It defaults to NATIVE_WINDOW_TIMESTAMP_AUTO, which means that
- // a timestamp is auto-generated when queueBuffer is called.
- int64_t mTimestamp;
-
- // mDefaultWidth is default width of the window, regardless of the
- // native_window_set_buffers_dimensions call
- uint32_t mDefaultWidth;
-
- // mDefaultHeight is default width of the window, regardless of the
- // native_window_set_buffers_dimensions call
- uint32_t mDefaultHeight;
-
- // mTransformHint is the transform probably applied to buffers of this
- // window. this is only a hint, actual transform may differ.
- uint32_t mTransformHint;
-
- // 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.
- mutable Mutex mMutex;
-
- // must be used from the lock/unlock thread
- sp<GraphicBuffer> mLockedBuffer;
- sp<GraphicBuffer> mPostedBuffer;
- mutable Region mOldDirtyRegion;
- bool mConnectedToCpu;
-};
-
-}; // namespace android
-
-#endif // ANDROID_GUI_SURFACETEXTURECLIENT_H
diff --git a/include/private/binder/Static.h b/include/private/binder/Static.h
deleted file mode 100644
index 5b0f9fc..0000000
--- a/include/private/binder/Static.h
+++ /dev/null
@@ -1,39 +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.
- */
-
-// All static variables go here, to control initialization and
-// destruction order in the library.
-
-#include <utils/threads.h>
-
-#include <binder/IBinder.h>
-#include <binder/IMemory.h>
-#include <binder/ProcessState.h>
-#include <binder/IPermissionController.h>
-#include <binder/IServiceManager.h>
-
-namespace android {
-
-// For ProcessState.cpp
-extern Mutex gProcessMutex;
-extern sp<ProcessState> gProcess;
-
-// For ServiceManager.cpp
-extern Mutex gDefaultServiceManagerLock;
-extern sp<IServiceManager> gDefaultServiceManager;
-extern sp<IPermissionController> gPermissionController;
-
-} // namespace android
diff --git a/include/private/binder/binder_module.h b/include/private/binder/binder_module.h
deleted file mode 100644
index a8dd64f..0000000
--- a/include/private/binder/binder_module.h
+++ /dev/null
@@ -1,33 +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 _BINDER_MODULE_H_
-#define _BINDER_MODULE_H_
-
-#ifdef __cplusplus
-namespace android {
-#endif
-
-/* obtain structures and constants from the kernel header */
-
-#include <sys/ioctl.h>
-#include <linux/binder.h>
-
-#ifdef __cplusplus
-} // namespace android
-#endif
-
-#endif // _BINDER_MODULE_H_
diff --git a/include/private/gui/ComposerService.h b/include/private/gui/ComposerService.h
deleted file mode 100644
index d04491a..0000000
--- a/include/private/gui/ComposerService.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2011 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_PRIVATE_GUI_COMPOSER_SERVICE_H
-#define ANDROID_PRIVATE_GUI_COMPOSER_SERVICE_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Singleton.h>
-#include <utils/StrongPointer.h>
-
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-class IMemoryHeap;
-class ISurfaceComposer;
-class surface_flinger_cblk_t;
-
-// ---------------------------------------------------------------------------
-
-class ComposerService : public Singleton<ComposerService>
-{
- // these are constants
- sp<ISurfaceComposer> mComposerService;
- sp<IMemoryHeap> mServerCblkMemory;
- surface_flinger_cblk_t volatile* mServerCblk;
- ComposerService();
- friend class Singleton<ComposerService>;
-public:
- static sp<ISurfaceComposer> getComposerService();
- static surface_flinger_cblk_t const volatile * getControlBlock();
-};
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_PRIVATE_GUI_COMPOSER_SERVICE_H
diff --git a/include/private/gui/LayerState.h b/include/private/gui/LayerState.h
deleted file mode 100644
index ca277e0..0000000
--- a/include/private/gui/LayerState.h
+++ /dev/null
@@ -1,81 +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_SF_LAYER_STATE_H
-#define ANDROID_SF_LAYER_STATE_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-
-#include <ui/Region.h>
-#include <gui/ISurface.h>
-
-namespace android {
-
-class Parcel;
-class ISurfaceComposerClient;
-
-struct layer_state_t {
-
- layer_state_t()
- : surface(0), what(0),
- x(0), y(0), z(0), w(0), h(0),
- alpha(0), tint(0), flags(0), mask(0),
- reserved(0)
- {
- matrix.dsdx = matrix.dtdy = 1.0f;
- matrix.dsdy = matrix.dtdx = 0.0f;
- }
-
- status_t write(Parcel& output) const;
- status_t read(const Parcel& input);
-
- struct matrix22_t {
- float dsdx;
- float dtdx;
- float dsdy;
- float dtdy;
- };
- SurfaceID surface;
- uint32_t what;
- float x;
- float y;
- uint32_t z;
- uint32_t w;
- uint32_t h;
- float alpha;
- uint32_t tint;
- uint8_t flags;
- uint8_t mask;
- uint8_t reserved;
- matrix22_t matrix;
- // non POD must be last. see write/read
- Region transparentRegion;
-};
-
-struct ComposerState {
- sp<ISurfaceComposerClient> client;
- layer_state_t state;
- status_t write(Parcel& output) const;
- status_t read(const Parcel& input);
-};
-
-}; // namespace android
-
-#endif // ANDROID_SF_LAYER_STATE_H
-
diff --git a/include/private/gui/SharedBufferStack.h b/include/private/gui/SharedBufferStack.h
deleted file mode 100644
index 0da03d1..0000000
--- a/include/private/gui/SharedBufferStack.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2007 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_SF_SHARED_BUFFER_STACK_H
-#define ANDROID_SF_SHARED_BUFFER_STACK_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Debug.h>
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-#define NUM_DISPLAY_MAX 4
-
-struct display_cblk_t
-{
- uint16_t w;
- uint16_t h;
- uint8_t format;
- uint8_t orientation;
- uint8_t reserved[2];
- float fps;
- float density;
- float xdpi;
- float ydpi;
- uint32_t pad[2];
-};
-
-struct surface_flinger_cblk_t // 4KB max
-{
- uint8_t connected;
- uint8_t reserved[3];
- uint32_t pad[7];
- display_cblk_t displays[NUM_DISPLAY_MAX];
-};
-
-// ---------------------------------------------------------------------------
-
-COMPILE_TIME_ASSERT(sizeof(surface_flinger_cblk_t) <= 4096)
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif /* ANDROID_SF_SHARED_BUFFER_STACK_H */
diff --git a/include/private/ui/RegionHelper.h b/include/private/ui/RegionHelper.h
deleted file mode 100644
index 8d76533..0000000
--- a/include/private/ui/RegionHelper.h
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Copyright (C) 2009 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_UI_PRIVATE_REGION_HELPER_H
-#define ANDROID_UI_PRIVATE_REGION_HELPER_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-namespace android {
-// ----------------------------------------------------------------------------
-
-template<typename RECT>
-class region_operator
-{
- typedef typename RECT::value_type TYPE;
- static const TYPE max_value = 0x7FFFFFF;
-
-public:
- /*
- * Common boolean operations:
- * value is computed as 0b101 op 0b110
- * other boolean operation are possible, simply compute
- * their corresponding value with the above formulae and use
- * it when instantiating a region_operator.
- */
- static const uint32_t LHS = 0x5; // 0b101
- static const uint32_t RHS = 0x6; // 0b110
- enum {
- op_nand = LHS & ~RHS,
- op_and = LHS & RHS,
- op_or = LHS | RHS,
- op_xor = LHS ^ RHS
- };
-
- struct region {
- RECT const* rects;
- size_t count;
- TYPE dx;
- TYPE dy;
- inline region(const region& rhs)
- : rects(rhs.rects), count(rhs.count), dx(rhs.dx), dy(rhs.dy) { }
- inline region(RECT const* r, size_t c)
- : rects(r), count(c), dx(), dy() { }
- inline region(RECT const* r, size_t c, TYPE dx, TYPE dy)
- : rects(r), count(c), dx(dx), dy(dy) { }
- };
-
- class region_rasterizer {
- friend class region_operator;
- virtual void operator()(const RECT& rect) = 0;
- public:
- virtual ~region_rasterizer() { };
- };
-
- inline region_operator(int op, const region& lhs, const region& rhs)
- : op_mask(op), spanner(lhs, rhs)
- {
- }
-
- void operator()(region_rasterizer& rasterizer) {
- RECT current;
- do {
- SpannerInner spannerInner(spanner.lhs, spanner.rhs);
- int inside = spanner.next(current.top, current.bottom);
- spannerInner.prepare(inside);
- do {
- TYPE left, right;
- int inside = spannerInner.next(current.left, current.right);
- if ((op_mask >> inside) & 1) {
- if (current.left < current.right &&
- current.top < current.bottom) {
- rasterizer(current);
- }
- }
- } while(!spannerInner.isDone());
- } while(!spanner.isDone());
- }
-
-private:
- uint32_t op_mask;
-
- class SpannerBase
- {
- public:
- enum {
- lhs_before_rhs = 0,
- lhs_after_rhs = 1,
- lhs_coincide_rhs = 2
- };
-
- protected:
- TYPE lhs_head;
- TYPE lhs_tail;
- TYPE rhs_head;
- TYPE rhs_tail;
-
- inline int next(TYPE& head, TYPE& tail,
- bool& more_lhs, bool& more_rhs)
- {
- int inside;
- more_lhs = false;
- more_rhs = false;
- if (lhs_head < rhs_head) {
- inside = lhs_before_rhs;
- head = lhs_head;
- if (lhs_tail <= rhs_head) {
- tail = lhs_tail;
- more_lhs = true;
- } else {
- lhs_head = rhs_head;
- tail = rhs_head;
- }
- } else if (rhs_head < lhs_head) {
- inside = lhs_after_rhs;
- head = rhs_head;
- if (rhs_tail <= lhs_head) {
- tail = rhs_tail;
- more_rhs = true;
- } else {
- rhs_head = lhs_head;
- tail = lhs_head;
- }
- } else {
- inside = lhs_coincide_rhs;
- head = lhs_head;
- if (lhs_tail <= rhs_tail) {
- tail = rhs_head = lhs_tail;
- more_lhs = true;
- }
- if (rhs_tail <= lhs_tail) {
- tail = lhs_head = rhs_tail;
- more_rhs = true;
- }
- }
- return inside;
- }
- };
-
- class Spanner : protected SpannerBase
- {
- friend class region_operator;
- region lhs;
- region rhs;
-
- public:
- inline Spanner(const region& lhs, const region& rhs)
- : lhs(lhs), rhs(rhs)
- {
- SpannerBase::lhs_head = lhs.rects->top + lhs.dy;
- SpannerBase::lhs_tail = lhs.rects->bottom + lhs.dy;
- SpannerBase::rhs_head = rhs.rects->top + rhs.dy;
- SpannerBase::rhs_tail = rhs.rects->bottom + rhs.dy;
- }
-
- inline bool isDone() const {
- return !rhs.count && !lhs.count;
- }
-
- inline int next(TYPE& top, TYPE& bottom)
- {
- bool more_lhs = false;
- bool more_rhs = false;
- int inside = SpannerBase::next(top, bottom, more_lhs, more_rhs);
- if (more_lhs) {
- advance(lhs, SpannerBase::lhs_head, SpannerBase::lhs_tail);
- }
- if (more_rhs) {
- advance(rhs, SpannerBase::rhs_head, SpannerBase::rhs_tail);
- }
- return inside;
- }
-
- private:
- static inline
- void advance(region& reg, TYPE& aTop, TYPE& aBottom) {
- // got to next span
- size_t count = reg.count;
- RECT const * rects = reg.rects;
- RECT const * const end = rects + count;
- const int top = rects->top;
- while (rects != end && rects->top == top) {
- rects++;
- count--;
- }
- if (rects != end) {
- aTop = rects->top + reg.dy;
- aBottom = rects->bottom + reg.dy;
- } else {
- aTop = max_value;
- aBottom = max_value;
- }
- reg.rects = rects;
- reg.count = count;
- }
- };
-
- class SpannerInner : protected SpannerBase
- {
- region lhs;
- region rhs;
-
- public:
- inline SpannerInner(const region& lhs, const region& rhs)
- : lhs(lhs), rhs(rhs)
- {
- }
-
- inline void prepare(int inside) {
- if (inside == SpannerBase::lhs_before_rhs) {
- SpannerBase::lhs_head = lhs.rects->left + lhs.dx;
- SpannerBase::lhs_tail = lhs.rects->right + lhs.dx;
- SpannerBase::rhs_head = max_value;
- SpannerBase::rhs_tail = max_value;
- } else if (inside == SpannerBase::lhs_after_rhs) {
- SpannerBase::lhs_head = max_value;
- SpannerBase::lhs_tail = max_value;
- SpannerBase::rhs_head = rhs.rects->left + rhs.dx;
- SpannerBase::rhs_tail = rhs.rects->right + rhs.dx;
- } else {
- SpannerBase::lhs_head = lhs.rects->left + lhs.dx;
- SpannerBase::lhs_tail = lhs.rects->right + lhs.dx;
- SpannerBase::rhs_head = rhs.rects->left + rhs.dx;
- SpannerBase::rhs_tail = rhs.rects->right + rhs.dx;
- }
- }
-
- inline bool isDone() const {
- return SpannerBase::lhs_head == max_value &&
- SpannerBase::rhs_head == max_value;
- }
-
- inline int next(TYPE& left, TYPE& right)
- {
- bool more_lhs = false;
- bool more_rhs = false;
- int inside = SpannerBase::next(left, right, more_lhs, more_rhs);
- if (more_lhs) {
- advance(lhs, SpannerBase::lhs_head, SpannerBase::lhs_tail);
- }
- if (more_rhs) {
- advance(rhs, SpannerBase::rhs_head, SpannerBase::rhs_tail);
- }
- return inside;
- }
-
- private:
- static inline
- void advance(region& reg, TYPE& left, TYPE& right) {
- if (reg.rects && reg.count) {
- const int cur_span_top = reg.rects->top;
- reg.rects++;
- reg.count--;
- if (!reg.count || reg.rects->top != cur_span_top) {
- left = max_value;
- right = max_value;
- } else {
- left = reg.rects->left + reg.dx;
- right = reg.rects->right + reg.dx;
- }
- }
- }
- };
-
- Spanner spanner;
-};
-
-// ----------------------------------------------------------------------------
-};
-
-#endif /* ANDROID_UI_PRIVATE_REGION_HELPER_H */
diff --git a/include/private/utils/Static.h b/include/private/utils/Static.h
deleted file mode 100644
index d95ae0d..0000000
--- a/include/private/utils/Static.h
+++ /dev/null
@@ -1,35 +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.
- */
-
-// All static variables go here, to control initialization and
-// destruction order in the library.
-
-#include <utils/threads.h>
-#include <utils/KeyedVector.h>
-
-namespace android {
-// For TextStream.cpp
-extern Vector<int32_t> gTextBuffers;
-
-// For String8.cpp
-extern void initialize_string8();
-extern void terminate_string8();
-
-// For String16.cpp
-extern void initialize_string16();
-extern void terminate_string16();
-
-} // namespace android
diff --git a/include/ui/ANativeObjectBase.h b/include/ui/ANativeObjectBase.h
deleted file mode 100644
index 76e850f..0000000
--- a/include/ui/ANativeObjectBase.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2009 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_ANDROID_NATIVES_H
-#define ANDROID_ANDROID_NATIVES_H
-
-#include <sys/types.h>
-#include <string.h>
-
-#include <hardware/gralloc.h>
-#include <system/window.h>
-
-// ---------------------------------------------------------------------------
-
-/* FIXME: this is legacy for pixmaps */
-typedef struct egl_native_pixmap_t
-{
- int32_t version; /* must be 32 */
- int32_t width;
- int32_t height;
- int32_t stride;
- uint8_t* data;
- uint8_t format;
- uint8_t rfu[3];
- union {
- uint32_t compressedFormat;
- int32_t vstride;
- };
- int32_t reserved;
-} egl_native_pixmap_t;
-
-/*****************************************************************************/
-
-#ifdef __cplusplus
-
-#include <utils/RefBase.h>
-
-namespace android {
-
-/*
- * This helper class turns a ANativeXXX object type into a C++
- * reference-counted object; with proper type conversions.
- */
-template <typename NATIVE_TYPE, typename TYPE, typename REF>
-class ANativeObjectBase : public NATIVE_TYPE, public REF
-{
-public:
- // Disambiguate between the incStrong in REF and NATIVE_TYPE
- void incStrong(const void* id) const {
- REF::incStrong(id);
- }
- void decStrong(const void* id) const {
- REF::decStrong(id);
- }
-
-protected:
- typedef ANativeObjectBase<NATIVE_TYPE, TYPE, REF> BASE;
- ANativeObjectBase() : NATIVE_TYPE(), REF() {
- NATIVE_TYPE::common.incRef = incRef;
- NATIVE_TYPE::common.decRef = decRef;
- }
- static inline TYPE* getSelf(NATIVE_TYPE* self) {
- return static_cast<TYPE*>(self);
- }
- static inline TYPE const* getSelf(NATIVE_TYPE const* self) {
- return static_cast<TYPE const *>(self);
- }
- static inline TYPE* getSelf(android_native_base_t* base) {
- return getSelf(reinterpret_cast<NATIVE_TYPE*>(base));
- }
- static inline TYPE const * getSelf(android_native_base_t const* base) {
- return getSelf(reinterpret_cast<NATIVE_TYPE const*>(base));
- }
- static void incRef(android_native_base_t* base) {
- ANativeObjectBase* self = getSelf(base);
- self->incStrong(self);
- }
- static void decRef(android_native_base_t* base) {
- ANativeObjectBase* self = getSelf(base);
- self->decStrong(self);
- }
-};
-
-} // namespace android
-#endif // __cplusplus
-
-/*****************************************************************************/
-
-#endif /* ANDROID_ANDROID_NATIVES_H */
diff --git a/include/ui/DisplayInfo.h b/include/ui/DisplayInfo.h
deleted file mode 100644
index edd28a6..0000000
--- a/include/ui/DisplayInfo.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2007 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_UI_DISPLAY_INFO_H
-#define ANDROID_UI_DISPLAY_INFO_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <ui/PixelFormat.h>
-
-namespace android {
-
-struct DisplayInfo {
- uint32_t w;
- uint32_t h;
- PixelFormatInfo pixelFormatInfo;
- uint8_t orientation;
- uint8_t reserved[3];
- float fps;
- float density;
- float xdpi;
- float ydpi;
-};
-
-/* Display orientations as defined in Surface.java and ISurfaceComposer.h. */
-enum {
- DISPLAY_ORIENTATION_0 = 0,
- DISPLAY_ORIENTATION_90 = 1,
- DISPLAY_ORIENTATION_180 = 2,
- DISPLAY_ORIENTATION_270 = 3
-};
-
-
-}; // namespace android
-
-#endif // ANDROID_COMPOSER_DISPLAY_INFO_H
-
diff --git a/include/ui/FramebufferNativeWindow.h b/include/ui/FramebufferNativeWindow.h
deleted file mode 100644
index b202b95..0000000
--- a/include/ui/FramebufferNativeWindow.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2007 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_FRAMEBUFFER_NATIVE_WINDOW_H
-#define ANDROID_FRAMEBUFFER_NATIVE_WINDOW_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <EGL/egl.h>
-
-#include <utils/threads.h>
-#include <utils/String8.h>
-
-#include <ui/ANativeObjectBase.h>
-#include <ui/Rect.h>
-
-#define NUM_FRAME_BUFFERS 2
-
-extern "C" EGLNativeWindowType android_createDisplaySurface(void);
-
-// ---------------------------------------------------------------------------
-namespace android {
-// ---------------------------------------------------------------------------
-
-class Surface;
-class NativeBuffer;
-
-// ---------------------------------------------------------------------------
-
-class FramebufferNativeWindow
- : public ANativeObjectBase<
- ANativeWindow,
- FramebufferNativeWindow,
- LightRefBase<FramebufferNativeWindow> >
-{
-public:
- FramebufferNativeWindow();
-
- framebuffer_device_t const * getDevice() const { return fbDev; }
-
- bool isUpdateOnDemand() const { return mUpdateOnDemand; }
- status_t setUpdateRectangle(const Rect& updateRect);
- status_t compositionComplete();
-
- void dump(String8& result);
-
- // for debugging only
- int getCurrentBufferIndex() const;
-
-private:
- friend class LightRefBase<FramebufferNativeWindow>;
- ~FramebufferNativeWindow(); // this class cannot be overloaded
- static int setSwapInterval(ANativeWindow* window, int interval);
- static int dequeueBuffer(ANativeWindow* window, ANativeWindowBuffer** buffer);
- static int lockBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
- static int queueBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
- static int query(const ANativeWindow* window, int what, int* value);
- static int perform(ANativeWindow* window, int operation, ...);
-
- framebuffer_device_t* fbDev;
- alloc_device_t* grDev;
-
- sp<NativeBuffer> buffers[NUM_FRAME_BUFFERS];
- sp<NativeBuffer> front;
-
- mutable Mutex mutex;
- Condition mCondition;
- int32_t mNumBuffers;
- int32_t mNumFreeBuffers;
- int32_t mBufferHead;
- int32_t mCurrentBufferIndex;
- bool mUpdateOnDemand;
-};
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_FRAMEBUFFER_NATIVE_WINDOW_H
-
diff --git a/include/ui/GraphicBuffer.h b/include/ui/GraphicBuffer.h
deleted file mode 100644
index f318cd8..0000000
--- a/include/ui/GraphicBuffer.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (C) 2007 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_GRAPHIC_BUFFER_H
-#define ANDROID_GRAPHIC_BUFFER_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <ui/ANativeObjectBase.h>
-#include <ui/PixelFormat.h>
-#include <ui/Rect.h>
-#include <utils/Flattenable.h>
-
-
-struct ANativeWindowBuffer;
-
-namespace android {
-
-class GraphicBufferMapper;
-
-// ===========================================================================
-// GraphicBuffer
-// ===========================================================================
-
-class GraphicBuffer
- : public ANativeObjectBase<
- ANativeWindowBuffer,
- GraphicBuffer,
- LightRefBase<GraphicBuffer> >, public Flattenable
-{
-public:
-
- enum {
- USAGE_SW_READ_NEVER = GRALLOC_USAGE_SW_READ_NEVER,
- USAGE_SW_READ_RARELY = GRALLOC_USAGE_SW_READ_RARELY,
- USAGE_SW_READ_OFTEN = GRALLOC_USAGE_SW_READ_OFTEN,
- USAGE_SW_READ_MASK = GRALLOC_USAGE_SW_READ_MASK,
-
- USAGE_SW_WRITE_NEVER = GRALLOC_USAGE_SW_WRITE_NEVER,
- USAGE_SW_WRITE_RARELY = GRALLOC_USAGE_SW_WRITE_RARELY,
- USAGE_SW_WRITE_OFTEN = GRALLOC_USAGE_SW_WRITE_OFTEN,
- USAGE_SW_WRITE_MASK = GRALLOC_USAGE_SW_WRITE_MASK,
-
- USAGE_SOFTWARE_MASK = USAGE_SW_READ_MASK|USAGE_SW_WRITE_MASK,
-
- USAGE_PROTECTED = GRALLOC_USAGE_PROTECTED,
-
- USAGE_HW_TEXTURE = GRALLOC_USAGE_HW_TEXTURE,
- USAGE_HW_RENDER = GRALLOC_USAGE_HW_RENDER,
- USAGE_HW_2D = GRALLOC_USAGE_HW_2D,
- USAGE_HW_COMPOSER = GRALLOC_USAGE_HW_COMPOSER,
- USAGE_HW_VIDEO_ENCODER = GRALLOC_USAGE_HW_VIDEO_ENCODER,
- USAGE_HW_MASK = GRALLOC_USAGE_HW_MASK
- };
-
- GraphicBuffer();
-
- // creates w * h buffer
- GraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage);
-
- // create a buffer from an existing handle
- GraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage,
- uint32_t stride, native_handle_t* handle, bool keepOwnership);
-
- // create a buffer from an existing ANativeWindowBuffer
- GraphicBuffer(ANativeWindowBuffer* buffer, bool keepOwnership);
-
- // return status
- status_t initCheck() const;
-
- uint32_t getWidth() const { return width; }
- uint32_t getHeight() const { return height; }
- uint32_t getStride() const { return stride; }
- uint32_t getUsage() const { return usage; }
- PixelFormat getPixelFormat() const { return format; }
- Rect getBounds() const { return Rect(width, height); }
-
- status_t reallocate(uint32_t w, uint32_t h, PixelFormat f, uint32_t usage);
-
- status_t lock(uint32_t usage, void** vaddr);
- status_t lock(uint32_t usage, const Rect& rect, void** vaddr);
- status_t unlock();
-
- ANativeWindowBuffer* getNativeBuffer() const;
-
- void setIndex(int index);
- int getIndex() const;
-
- // for debugging
- static void dumpAllocationsToSystemLog();
-
-private:
- virtual ~GraphicBuffer();
-
- enum {
- ownNone = 0,
- ownHandle = 1,
- ownData = 2,
- };
-
- inline const GraphicBufferMapper& getBufferMapper() const {
- return mBufferMapper;
- }
- inline GraphicBufferMapper& getBufferMapper() {
- return mBufferMapper;
- }
- uint8_t mOwner;
-
-private:
- friend class Surface;
- friend class BpSurface;
- friend class BnSurface;
- friend class SurfaceTextureClient;
- friend class LightRefBase<GraphicBuffer>;
- GraphicBuffer(const GraphicBuffer& rhs);
- GraphicBuffer& operator = (const GraphicBuffer& rhs);
- const GraphicBuffer& operator = (const GraphicBuffer& rhs) const;
-
- status_t initSize(uint32_t w, uint32_t h, PixelFormat format,
- uint32_t usage);
-
- 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;
- int mIndex;
-
- // If we're wrapping another buffer then this reference will make sure it
- // doesn't get freed.
- sp<ANativeWindowBuffer> mWrappedBuffer;
-};
-
-}; // namespace android
-
-#endif // ANDROID_GRAPHIC_BUFFER_H
diff --git a/include/ui/GraphicBufferAllocator.h b/include/ui/GraphicBufferAllocator.h
deleted file mode 100644
index dffa788..0000000
--- a/include/ui/GraphicBufferAllocator.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-**
-** Copyright 2009, 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_BUFFER_ALLOCATOR_H
-#define ANDROID_BUFFER_ALLOCATOR_H
-
-#include <stdint.h>
-
-#include <cutils/native_handle.h>
-
-#include <utils/Errors.h>
-#include <utils/KeyedVector.h>
-#include <utils/threads.h>
-#include <utils/Singleton.h>
-
-#include <ui/PixelFormat.h>
-
-#include <hardware/gralloc.h>
-
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-class String8;
-
-class GraphicBufferAllocator : public Singleton<GraphicBufferAllocator>
-{
-public:
- enum {
- USAGE_SW_READ_NEVER = GRALLOC_USAGE_SW_READ_NEVER,
- USAGE_SW_READ_RARELY = GRALLOC_USAGE_SW_READ_RARELY,
- USAGE_SW_READ_OFTEN = GRALLOC_USAGE_SW_READ_OFTEN,
- USAGE_SW_READ_MASK = GRALLOC_USAGE_SW_READ_MASK,
-
- USAGE_SW_WRITE_NEVER = GRALLOC_USAGE_SW_WRITE_NEVER,
- USAGE_SW_WRITE_RARELY = GRALLOC_USAGE_SW_WRITE_RARELY,
- USAGE_SW_WRITE_OFTEN = GRALLOC_USAGE_SW_WRITE_OFTEN,
- USAGE_SW_WRITE_MASK = GRALLOC_USAGE_SW_WRITE_MASK,
-
- USAGE_SOFTWARE_MASK = USAGE_SW_READ_MASK|USAGE_SW_WRITE_MASK,
-
- USAGE_HW_TEXTURE = GRALLOC_USAGE_HW_TEXTURE,
- USAGE_HW_RENDER = GRALLOC_USAGE_HW_RENDER,
- USAGE_HW_2D = GRALLOC_USAGE_HW_2D,
- USAGE_HW_MASK = GRALLOC_USAGE_HW_MASK
- };
-
- static inline GraphicBufferAllocator& get() { return getInstance(); }
-
-
- status_t alloc(uint32_t w, uint32_t h, PixelFormat format, int usage,
- buffer_handle_t* handle, int32_t* stride);
-
- status_t free(buffer_handle_t handle);
-
- void dump(String8& res) const;
- static void dumpToSystemLog();
-
-private:
- struct alloc_rec_t {
- uint32_t w;
- uint32_t h;
- uint32_t s;
- PixelFormat format;
- uint32_t usage;
- size_t size;
- };
-
- static Mutex sLock;
- static KeyedVector<buffer_handle_t, alloc_rec_t> sAllocList;
-
- friend class Singleton<GraphicBufferAllocator>;
- GraphicBufferAllocator();
- ~GraphicBufferAllocator();
-
- alloc_device_t *mAllocDev;
-};
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_BUFFER_ALLOCATOR_H
diff --git a/include/ui/GraphicBufferMapper.h b/include/ui/GraphicBufferMapper.h
deleted file mode 100644
index 697a02a..0000000
--- a/include/ui/GraphicBufferMapper.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2007 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_UI_BUFFER_MAPPER_H
-#define ANDROID_UI_BUFFER_MAPPER_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Singleton.h>
-
-#include <hardware/gralloc.h>
-
-
-struct gralloc_module_t;
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-class Rect;
-
-class GraphicBufferMapper : public Singleton<GraphicBufferMapper>
-{
-public:
- static inline GraphicBufferMapper& get() { return getInstance(); }
-
- status_t registerBuffer(buffer_handle_t handle);
-
- status_t unregisterBuffer(buffer_handle_t handle);
-
- status_t lock(buffer_handle_t handle,
- int usage, const Rect& bounds, void** vaddr);
-
- status_t unlock(buffer_handle_t handle);
-
- // dumps information about the mapping of this handle
- void dump(buffer_handle_t handle);
-
-private:
- friend class Singleton<GraphicBufferMapper>;
- GraphicBufferMapper();
- gralloc_module_t const *mAllocMod;
-};
-
-// ---------------------------------------------------------------------------
-
-}; // namespace android
-
-#endif // ANDROID_UI_BUFFER_MAPPER_H
-
diff --git a/include/ui/PixelFormat.h b/include/ui/PixelFormat.h
deleted file mode 100644
index 9f3e267..0000000
--- a/include/ui/PixelFormat.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 2005 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.
- */
-
-//
-
-// Pixel formats used across the system.
-// These formats might not all be supported by all renderers, for instance
-// skia or SurfaceFlinger are not required to support all of these formats
-// (either as source or destination)
-
-
-#ifndef UI_PIXELFORMAT_H
-#define UI_PIXELFORMAT_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <utils/Errors.h>
-#include <hardware/hardware.h>
-
-namespace android {
-
-enum {
- //
- // these constants need to match those
- // in graphics/PixelFormat.java & pixelflinger/format.h
- //
- PIXEL_FORMAT_UNKNOWN = 0,
- PIXEL_FORMAT_NONE = 0,
-
- // logical pixel formats used by the SurfaceFlinger -----------------------
- PIXEL_FORMAT_CUSTOM = -4,
- // Custom pixel-format described by a PixelFormatInfo structure
-
- PIXEL_FORMAT_TRANSLUCENT = -3,
- // System chooses a format that supports translucency (many alpha bits)
-
- PIXEL_FORMAT_TRANSPARENT = -2,
- // System chooses a format that supports transparency
- // (at least 1 alpha bit)
-
- PIXEL_FORMAT_OPAQUE = -1,
- // System chooses an opaque format (no alpha bits required)
-
- // real pixel formats supported for rendering -----------------------------
-
- 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 = 8, // 8-bit A
-};
-
-typedef int32_t PixelFormat;
-
-struct PixelFormatInfo {
- enum {
- INDEX_ALPHA = 0,
- INDEX_RED = 1,
- INDEX_GREEN = 2,
- INDEX_BLUE = 3
- };
-
- enum { // components
- ALPHA = 1,
- RGB = 2,
- RGBA = 3,
- L = 4,
- LA = 5,
- OTHER = 0xFF
- };
-
- struct szinfo {
- uint8_t h;
- uint8_t l;
- };
-
- inline PixelFormatInfo() : version(sizeof(PixelFormatInfo)) { }
- size_t getScanlineSize(unsigned int width) const;
- size_t getSize(size_t ci) const {
- return (ci <= 3) ? (cinfo[ci].h - cinfo[ci].l) : 0;
- }
- size_t version;
- PixelFormat format;
- size_t bytesPerPixel;
- size_t bitsPerPixel;
- union {
- szinfo cinfo[4];
- struct {
- uint8_t h_alpha;
- uint8_t l_alpha;
- uint8_t h_red;
- uint8_t l_red;
- uint8_t h_green;
- uint8_t l_green;
- uint8_t h_blue;
- uint8_t l_blue;
- };
- };
- uint8_t components;
- uint8_t reserved0[3];
- uint32_t reserved1;
-};
-
-// Consider caching the results of these functions are they're not
-// guaranteed to be fast.
-ssize_t bytesPerPixel(PixelFormat format);
-ssize_t bitsPerPixel(PixelFormat format);
-status_t getPixelFormatInfo(PixelFormat format, PixelFormatInfo* info);
-
-}; // namespace android
-
-#endif // UI_PIXELFORMAT_H
diff --git a/include/ui/Point.h b/include/ui/Point.h
deleted file mode 100644
index 1653120..0000000
--- a/include/ui/Point.h
+++ /dev/null
@@ -1,87 +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_UI_POINT
-#define ANDROID_UI_POINT
-
-#include <utils/TypeHelpers.h>
-
-namespace android {
-
-class Point
-{
-public:
- int x;
- int y;
-
- // we don't provide copy-ctor and operator= on purpose
- // because we want the compiler generated versions
-
- // Default constructor doesn't initialize the Point
- inline Point() {
- }
- inline Point(int x, int y) : x(x), y(y) {
- }
-
- inline bool operator == (const Point& rhs) const {
- return (x == rhs.x) && (y == rhs.y);
- }
- inline bool operator != (const Point& rhs) const {
- return !operator == (rhs);
- }
-
- inline bool isOrigin() const {
- return !(x|y);
- }
-
- // operator < defines an order which allows to use points in sorted
- // vectors.
- bool operator < (const Point& rhs) const {
- return y<rhs.y || (y==rhs.y && x<rhs.x);
- }
-
- inline Point& operator - () {
- x = -x;
- y = -y;
- return *this;
- }
-
- inline Point& operator += (const Point& rhs) {
- x += rhs.x;
- y += rhs.y;
- return *this;
- }
- inline Point& operator -= (const Point& rhs) {
- x -= rhs.x;
- y -= rhs.y;
- return *this;
- }
-
- const Point operator + (const Point& rhs) const {
- const Point result(x+rhs.x, y+rhs.y);
- return result;
- }
- const Point operator - (const Point& rhs) const {
- const Point result(x-rhs.x, y-rhs.y);
- return result;
- }
-};
-
-ANDROID_BASIC_TYPES_TRAITS(Point)
-
-}; // namespace android
-
-#endif // ANDROID_UI_POINT
diff --git a/include/ui/Rect.h b/include/ui/Rect.h
deleted file mode 100644
index 9e98bc5..0000000
--- a/include/ui/Rect.h
+++ /dev/null
@@ -1,149 +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_UI_RECT
-#define ANDROID_UI_RECT
-
-#include <utils/TypeHelpers.h>
-#include <ui/Point.h>
-
-#include <android/rect.h>
-
-namespace android {
-
-class Rect : public ARect
-{
-public:
- typedef ARect::value_type value_type;
-
- // we don't provide copy-ctor and operator= on purpose
- // because we want the compiler generated versions
-
- inline Rect() {
- }
- inline Rect(int32_t w, int32_t h) {
- left = top = 0; right = w; bottom = h;
- }
- inline Rect(int32_t l, int32_t t, int32_t r, int32_t b) {
- left = l; top = t; right = r; bottom = b;
- }
- inline Rect(const Point& lt, const Point& rb) {
- left = lt.x; top = lt.y; right = rb.x; bottom = rb.y;
- }
-
- void makeInvalid();
-
- inline void clear() {
- left = top = right = bottom = 0;
- }
-
- // a valid rectangle has a non negative width and height
- inline bool isValid() const {
- return (width()>=0) && (height()>=0);
- }
-
- // an empty rect has a zero width or height, or is invalid
- inline bool isEmpty() const {
- return (width()<=0) || (height()<=0);
- }
-
- inline void set(const Rect& rhs) {
- operator = (rhs);
- }
-
- // rectangle's width
- inline int32_t width() const {
- return right-left;
- }
-
- // rectangle's height
- inline int32_t height() const {
- return bottom-top;
- }
-
- void setLeftTop(const Point& lt) {
- left = lt.x;
- top = lt.y;
- }
-
- void setRightBottom(const Point& rb) {
- right = rb.x;
- bottom = rb.y;
- }
-
- // the following 4 functions return the 4 corners of the rect as Point
- Point leftTop() const {
- return Point(left, top);
- }
- Point rightBottom() const {
- return Point(right, bottom);
- }
- Point rightTop() const {
- return Point(right, top);
- }
- Point leftBottom() const {
- return Point(left, bottom);
- }
-
- // comparisons
- inline bool operator == (const Rect& rhs) const {
- return (left == rhs.left) && (top == rhs.top) &&
- (right == rhs.right) && (bottom == rhs.bottom);
- }
-
- inline bool operator != (const Rect& rhs) const {
- return !operator == (rhs);
- }
-
- // operator < defines an order which allows to use rectangles in sorted
- // vectors.
- bool operator < (const Rect& rhs) const;
-
- Rect& offsetToOrigin() {
- right -= left;
- bottom -= top;
- left = top = 0;
- return *this;
- }
- Rect& offsetTo(const Point& p) {
- return offsetTo(p.x, p.y);
- }
- Rect& offsetBy(const Point& dp) {
- return offsetBy(dp.x, dp.y);
- }
- Rect& operator += (const Point& rhs) {
- return offsetBy(rhs.x, rhs.y);
- }
- Rect& operator -= (const Point& rhs) {
- return offsetBy(-rhs.x, -rhs.y);
- }
- const Rect operator + (const Point& rhs) const;
- const Rect operator - (const Point& rhs) const;
-
- void translate(int32_t dx, int32_t dy) { // legacy, don't use.
- offsetBy(dx, dy);
- }
-
- Rect& offsetTo(int32_t x, int32_t y);
- Rect& offsetBy(int32_t x, int32_t y);
- bool intersect(const Rect& with, Rect* result) const;
-};
-
-ANDROID_BASIC_TYPES_TRAITS(Rect)
-
-}; // namespace android
-
-#endif // ANDROID_UI_RECT
diff --git a/include/ui/Region.h b/include/ui/Region.h
deleted file mode 100644
index f242f18..0000000
--- a/include/ui/Region.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright (C) 2007 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_UI_REGION_H
-#define ANDROID_UI_REGION_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Vector.h>
-
-#include <ui/Rect.h>
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-class String8;
-
-// ---------------------------------------------------------------------------
-class Region
-{
-public:
- Region();
- Region(const Region& rhs);
- explicit Region(const Rect& rhs);
- explicit Region(const void* buffer);
- ~Region();
-
- Region& operator = (const Region& rhs);
-
- inline bool isEmpty() const { return mBounds.isEmpty(); }
- inline bool isRect() const { return mStorage.isEmpty(); }
-
- inline Rect getBounds() const { return mBounds; }
- inline Rect bounds() const { return getBounds(); }
-
- // the region becomes its bounds
- Region& makeBoundsSelf();
-
- void clear();
- void set(const Rect& r);
- void set(uint32_t w, uint32_t h);
-
- Region& orSelf(const Rect& rhs);
- Region& xorSelf(const Rect& rhs);
- Region& andSelf(const Rect& rhs);
- Region& subtractSelf(const Rect& rhs);
-
- // boolean operators, applied on this
- Region& orSelf(const Region& rhs);
- Region& xorSelf(const Region& rhs);
- Region& andSelf(const Region& rhs);
- Region& subtractSelf(const Region& rhs);
-
- // boolean operators
- const Region merge(const Rect& rhs) const;
- const Region mergeExclusive(const Rect& rhs) const;
- const Region intersect(const Rect& rhs) const;
- const Region subtract(const Rect& rhs) const;
-
- // boolean operators
- const Region merge(const Region& rhs) const;
- const Region mergeExclusive(const Region& rhs) const;
- const Region intersect(const Region& rhs) const;
- const Region subtract(const Region& rhs) const;
-
- // these translate rhs first
- Region& translateSelf(int dx, int dy);
- Region& orSelf(const Region& rhs, int dx, int dy);
- Region& xorSelf(const Region& rhs, int dx, int dy);
- Region& andSelf(const Region& rhs, int dx, int dy);
- Region& subtractSelf(const Region& rhs, int dx, int dy);
-
- // these translate rhs first
- const Region translate(int dx, int dy) const;
- const Region merge(const Region& rhs, int dx, int dy) const;
- const Region mergeExclusive(const Region& rhs, int dx, int dy) const;
- const Region intersect(const Region& rhs, int dx, int dy) const;
- const Region subtract(const Region& rhs, int dx, int dy) const;
-
- // convenience operators overloads
- inline const Region operator | (const Region& rhs) const;
- inline const Region operator ^ (const Region& rhs) const;
- inline const Region operator & (const Region& rhs) const;
- inline const Region operator - (const Region& rhs) const;
- inline const Region operator + (const Point& pt) const;
-
- inline Region& operator |= (const Region& rhs);
- inline Region& operator ^= (const Region& rhs);
- inline Region& operator &= (const Region& rhs);
- inline Region& operator -= (const Region& rhs);
- inline Region& operator += (const Point& pt);
-
-
- /* various ways to access the rectangle list */
-
- typedef Rect const* const_iterator;
-
- const_iterator begin() const;
- const_iterator end() const;
-
- /* no user serviceable parts here... */
-
- size_t getRects(Vector<Rect>& rectList) const;
- Rect const* getArray(size_t* count) const;
-
-
- // add a rectangle to the internal list. This rectangle must
- // 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 raw buffer
- ssize_t write(void* buffer, size_t size) const;
- static ssize_t writeEmpty(void* buffer, size_t size);
-
- ssize_t read(const void* buffer);
- static bool isEmpty(void* buffer);
-
- void dump(String8& out, const char* what, uint32_t flags=0) const;
- void dump(const char* what, uint32_t flags=0) const;
-
-private:
- class rasterizer;
- friend class rasterizer;
-
- Region& operationSelf(const Rect& r, int op);
- Region& operationSelf(const Region& r, int op);
- Region& operationSelf(const Region& r, int dx, int dy, int op);
- const Region operation(const Rect& rhs, int op) const;
- const Region operation(const Region& rhs, int op) const;
- const Region operation(const Region& rhs, int dx, int dy, int op) const;
-
- static void boolean_operation(int op, Region& dst,
- const Region& lhs, const Region& rhs, int dx, int dy);
- static void boolean_operation(int op, Region& dst,
- const Region& lhs, const Rect& rhs, int dx, int dy);
-
- static void boolean_operation(int op, Region& dst,
- const Region& lhs, const Region& rhs);
- static void boolean_operation(int op, Region& dst,
- const Region& lhs, const Rect& rhs);
-
- static void translate(Region& reg, int dx, int dy);
- static void translate(Region& dst, const Region& reg, int dx, int dy);
-
- static bool validate(const Region& reg, const char* name);
-
- Rect mBounds;
- Vector<Rect> mStorage;
-};
-
-
-const Region Region::operator | (const Region& rhs) const {
- return merge(rhs);
-}
-const Region Region::operator ^ (const Region& rhs) const {
- return mergeExclusive(rhs);
-}
-const Region Region::operator & (const Region& rhs) const {
- return intersect(rhs);
-}
-const Region Region::operator - (const Region& rhs) const {
- return subtract(rhs);
-}
-const Region Region::operator + (const Point& pt) const {
- return translate(pt.x, pt.y);
-}
-
-
-Region& Region::operator |= (const Region& rhs) {
- return orSelf(rhs);
-}
-Region& Region::operator ^= (const Region& rhs) {
- return xorSelf(rhs);
-}
-Region& Region::operator &= (const Region& rhs) {
- return andSelf(rhs);
-}
-Region& Region::operator -= (const Region& rhs) {
- return subtractSelf(rhs);
-}
-Region& Region::operator += (const Point& pt) {
- return translateSelf(pt.x, pt.y);
-}
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_UI_REGION_H
-
diff --git a/include/utils/AndroidThreads.h b/include/utils/AndroidThreads.h
deleted file mode 100644
index f9f7aa4..0000000
--- a/include/utils/AndroidThreads.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 2007 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 _LIBS_UTILS_ANDROID_THREADS_H
-#define _LIBS_UTILS_ANDROID_THREADS_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#if defined(HAVE_PTHREADS)
-# include <pthread.h>
-#endif
-
-#include <utils/ThreadDefs.h>
-
-// ---------------------------------------------------------------------------
-// C API
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Create and run a new thread.
-extern int androidCreateThread(android_thread_func_t, void *);
-
-// Create thread with lots of parameters
-extern int androidCreateThreadEtc(android_thread_func_t entryFunction,
- void *userData,
- const char* threadName,
- int32_t threadPriority,
- size_t threadStackSize,
- android_thread_id_t *threadId);
-
-// Get some sort of unique identifier for the current thread.
-extern android_thread_id_t androidGetThreadId();
-
-// Low-level thread creation -- never creates threads that can
-// interact with the Java VM.
-extern int androidCreateRawThreadEtc(android_thread_func_t entryFunction,
- void *userData,
- const char* threadName,
- int32_t threadPriority,
- size_t threadStackSize,
- android_thread_id_t *threadId);
-
-// Used by the Java Runtime to control how threads are created, so that
-// they can be proper and lovely Java threads.
-typedef int (*android_create_thread_fn)(android_thread_func_t entryFunction,
- void *userData,
- const char* threadName,
- int32_t threadPriority,
- size_t threadStackSize,
- android_thread_id_t *threadId);
-
-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. Thread ID zero means current thread.
-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. Thread ID zero means current thread.
-extern int androidSetThreadPriority(pid_t tid, int prio);
-
-// Get the current priority of a particular thread. Returns one of the
-// ANDROID_PRIORITY constants or a negative result in case of error.
-extern int androidGetThreadPriority(pid_t tid);
-
-// Get the current scheduling group of a particular thread. Normally returns
-// one of the ANDROID_TGROUP constants other than ANDROID_TGROUP_DEFAULT.
-// Returns ANDROID_TGROUP_DEFAULT if no pthread support (e.g. on host) or if
-// scheduling groups are disabled. Returns INVALID_OPERATION if unexpected error.
-// Thread ID zero means current thread.
-extern int androidGetThreadSchedulingGroup(pid_t tid);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-// ----------------------------------------------------------------------------
-// C++ API
-#ifdef __cplusplus
-namespace android {
-// ----------------------------------------------------------------------------
-
-// Create and run a new thread.
-inline bool createThread(thread_func_t f, void *a) {
- return androidCreateThread(f, a) ? true : false;
-}
-
-// Create thread with lots of parameters
-inline bool createThreadEtc(thread_func_t entryFunction,
- void *userData,
- const char* threadName = "android:unnamed_thread",
- int32_t threadPriority = PRIORITY_DEFAULT,
- size_t threadStackSize = 0,
- thread_id_t *threadId = 0)
-{
- return androidCreateThreadEtc(entryFunction, userData, threadName,
- threadPriority, threadStackSize, threadId) ? true : false;
-}
-
-// Get some sort of unique identifier for the current thread.
-inline thread_id_t getThreadId() {
- return androidGetThreadId();
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-#endif // __cplusplus
-// ----------------------------------------------------------------------------
-
-#endif // _LIBS_UTILS_ANDROID_THREADS_H
diff --git a/include/utils/Atomic.h b/include/utils/Atomic.h
deleted file mode 100644
index 7eb476c..0000000
--- a/include/utils/Atomic.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 2005 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_ATOMIC_H
-#define ANDROID_UTILS_ATOMIC_H
-
-#include <cutils/atomic.h>
-
-#endif // ANDROID_UTILS_ATOMIC_H
diff --git a/include/utils/BasicHashtable.h b/include/utils/BasicHashtable.h
deleted file mode 100644
index fdf9738..0000000
--- a/include/utils/BasicHashtable.h
+++ /dev/null
@@ -1,393 +0,0 @@
-/*
- * Copyright (C) 2011 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_BASIC_HASHTABLE_H
-#define ANDROID_BASIC_HASHTABLE_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <utils/SharedBuffer.h>
-#include <utils/TypeHelpers.h>
-
-namespace android {
-
-/* Implementation type. Nothing to see here. */
-class BasicHashtableImpl {
-protected:
- struct Bucket {
- // The collision flag indicates that the bucket is part of a collision chain
- // such that at least two entries both hash to this bucket. When true, we
- // may need to seek further along the chain to find the entry.
- static const uint32_t COLLISION = 0x80000000UL;
-
- // The present flag indicates that the bucket contains an initialized entry value.
- static const uint32_t PRESENT = 0x40000000UL;
-
- // Mask for 30 bits worth of the hash code that are stored within the bucket to
- // speed up lookups and rehashing by eliminating the need to recalculate the
- // hash code of the entry's key.
- static const uint32_t HASH_MASK = 0x3fffffffUL;
-
- // Combined value that stores the collision and present flags as well as
- // a 30 bit hash code.
- uint32_t cookie;
-
- // Storage for the entry begins here.
- char entry[0];
- };
-
- BasicHashtableImpl(size_t entrySize, bool hasTrivialDestructor,
- size_t minimumInitialCapacity, float loadFactor);
- BasicHashtableImpl(const BasicHashtableImpl& other);
-
- void dispose();
-
- inline void edit() {
- if (mBuckets && !SharedBuffer::bufferFromData(mBuckets)->onlyOwner()) {
- clone();
- }
- }
-
- void setTo(const BasicHashtableImpl& other);
- void clear();
-
- ssize_t next(ssize_t index) const;
- ssize_t find(ssize_t index, hash_t hash, const void* __restrict__ key) const;
- size_t add(hash_t hash, const void* __restrict__ entry);
- void removeAt(size_t index);
- void rehash(size_t minimumCapacity, float loadFactor);
-
- const size_t mBucketSize; // number of bytes per bucket including the entry
- const bool mHasTrivialDestructor; // true if the entry type does not require destruction
- size_t mCapacity; // number of buckets that can be filled before exceeding load factor
- float mLoadFactor; // load factor
- size_t mSize; // number of elements actually in the table
- size_t mFilledBuckets; // number of buckets for which collision or present is true
- size_t mBucketCount; // number of slots in the mBuckets array
- void* mBuckets; // array of buckets, as a SharedBuffer
-
- inline const Bucket& bucketAt(const void* __restrict__ buckets, size_t index) const {
- return *reinterpret_cast<const Bucket*>(
- static_cast<const uint8_t*>(buckets) + index * mBucketSize);
- }
-
- inline Bucket& bucketAt(void* __restrict__ buckets, size_t index) const {
- return *reinterpret_cast<Bucket*>(static_cast<uint8_t*>(buckets) + index * mBucketSize);
- }
-
- virtual bool compareBucketKey(const Bucket& bucket, const void* __restrict__ key) const = 0;
- virtual void initializeBucketEntry(Bucket& bucket, const void* __restrict__ entry) const = 0;
- virtual void destroyBucketEntry(Bucket& bucket) const = 0;
-
-private:
- void clone();
-
- // Allocates a bucket array as a SharedBuffer.
- void* allocateBuckets(size_t count) const;
-
- // Releases a bucket array's associated SharedBuffer.
- void releaseBuckets(void* __restrict__ buckets, size_t count) const;
-
- // Destroys the contents of buckets (invokes destroyBucketEntry for each
- // populated bucket if needed).
- void destroyBuckets(void* __restrict__ buckets, size_t count) const;
-
- // Copies the content of buckets (copies the cookie and invokes copyBucketEntry
- // for each populated bucket if needed).
- void copyBuckets(const void* __restrict__ fromBuckets,
- void* __restrict__ toBuckets, size_t count) const;
-
- // Determines the appropriate size of a bucket array to store a certain minimum
- // number of entries and returns its effective capacity.
- static void determineCapacity(size_t minimumCapacity, float loadFactor,
- size_t* __restrict__ outBucketCount, size_t* __restrict__ outCapacity);
-
- // Trim a hash code to 30 bits to match what we store in the bucket's cookie.
- inline static hash_t trimHash(hash_t hash) {
- return (hash & Bucket::HASH_MASK) ^ (hash >> 30);
- }
-
- // Returns the index of the first bucket that is in the collision chain
- // for the specified hash code, given the total number of buckets.
- // (Primary hash)
- inline static size_t chainStart(hash_t hash, size_t count) {
- return hash % count;
- }
-
- // Returns the increment to add to a bucket index to seek to the next bucket
- // in the collision chain for the specified hash code, given the total number of buckets.
- // (Secondary hash)
- inline static size_t chainIncrement(hash_t hash, size_t count) {
- return ((hash >> 7) | (hash << 25)) % (count - 1) + 1;
- }
-
- // Returns the index of the next bucket that is in the collision chain
- // that is defined by the specified increment, given the total number of buckets.
- inline static size_t chainSeek(size_t index, size_t increment, size_t count) {
- return (index + increment) % count;
- }
-};
-
-/*
- * A BasicHashtable stores entries that are indexed by hash code in place
- * within an array. The basic operations are finding entries by key,
- * adding new entries and removing existing entries.
- *
- * This class provides a very limited set of operations with simple semantics.
- * It is intended to be used as a building block to construct more complex
- * and interesting data structures such as HashMap. Think very hard before
- * adding anything extra to BasicHashtable, it probably belongs at a
- * higher level of abstraction.
- *
- * TKey: The key type.
- * TEntry: The entry type which is what is actually stored in the array.
- *
- * TKey must support the following contract:
- * bool operator==(const TKey& other) const; // return true if equal
- * bool operator!=(const TKey& other) const; // return true if unequal
- *
- * TEntry must support the following contract:
- * const TKey& getKey() const; // get the key from the entry
- *
- * This class supports storing entries with duplicate keys. Of course, it can't
- * tell them apart during removal so only the first entry will be removed.
- * We do this because it means that operations like add() can't fail.
- */
-template <typename TKey, typename TEntry>
-class BasicHashtable : private BasicHashtableImpl {
-public:
- /* Creates a hashtable with the specified minimum initial capacity.
- * The underlying array will be created when the first entry is added.
- *
- * minimumInitialCapacity: The minimum initial capacity for the hashtable.
- * Default is 0.
- * loadFactor: The desired load factor for the hashtable, between 0 and 1.
- * Default is 0.75.
- */
- BasicHashtable(size_t minimumInitialCapacity = 0, float loadFactor = 0.75f);
-
- /* Copies a hashtable.
- * The underlying storage is shared copy-on-write.
- */
- BasicHashtable(const BasicHashtable& other);
-
- /* Clears and destroys the hashtable.
- */
- virtual ~BasicHashtable();
-
- /* Making this hashtable a copy of the other hashtable.
- * The underlying storage is shared copy-on-write.
- *
- * other: The hashtable to copy.
- */
- inline BasicHashtable<TKey, TEntry>& operator =(const BasicHashtable<TKey, TEntry> & other) {
- setTo(other);
- return *this;
- }
-
- /* Returns the number of entries in the hashtable.
- */
- inline size_t size() const {
- return mSize;
- }
-
- /* Returns the capacity of the hashtable, which is the number of elements that can
- * added to the hashtable without requiring it to be grown.
- */
- inline size_t capacity() const {
- return mCapacity;
- }
-
- /* Returns the number of buckets that the hashtable has, which is the size of its
- * underlying array.
- */
- inline size_t bucketCount() const {
- return mBucketCount;
- }
-
- /* Returns the load factor of the hashtable. */
- inline float loadFactor() const {
- return mLoadFactor;
- };
-
- /* Returns a const reference to the entry at the specified index.
- *
- * index: The index of the entry to retrieve. Must be a valid index within
- * the bounds of the hashtable.
- */
- inline const TEntry& entryAt(size_t index) const {
- return entryFor(bucketAt(mBuckets, index));
- }
-
- /* Returns a non-const reference to the entry at the specified index.
- *
- * index: The index of the entry to edit. Must be a valid index within
- * the bounds of the hashtable.
- */
- inline TEntry& editEntryAt(size_t index) {
- edit();
- return entryFor(bucketAt(mBuckets, index));
- }
-
- /* Clears the hashtable.
- * All entries in the hashtable are destroyed immediately.
- * If you need to do something special with the entries in the hashtable then iterate
- * over them and do what you need before clearing the hashtable.
- */
- inline void clear() {
- BasicHashtableImpl::clear();
- }
-
- /* Returns the index of the next entry in the hashtable given the index of a previous entry.
- * If the given index is -1, then returns the index of the first entry in the hashtable,
- * if there is one, or -1 otherwise.
- * If the given index is not -1, then returns the index of the next entry in the hashtable,
- * in strictly increasing order, or -1 if there are none left.
- *
- * index: The index of the previous entry that was iterated, or -1 to begin
- * iteration at the beginning of the hashtable.
- */
- inline ssize_t next(ssize_t index) const {
- return BasicHashtableImpl::next(index);
- }
-
- /* Finds the index of an entry with the specified key.
- * If the given index is -1, then returns the index of the first matching entry,
- * otherwise returns the index of the next matching entry.
- * If the hashtable contains multiple entries with keys that match the requested
- * key, then the sequence of entries returned is arbitrary.
- * Returns -1 if no entry was found.
- *
- * index: The index of the previous entry with the specified key, or -1 to
- * find the first matching entry.
- * hash: The hashcode of the key.
- * key: The key.
- */
- inline ssize_t find(ssize_t index, hash_t hash, const TKey& key) const {
- return BasicHashtableImpl::find(index, hash, &key);
- }
-
- /* Adds the entry to the hashtable.
- * Returns the index of the newly added entry.
- * If an entry with the same key already exists, then a duplicate entry is added.
- * If the entry will not fit, then the hashtable's capacity is increased and
- * its contents are rehashed. See rehash().
- *
- * hash: The hashcode of the key.
- * entry: The entry to add.
- */
- inline size_t add(hash_t hash, const TEntry& entry) {
- return BasicHashtableImpl::add(hash, &entry);
- }
-
- /* Removes the entry with the specified index from the hashtable.
- * The entry is destroyed immediately.
- * The index must be valid.
- *
- * The hashtable is not compacted after an item is removed, so it is legal
- * to continue iterating over the hashtable using next() or find().
- *
- * index: The index of the entry to remove. Must be a valid index within the
- * bounds of the hashtable, and it must refer to an existing entry.
- */
- inline void removeAt(size_t index) {
- BasicHashtableImpl::removeAt(index);
- }
-
- /* Rehashes the contents of the hashtable.
- * Grows the hashtable to at least the specified minimum capacity or the
- * current number of elements, whichever is larger.
- *
- * Rehashing causes all entries to be copied and the entry indices may change.
- * Although the hash codes are cached by the hashtable, rehashing can be an
- * expensive operation and should be avoided unless the hashtable's size
- * needs to be changed.
- *
- * Rehashing is the only way to change the capacity or load factor of the
- * hashtable once it has been created. It can be used to compact the
- * hashtable by choosing a minimum capacity that is smaller than the current
- * capacity (such as 0).
- *
- * minimumCapacity: The desired minimum capacity after rehashing.
- * loadFactor: The desired load factor after rehashing.
- */
- inline void rehash(size_t minimumCapacity, float loadFactor) {
- BasicHashtableImpl::rehash(minimumCapacity, loadFactor);
- }
-
-protected:
- static inline const TEntry& entryFor(const Bucket& bucket) {
- return reinterpret_cast<const TEntry&>(bucket.entry);
- }
-
- static inline TEntry& entryFor(Bucket& bucket) {
- return reinterpret_cast<TEntry&>(bucket.entry);
- }
-
- virtual bool compareBucketKey(const Bucket& bucket, const void* __restrict__ key) const;
- virtual void initializeBucketEntry(Bucket& bucket, const void* __restrict__ entry) const;
- virtual void destroyBucketEntry(Bucket& bucket) const;
-
-private:
- // For dumping the raw contents of a hashtable during testing.
- friend class BasicHashtableTest;
- inline uint32_t cookieAt(size_t index) const {
- return bucketAt(mBuckets, index).cookie;
- }
-};
-
-template <typename TKey, typename TEntry>
-BasicHashtable<TKey, TEntry>::BasicHashtable(size_t minimumInitialCapacity, float loadFactor) :
- BasicHashtableImpl(sizeof(TEntry), traits<TEntry>::has_trivial_dtor,
- minimumInitialCapacity, loadFactor) {
-}
-
-template <typename TKey, typename TEntry>
-BasicHashtable<TKey, TEntry>::BasicHashtable(const BasicHashtable<TKey, TEntry>& other) :
- BasicHashtableImpl(other) {
-}
-
-template <typename TKey, typename TEntry>
-BasicHashtable<TKey, TEntry>::~BasicHashtable() {
- dispose();
-}
-
-template <typename TKey, typename TEntry>
-bool BasicHashtable<TKey, TEntry>::compareBucketKey(const Bucket& bucket,
- const void* __restrict__ key) const {
- return entryFor(bucket).getKey() == *static_cast<const TKey*>(key);
-}
-
-template <typename TKey, typename TEntry>
-void BasicHashtable<TKey, TEntry>::initializeBucketEntry(Bucket& bucket,
- const void* __restrict__ entry) const {
- if (!traits<TEntry>::has_trivial_copy) {
- new (&entryFor(bucket)) TEntry(*(static_cast<const TEntry*>(entry)));
- } else {
- memcpy(&entryFor(bucket), entry, sizeof(TEntry));
- }
-}
-
-template <typename TKey, typename TEntry>
-void BasicHashtable<TKey, TEntry>::destroyBucketEntry(Bucket& bucket) const {
- if (!traits<TEntry>::has_trivial_dtor) {
- entryFor(bucket).~TEntry();
- }
-}
-
-}; // namespace android
-
-#endif // ANDROID_BASIC_HASHTABLE_H
diff --git a/include/utils/BitSet.h b/include/utils/BitSet.h
deleted file mode 100644
index 9452e86..0000000
--- a/include/utils/BitSet.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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 UTILS_BITSET_H
-#define UTILS_BITSET_H
-
-#include <stdint.h>
-
-/*
- * Contains some bit manipulation helpers.
- */
-
-namespace android {
-
-// A simple set of 32 bits that can be individually marked or cleared.
-struct BitSet32 {
- uint32_t value;
-
- inline BitSet32() : value(0) { }
- explicit inline BitSet32(uint32_t value) : value(value) { }
-
- // Gets the value associated with a particular bit index.
- static inline uint32_t valueForBit(uint32_t n) { return 0x80000000 >> n; }
-
- // Clears the bit set.
- inline void clear() { value = 0; }
-
- // Returns the number of marked bits in the set.
- inline uint32_t count() const { return __builtin_popcount(value); }
-
- // Returns true if the bit set does not contain any marked bits.
- inline bool isEmpty() const { return ! value; }
-
- // Returns true if the bit set does not contain any unmarked bits.
- inline bool isFull() const { return value == 0xffffffff; }
-
- // Returns true if the specified bit is marked.
- inline bool hasBit(uint32_t n) const { return value & valueForBit(n); }
-
- // Marks the specified bit.
- inline void markBit(uint32_t n) { value |= valueForBit(n); }
-
- // Clears the specified bit.
- inline void clearBit(uint32_t n) { value &= ~ valueForBit(n); }
-
- // Finds the first marked bit in the set.
- // Result is undefined if all bits are unmarked.
- inline uint32_t firstMarkedBit() const { return __builtin_clz(value); }
-
- // Finds the first unmarked bit in the set.
- // Result is undefined if all bits are marked.
- inline uint32_t firstUnmarkedBit() const { return __builtin_clz(~ value); }
-
- // Finds the last marked bit in the set.
- // Result is undefined if all bits are unmarked.
- inline uint32_t lastMarkedBit() const { return 31 - __builtin_ctz(value); }
-
- // Finds the first marked bit in the set and clears it. Returns the bit index.
- // Result is undefined if all bits are unmarked.
- inline uint32_t clearFirstMarkedBit() {
- uint32_t n = firstMarkedBit();
- clearBit(n);
- return n;
- }
-
- // Finds the first unmarked bit in the set and marks it. Returns the bit index.
- // Result is undefined if all bits are marked.
- inline uint32_t markFirstUnmarkedBit() {
- uint32_t n = firstUnmarkedBit();
- markBit(n);
- return n;
- }
-
- // Finds the last marked bit in the set and clears it. Returns the bit index.
- // Result is undefined if all bits are unmarked.
- inline uint32_t clearLastMarkedBit() {
- uint32_t n = lastMarkedBit();
- clearBit(n);
- return n;
- }
-
- // Gets the index of the specified bit in the set, which is the number of
- // marked bits that appear before the specified bit.
- inline uint32_t getIndexOfBit(uint32_t n) const {
- return __builtin_popcount(value & ~(0xffffffffUL >> n));
- }
-
- inline bool operator== (const BitSet32& other) const { return value == other.value; }
- inline bool operator!= (const BitSet32& other) const { return value != other.value; }
-};
-
-} // namespace android
-
-#endif // UTILS_BITSET_H
diff --git a/include/utils/BlobCache.h b/include/utils/BlobCache.h
deleted file mode 100644
index 4f342a2..0000000
--- a/include/utils/BlobCache.h
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- ** Copyright 2011, 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_BLOB_CACHE_H
-#define ANDROID_BLOB_CACHE_H
-
-#include <stddef.h>
-
-#include <utils/Flattenable.h>
-#include <utils/RefBase.h>
-#include <utils/SortedVector.h>
-#include <utils/threads.h>
-
-namespace android {
-
-// A BlobCache is an in-memory cache for binary key/value pairs. A BlobCache
-// does NOT provide any thread-safety guarantees.
-//
-// The cache contents can be serialized to an in-memory buffer or mmap'd file
-// and then reloaded in a subsequent execution of the program. This
-// serialization is non-portable and the data should only be used by the device
-// that generated it.
-class BlobCache : public RefBase, public Flattenable {
-public:
-
- // Create an empty blob cache. The blob cache will cache key/value pairs
- // with key and value sizes less than or equal to maxKeySize and
- // maxValueSize, respectively. The total combined size of ALL cache entries
- // (key sizes plus value sizes) will not exceed maxTotalSize.
- BlobCache(size_t maxKeySize, size_t maxValueSize, size_t maxTotalSize);
-
- // set inserts a new binary value into the cache and associates it with the
- // given binary key. If the key or value are too large for the cache then
- // the cache remains unchanged. This includes the case where a different
- // value was previously associated with the given key - the old value will
- // remain in the cache. If the given key and value are small enough to be
- // put in the cache (based on the maxKeySize, maxValueSize, and maxTotalSize
- // values specified to the BlobCache constructor), then the key/value pair
- // will be in the cache after set returns. Note, however, that a subsequent
- // call to set may evict old key/value pairs from the cache.
- //
- // Preconditions:
- // key != NULL
- // 0 < keySize
- // value != NULL
- // 0 < valueSize
- void set(const void* key, size_t keySize, const void* value,
- size_t valueSize);
-
- // get retrieves from the cache the binary value associated with a given
- // binary key. If the key is present in the cache then the length of the
- // binary value associated with that key is returned. If the value argument
- // is non-NULL and the size of the cached value is less than valueSize bytes
- // then the cached value is copied into the buffer pointed to by the value
- // argument. If the key is not present in the cache then 0 is returned and
- // the buffer pointed to by the value argument is not modified.
- //
- // Note that when calling get multiple times with the same key, the later
- // calls may fail, returning 0, even if earlier calls succeeded. The return
- // value must be checked for each call.
- //
- // Preconditions:
- // key != NULL
- // 0 < keySize
- // 0 <= valueSize
- size_t get(const void* key, size_t keySize, void* value, size_t valueSize);
-
- // getFlattenedSize returns the number of bytes needed to store the entire
- // serialized cache.
- virtual size_t getFlattenedSize() const;
-
- // getFdCount returns the number of file descriptors that will result from
- // flattening the cache. This will always return 0 so as to allow the
- // flattened cache to be saved to disk and then later restored.
- virtual size_t getFdCount() const;
-
- // flatten serializes the current contents of the cache into the memory
- // pointed to by 'buffer'. The serialized cache contents can later be
- // loaded into a BlobCache object using the unflatten method. The contents
- // of the BlobCache object will not be modified.
- //
- // Preconditions:
- // size >= this.getFlattenedSize()
- // count == 0
- virtual status_t flatten(void* buffer, size_t size, int fds[],
- size_t count) const;
-
- // unflatten replaces the contents of the cache with the serialized cache
- // contents in the memory pointed to by 'buffer'. The previous contents of
- // the BlobCache will be evicted from the cache. If an error occurs while
- // unflattening the serialized cache contents then the BlobCache will be
- // left in an empty state.
- //
- // Preconditions:
- // count == 0
- virtual status_t unflatten(void const* buffer, size_t size, int fds[],
- size_t count);
-
-private:
- // Copying is disallowed.
- BlobCache(const BlobCache&);
- void operator=(const BlobCache&);
-
- // A random function helper to get around MinGW not having nrand48()
- long int blob_random();
-
- // clean evicts a randomly chosen set of entries from the cache such that
- // the total size of all remaining entries is less than mMaxTotalSize/2.
- void clean();
-
- // isCleanable returns true if the cache is full enough for the clean method
- // to have some effect, and false otherwise.
- bool isCleanable() const;
-
- // A Blob is an immutable sized unstructured data blob.
- class Blob : public RefBase {
- public:
- Blob(const void* data, size_t size, bool copyData);
- ~Blob();
-
- bool operator<(const Blob& rhs) const;
-
- const void* getData() const;
- size_t getSize() const;
-
- private:
- // Copying is not allowed.
- Blob(const Blob&);
- void operator=(const Blob&);
-
- // mData points to the buffer containing the blob data.
- const void* mData;
-
- // mSize is the size of the blob data in bytes.
- size_t mSize;
-
- // mOwnsData indicates whether or not this Blob object should free the
- // memory pointed to by mData when the Blob gets destructed.
- bool mOwnsData;
- };
-
- // A CacheEntry is a single key/value pair in the cache.
- class CacheEntry {
- public:
- CacheEntry();
- CacheEntry(const sp<Blob>& key, const sp<Blob>& value);
- CacheEntry(const CacheEntry& ce);
-
- bool operator<(const CacheEntry& rhs) const;
- const CacheEntry& operator=(const CacheEntry&);
-
- sp<Blob> getKey() const;
- sp<Blob> getValue() const;
-
- void setValue(const sp<Blob>& value);
-
- private:
-
- // mKey is the key that identifies the cache entry.
- sp<Blob> mKey;
-
- // mValue is the cached data associated with the key.
- sp<Blob> mValue;
- };
-
- // A Header is the header for the entire BlobCache serialization format. No
- // need to make this portable, so we simply write the struct out.
- struct Header {
- // mMagicNumber is the magic number that identifies the data as
- // serialized BlobCache contents. It must always contain 'Blb$'.
- uint32_t mMagicNumber;
-
- // mBlobCacheVersion is the serialization format version.
- uint32_t mBlobCacheVersion;
-
- // mDeviceVersion is the device-specific version of the cache. This can
- // be used to invalidate the cache.
- uint32_t mDeviceVersion;
-
- // mNumEntries is number of cache entries following the header in the
- // data.
- size_t mNumEntries;
- };
-
- // An EntryHeader is the header for a serialized cache entry. No need to
- // make this portable, so we simply write the struct out. Each EntryHeader
- // is followed imediately by the key data and then the value data.
- //
- // The beginning of each serialized EntryHeader is 4-byte aligned, so the
- // number of bytes that a serialized cache entry will occupy is:
- //
- // ((sizeof(EntryHeader) + keySize + valueSize) + 3) & ~3
- //
- struct EntryHeader {
- // mKeySize is the size of the entry key in bytes.
- size_t mKeySize;
-
- // mValueSize is the size of the entry value in bytes.
- size_t mValueSize;
-
- // mData contains both the key and value data for the cache entry. The
- // key comes first followed immediately by the value.
- uint8_t mData[];
- };
-
- // mMaxKeySize is the maximum key size that will be cached. Calls to
- // BlobCache::set with a keySize parameter larger than mMaxKeySize will
- // simply not add the key/value pair to the cache.
- const size_t mMaxKeySize;
-
- // mMaxValueSize is the maximum value size that will be cached. Calls to
- // BlobCache::set with a valueSize parameter larger than mMaxValueSize will
- // simply not add the key/value pair to the cache.
- const size_t mMaxValueSize;
-
- // mMaxTotalSize is the maximum size that all cache entries can occupy. This
- // includes space for both keys and values. When a call to BlobCache::set
- // would otherwise cause this limit to be exceeded, either the key/value
- // pair passed to BlobCache::set will not be cached or other cache entries
- // will be evicted from the cache to make room for the new entry.
- const size_t mMaxTotalSize;
-
- // mTotalSize is the total combined size of all keys and values currently in
- // the cache.
- size_t mTotalSize;
-
- // mRandState is the pseudo-random number generator state. It is passed to
- // nrand48 to generate random numbers when needed.
- unsigned short mRandState[3];
-
- // mCacheEntries stores all the cache entries that are resident in memory.
- // Cache entries are added to it by the 'set' method.
- SortedVector<CacheEntry> mCacheEntries;
-};
-
-}
-
-#endif // ANDROID_BLOB_CACHE_H
diff --git a/include/utils/BufferedTextOutput.h b/include/utils/BufferedTextOutput.h
deleted file mode 100644
index 69c6240..0000000
--- a/include/utils/BufferedTextOutput.h
+++ /dev/null
@@ -1,67 +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_BUFFEREDTEXTOUTPUT_H
-#define ANDROID_BUFFEREDTEXTOUTPUT_H
-
-#include <utils/TextOutput.h>
-#include <utils/threads.h>
-#include <cutils/uio.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-
-class BufferedTextOutput : public TextOutput
-{
-public:
- //** Flags for constructor */
- enum {
- MULTITHREADED = 0x0001
- };
-
- BufferedTextOutput(uint32_t flags = 0);
- virtual ~BufferedTextOutput();
-
- virtual status_t print(const char* txt, size_t len);
- virtual void moveIndent(int delta);
-
- virtual void pushBundle();
- virtual void popBundle();
-
-protected:
- virtual status_t writeLines(const struct iovec& vec, size_t N) = 0;
-
-private:
- struct BufferState;
- struct ThreadState;
-
- static ThreadState*getThreadState();
- static void threadDestructor(void *st);
-
- BufferState*getBuffer() const;
-
- uint32_t mFlags;
- const int32_t mSeq;
- const int32_t mIndex;
-
- Mutex mLock;
- BufferState* mGlobalState;
-};
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_BUFFEREDTEXTOUTPUT_H
diff --git a/include/utils/ByteOrder.h b/include/utils/ByteOrder.h
deleted file mode 100644
index baa3a83..0000000
--- a/include/utils/ByteOrder.h
+++ /dev/null
@@ -1,81 +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 _LIBS_UTILS_BYTE_ORDER_H
-#define _LIBS_UTILS_BYTE_ORDER_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#ifdef HAVE_WINSOCK
-#include <winsock2.h>
-#else
-#include <netinet/in.h>
-#endif
-
-/*
- * These macros are like the hton/ntoh byte swapping macros,
- * except they allow you to swap to and from the "device" byte
- * order. The device byte order is the endianness of the target
- * device -- for the ARM CPUs we use today, this is little endian.
- *
- * Note that the byte swapping functions have not been optimized
- * much; performance is currently not an issue for them since the
- * intent is to allow us to avoid byte swapping on the device.
- */
-
-static inline uint32_t android_swap_long(uint32_t v)
-{
- return (v<<24) | ((v<<8)&0x00FF0000) | ((v>>8)&0x0000FF00) | (v>>24);
-}
-
-static inline uint16_t android_swap_short(uint16_t v)
-{
- return (v<<8) | (v>>8);
-}
-
-#define DEVICE_BYTE_ORDER LITTLE_ENDIAN
-
-#if BYTE_ORDER == DEVICE_BYTE_ORDER
-
-#define dtohl(x) (x)
-#define dtohs(x) (x)
-#define htodl(x) (x)
-#define htods(x) (x)
-
-#else
-
-#define dtohl(x) (android_swap_long(x))
-#define dtohs(x) (android_swap_short(x))
-#define htodl(x) (android_swap_long(x))
-#define htods(x) (android_swap_short(x))
-
-#endif
-
-#if BYTE_ORDER == LITTLE_ENDIAN
-#define fromlel(x) (x)
-#define fromles(x) (x)
-#define tolel(x) (x)
-#define toles(x) (x)
-#else
-#define fromlel(x) (android_swap_long(x))
-#define fromles(x) (android_swap_short(x))
-#define tolel(x) (android_swap_long(x))
-#define toles(x) (android_swap_short(x))
-#endif
-
-#endif // _LIBS_UTILS_BYTE_ORDER_H
diff --git a/include/utils/CallStack.h b/include/utils/CallStack.h
deleted file mode 100644
index 079e20c..0000000
--- a/include/utils/CallStack.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2007 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_CALLSTACK_H
-#define ANDROID_CALLSTACK_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/String8.h>
-#include <corkscrew/backtrace.h>
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-class CallStack
-{
-public:
- enum {
- MAX_DEPTH = 31
- };
-
- CallStack();
- CallStack(const CallStack& rhs);
- ~CallStack();
-
- CallStack& operator = (const CallStack& rhs);
-
- bool operator == (const CallStack& rhs) const;
- bool operator != (const CallStack& rhs) const;
- bool operator < (const CallStack& rhs) const;
- bool operator >= (const CallStack& rhs) const;
- bool operator > (const CallStack& rhs) const;
- bool operator <= (const CallStack& rhs) const;
-
- const void* operator [] (int index) const;
-
- void clear();
-
- void update(int32_t ignoreDepth=1, int32_t maxDepth=MAX_DEPTH);
-
- // Dump a stack trace to the log
- void dump(const char* prefix = 0) const;
-
- // Return a string (possibly very long) containing the complete stack trace
- String8 toString(const char* prefix = 0) const;
-
- size_t size() const { return mCount; }
-
-private:
- size_t mCount;
- backtrace_frame_t mStack[MAX_DEPTH];
-};
-
-}; // namespace android
-
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_CALLSTACK_H
diff --git a/include/utils/Compat.h b/include/utils/Compat.h
deleted file mode 100644
index 1819266..0000000
--- a/include/utils/Compat.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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 __LIB_UTILS_COMPAT_H
-#define __LIB_UTILS_COMPAT_H
-
-#include <unistd.h>
-
-/* Compatibility definitions for non-Linux (i.e., BSD-based) hosts. */
-#ifndef HAVE_OFF64_T
-#if _FILE_OFFSET_BITS < 64
-#error "_FILE_OFFSET_BITS < 64; large files are not supported on this platform"
-#endif /* _FILE_OFFSET_BITS < 64 */
-
-typedef off_t off64_t;
-
-static inline off64_t lseek64(int fd, off64_t offset, int whence) {
- return lseek(fd, offset, whence);
-}
-
-#ifdef HAVE_PREAD
-static inline ssize_t pread64(int fd, void* buf, size_t nbytes, off64_t offset) {
- return pread(fd, buf, nbytes, offset);
-}
-#endif
-
-#endif /* !HAVE_OFF64_T */
-
-#endif /* __LIB_UTILS_COMPAT_H */
diff --git a/include/utils/Condition.h b/include/utils/Condition.h
deleted file mode 100644
index 8852d53..0000000
--- a/include/utils/Condition.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (C) 2007 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 _LIBS_UTILS_CONDITION_H
-#define _LIBS_UTILS_CONDITION_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <time.h>
-
-#if defined(HAVE_PTHREADS)
-# include <pthread.h>
-#endif
-
-#include <utils/Errors.h>
-#include <utils/Mutex.h>
-#include <utils/Timers.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-// ---------------------------------------------------------------------------
-
-/*
- * Condition variable class. The implementation is system-dependent.
- *
- * Condition variables are paired up with mutexes. Lock the mutex,
- * call wait(), then either re-wait() if things aren't quite what you want,
- * or unlock the mutex and continue. All threads calling wait() must
- * use the same mutex for a given Condition.
- */
-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);
- // same with relative timeout
- status_t waitRelative(Mutex& mutex, nsecs_t reltime);
- // Signal the condition variable, allowing one thread to continue.
- void signal();
- // Signal the condition variable, allowing all threads to continue.
- void broadcast();
-
-private:
-#if defined(HAVE_PTHREADS)
- pthread_cond_t mCond;
-#else
- void* mState;
-#endif
-};
-
-// ---------------------------------------------------------------------------
-
-#if defined(HAVE_PTHREADS)
-
-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);
-}
-inline status_t Condition::wait(Mutex& mutex) {
- return -pthread_cond_wait(&mCond, &mutex.mMutex);
-}
-inline status_t Condition::waitRelative(Mutex& mutex, nsecs_t reltime) {
-#if defined(HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE)
- struct timespec ts;
- ts.tv_sec = reltime/1000000000;
- ts.tv_nsec = reltime%1000000000;
- return -pthread_cond_timedwait_relative_np(&mCond, &mutex.mMutex, &ts);
-#else // HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE
- struct timespec ts;
-#if defined(HAVE_POSIX_CLOCKS)
- clock_gettime(CLOCK_REALTIME, &ts);
-#else // HAVE_POSIX_CLOCKS
- // we don't support the clocks here.
- struct timeval t;
- gettimeofday(&t, NULL);
- ts.tv_sec = t.tv_sec;
- ts.tv_nsec= t.tv_usec*1000;
-#endif // HAVE_POSIX_CLOCKS
- ts.tv_sec += reltime/1000000000;
- ts.tv_nsec+= reltime%1000000000;
- if (ts.tv_nsec >= 1000000000) {
- ts.tv_nsec -= 1000000000;
- ts.tv_sec += 1;
- }
- return -pthread_cond_timedwait(&mCond, &mutex.mMutex, &ts);
-#endif // HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE
-}
-inline void Condition::signal() {
- pthread_cond_signal(&mCond);
-}
-inline void Condition::broadcast() {
- pthread_cond_broadcast(&mCond);
-}
-
-#endif // HAVE_PTHREADS
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-// ---------------------------------------------------------------------------
-
-#endif // _LIBS_UTILS_CONDITON_H
diff --git a/include/utils/Debug.h b/include/utils/Debug.h
deleted file mode 100644
index d9ed32d..0000000
--- a/include/utils/Debug.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2005 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_DEBUG_H
-#define ANDROID_DEBUG_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-#ifdef __cplusplus
-template<bool> struct CompileTimeAssert;
-template<> struct CompileTimeAssert<true> {};
-#define COMPILE_TIME_ASSERT(_exp) \
- template class CompileTimeAssert< (_exp) >;
-#endif
-#define COMPILE_TIME_ASSERT_FUNCTION_SCOPE(_exp) \
- CompileTimeAssert<( _exp )>();
-
-// ---------------------------------------------------------------------------
-
-#ifdef __cplusplus
-template<bool C, typename LSH, typename RHS> struct CompileTimeIfElse;
-template<typename LHS, typename RHS>
-struct CompileTimeIfElse<true, LHS, RHS> { typedef LHS TYPE; };
-template<typename LHS, typename RHS>
-struct CompileTimeIfElse<false, LHS, RHS> { typedef RHS TYPE; };
-#endif
-
-// ---------------------------------------------------------------------------
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-const char* stringForIndent(int32_t indentLevel);
-
-typedef void (*debugPrintFunc)(void* cookie, const char* txt);
-
-void printTypeCode(uint32_t typeCode,
- debugPrintFunc func = 0, void* cookie = 0);
-
-void printHexData(int32_t indent, const void *buf, size_t length,
- size_t bytesPerLine=16, int32_t singleLineBytesCutoff=16,
- size_t alignment=0, bool cArrayStyle=false,
- debugPrintFunc func = 0, void* cookie = 0);
-
-#ifdef __cplusplus
-}
-#endif
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_DEBUG_H
diff --git a/include/utils/Endian.h b/include/utils/Endian.h
deleted file mode 100644
index 19f2504..0000000
--- a/include/utils/Endian.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2005 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.
- */
-
-//
-// Android endian-ness defines.
-//
-#ifndef _LIBS_UTILS_ENDIAN_H
-#define _LIBS_UTILS_ENDIAN_H
-
-#if defined(HAVE_ENDIAN_H)
-
-#include <endian.h>
-
-#else /*not HAVE_ENDIAN_H*/
-
-#define __BIG_ENDIAN 0x1000
-#define __LITTLE_ENDIAN 0x0001
-
-#if defined(HAVE_LITTLE_ENDIAN)
-# define __BYTE_ORDER __LITTLE_ENDIAN
-#else
-# define __BYTE_ORDER __BIG_ENDIAN
-#endif
-
-#endif /*not HAVE_ENDIAN_H*/
-
-#endif /*_LIBS_UTILS_ENDIAN_H*/
diff --git a/include/utils/Errors.h b/include/utils/Errors.h
deleted file mode 100644
index 0b75b19..0000000
--- a/include/utils/Errors.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2007 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_ERRORS_H
-#define ANDROID_ERRORS_H
-
-#include <sys/types.h>
-#include <errno.h>
-
-namespace android {
-
-// use this type to return error codes
-#ifdef HAVE_MS_C_RUNTIME
-typedef int status_t;
-#else
-typedef int32_t status_t;
-#endif
-
-/* the MS C runtime lacks a few error codes */
-
-/*
- * Error codes.
- * All error codes are negative values.
- */
-
-// Win32 #defines NO_ERROR as well. It has the same value, so there's no
-// real conflict, though it's a bit awkward.
-#ifdef _WIN32
-# undef NO_ERROR
-#endif
-
-enum {
- OK = 0, // Everything's swell.
- NO_ERROR = 0, // No errors.
-
- UNKNOWN_ERROR = 0x80000000,
-
- NO_MEMORY = -ENOMEM,
- INVALID_OPERATION = -ENOSYS,
- BAD_VALUE = -EINVAL,
- BAD_TYPE = 0x80000001,
- NAME_NOT_FOUND = -ENOENT,
- PERMISSION_DENIED = -EPERM,
- NO_INIT = -ENODEV,
- ALREADY_EXISTS = -EEXIST,
- DEAD_OBJECT = -EPIPE,
- FAILED_TRANSACTION = 0x80000002,
- JPARKS_BROKE_IT = -EPIPE,
-#if !defined(HAVE_MS_C_RUNTIME)
- BAD_INDEX = -EOVERFLOW,
- NOT_ENOUGH_DATA = -ENODATA,
- WOULD_BLOCK = -EWOULDBLOCK,
- TIMED_OUT = -ETIMEDOUT,
- UNKNOWN_TRANSACTION = -EBADMSG,
-#else
- BAD_INDEX = -E2BIG,
- NOT_ENOUGH_DATA = 0x80000003,
- WOULD_BLOCK = 0x80000004,
- TIMED_OUT = 0x80000005,
- UNKNOWN_TRANSACTION = 0x80000006,
-#endif
- FDS_NOT_ALLOWED = 0x80000007,
-};
-
-// Restore define; enumeration is in "android" namespace, so the value defined
-// there won't work for Win32 code in a different namespace.
-#ifdef _WIN32
-# define NO_ERROR 0L
-#endif
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_ERRORS_H
diff --git a/include/utils/FileMap.h b/include/utils/FileMap.h
deleted file mode 100644
index dfe6d51..0000000
--- a/include/utils/FileMap.h
+++ /dev/null
@@ -1,136 +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.
- */
-
-//
-// Encapsulate a shared file mapping.
-//
-#ifndef __LIBS_FILE_MAP_H
-#define __LIBS_FILE_MAP_H
-
-#include <sys/types.h>
-
-#include <utils/Compat.h>
-
-#ifdef HAVE_WIN32_FILEMAP
-#include <windows.h>
-#endif
-
-namespace android {
-
-/*
- * This represents a memory-mapped file. It might be the entire file or
- * only part of it. This requires a little bookkeeping because the mapping
- * needs to be aligned on page boundaries, and in some cases we'd like to
- * have multiple references to the mapped area without creating additional
- * maps.
- *
- * This always uses MAP_SHARED.
- *
- * TODO: we should be able to create a new FileMap that is a subset of
- * an existing FileMap and shares the underlying mapped pages. Requires
- * completing the refcounting stuff and possibly introducing the notion
- * of a FileMap hierarchy.
- */
-class FileMap {
-public:
- FileMap(void);
-
- /*
- * Create a new mapping on an open file.
- *
- * Closing the file descriptor does not unmap the pages, so we don't
- * claim ownership of the fd.
- *
- * Returns "false" on failure.
- */
- bool create(const char* origFileName, int fd,
- off64_t offset, size_t length, bool readOnly);
-
- /*
- * Return the name of the file this map came from, if known.
- */
- const char* getFileName(void) const { return mFileName; }
-
- /*
- * Get a pointer to the piece of the file we requested.
- */
- void* getDataPtr(void) const { return mDataPtr; }
-
- /*
- * Get the length we requested.
- */
- size_t getDataLength(void) const { return mDataLength; }
-
- /*
- * Get the data offset used to create this map.
- */
- off64_t getDataOffset(void) const { return mDataOffset; }
-
- /*
- * Get a "copy" of the object.
- */
- FileMap* acquire(void) { mRefCount++; return this; }
-
- /*
- * Call this when mapping is no longer needed.
- */
- void release(void) {
- if (--mRefCount <= 0)
- delete this;
- }
-
- /*
- * This maps directly to madvise() values, but allows us to avoid
- * including <sys/mman.h> everywhere.
- */
- enum MapAdvice {
- NORMAL, RANDOM, SEQUENTIAL, WILLNEED, DONTNEED
- };
-
- /*
- * Apply an madvise() call to the entire file.
- *
- * Returns 0 on success, -1 on failure.
- */
- int advise(MapAdvice advice);
-
-protected:
- // don't delete objects; call release()
- ~FileMap(void);
-
-private:
- // these are not implemented
- FileMap(const FileMap& src);
- const FileMap& operator=(const FileMap& src);
-
- int mRefCount; // reference count
- char* mFileName; // original file name, if known
- void* mBasePtr; // base of mmap area; page aligned
- size_t mBaseLength; // length, measured from "mBasePtr"
- off64_t mDataOffset; // offset used when map was created
- void* mDataPtr; // start of requested data, offset from base
- size_t mDataLength; // length, measured from "mDataPtr"
-#ifdef HAVE_WIN32_FILEMAP
- HANDLE mFileHandle; // Win32 file handle
- HANDLE mFileMapping; // Win32 file mapping handle
-#endif
-
- static long mPageSize;
-};
-
-}; // namespace android
-
-#endif // __LIBS_FILE_MAP_H
diff --git a/include/utils/Flattenable.h b/include/utils/Flattenable.h
deleted file mode 100644
index 852be3b..0000000
--- a/include/utils/Flattenable.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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/Functor.h b/include/utils/Functor.h
deleted file mode 100644
index e24ded4..0000000
--- a/include/utils/Functor.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2011 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_FUNCTOR_H
-#define ANDROID_FUNCTOR_H
-
-#include <utils/Errors.h>
-
-namespace android {
-
-class Functor {
-public:
- Functor() {}
- virtual ~Functor() {}
- virtual status_t operator ()(int what, void* data) { return NO_ERROR; }
-};
-
-}; // namespace android
-
-#endif // ANDROID_FUNCTOR_H
diff --git a/include/utils/GenerationCache.h b/include/utils/GenerationCache.h
deleted file mode 100644
index 40722d1..0000000
--- a/include/utils/GenerationCache.h
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * 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_GENERATION_CACHE_H
-#define ANDROID_UTILS_GENERATION_CACHE_H
-
-#include <utils/KeyedVector.h>
-#include <utils/RefBase.h>
-
-namespace android {
-
-/**
- * GenerationCache callback used when an item is removed
- */
-template<typename EntryKey, typename EntryValue>
-class OnEntryRemoved {
-public:
- virtual ~OnEntryRemoved() { };
- virtual void operator()(EntryKey& key, EntryValue& value) = 0;
-}; // class OnEntryRemoved
-
-template<typename EntryKey, typename EntryValue>
-struct Entry: public LightRefBase<Entry<EntryKey, EntryValue> > {
- Entry(const Entry<EntryKey, EntryValue>& e) :
- key(e.key), value(e.value),
- parent(e.parent), child(e.child) { }
- Entry(const EntryKey& key, const EntryValue& value) :
- key(key), value(value) { }
-
- EntryKey key;
- EntryValue value;
-
- sp<Entry<EntryKey, EntryValue> > parent; // next older entry
- sp<Entry<EntryKey, EntryValue> > child; // next younger entry
-}; // struct Entry
-
-/**
- * A LRU type cache
- */
-template<typename K, typename V>
-class GenerationCache {
-public:
- GenerationCache(uint32_t maxCapacity);
- virtual ~GenerationCache();
-
- enum Capacity {
- kUnlimitedCapacity,
- };
-
- void setOnEntryRemovedListener(OnEntryRemoved<K, V>* listener);
-
- size_t size() const;
-
- void clear();
-
- bool contains(const K& key) const;
- const K& getKeyAt(size_t index) const;
- const V& getValueAt(size_t index) const;
-
- const V& get(const K& key);
- bool put(const K& key, const V& value);
-
- void removeAt(ssize_t index);
- bool remove(const K& key);
- bool removeOldest();
-
-private:
- KeyedVector<K, sp<Entry<K, V> > > mCache;
- uint32_t mMaxCapacity;
-
- OnEntryRemoved<K, V>* mListener;
-
- sp<Entry<K, V> > mOldest;
- sp<Entry<K, V> > mYoungest;
-
- void attachToCache(const sp<Entry<K, V> >& entry);
- void detachFromCache(const sp<Entry<K, V> >& entry);
-
- const V mNullValue;
-}; // class GenerationCache
-
-template<typename K, typename V>
-GenerationCache<K, V>::GenerationCache(uint32_t maxCapacity): mMaxCapacity(maxCapacity),
- mListener(NULL), mNullValue(NULL) {
-};
-
-template<typename K, typename V>
-GenerationCache<K, V>::~GenerationCache() {
- clear();
-};
-
-template<typename K, typename V>
-uint32_t GenerationCache<K, V>::size() const {
- return mCache.size();
-}
-
-/**
- * Should be set by the user of the Cache so that the callback is called whenever an item is
- * removed from the cache
- */
-template<typename K, typename V>
-void GenerationCache<K, V>::setOnEntryRemovedListener(OnEntryRemoved<K, V>* listener) {
- mListener = listener;
-}
-
-template<typename K, typename V>
-void GenerationCache<K, V>::clear() {
- if (mListener) {
- for (uint32_t i = 0; i < mCache.size(); i++) {
- sp<Entry<K, V> > entry = mCache.valueAt(i);
- if (mListener) {
- (*mListener)(entry->key, entry->value);
- }
- }
- }
- mCache.clear();
- mYoungest.clear();
- mOldest.clear();
-}
-
-template<typename K, typename V>
-bool GenerationCache<K, V>::contains(const K& key) const {
- return mCache.indexOfKey(key) >= 0;
-}
-
-template<typename K, typename V>
-const K& GenerationCache<K, V>::getKeyAt(size_t index) const {
- return mCache.keyAt(index);
-}
-
-template<typename K, typename V>
-const V& GenerationCache<K, V>::getValueAt(size_t index) const {
- return mCache.valueAt(index)->value;
-}
-
-template<typename K, typename V>
-const V& GenerationCache<K, V>::get(const K& key) {
- ssize_t index = mCache.indexOfKey(key);
- if (index >= 0) {
- const sp<Entry<K, V> >& entry = mCache.valueAt(index);
- detachFromCache(entry);
- attachToCache(entry);
- return entry->value;
- }
-
- return mNullValue;
-}
-
-template<typename K, typename V>
-bool GenerationCache<K, V>::put(const K& key, const V& value) {
- if (mMaxCapacity != kUnlimitedCapacity && mCache.size() >= mMaxCapacity) {
- removeOldest();
- }
-
- ssize_t index = mCache.indexOfKey(key);
- if (index < 0) {
- sp<Entry<K, V> > entry = new Entry<K, V>(key, value);
- mCache.add(key, entry);
- attachToCache(entry);
- return true;
- }
-
- return false;
-}
-
-template<typename K, typename V>
-bool GenerationCache<K, V>::remove(const K& key) {
- ssize_t index = mCache.indexOfKey(key);
- if (index >= 0) {
- removeAt(index);
- return true;
- }
-
- return false;
-}
-
-template<typename K, typename V>
-void GenerationCache<K, V>::removeAt(ssize_t index) {
- sp<Entry<K, V> > entry = mCache.valueAt(index);
- if (mListener) {
- (*mListener)(entry->key, entry->value);
- }
- mCache.removeItemsAt(index, 1);
- detachFromCache(entry);
-}
-
-template<typename K, typename V>
-bool GenerationCache<K, V>::removeOldest() {
- if (mOldest.get()) {
- ssize_t index = mCache.indexOfKey(mOldest->key);
- if (index >= 0) {
- removeAt(index);
- return true;
- }
- ALOGE("GenerationCache: removeOldest failed to find the item in the cache "
- "with the given key, but we know it must be in there. "
- "Is the key comparator kaput?");
- }
-
- return false;
-}
-
-template<typename K, typename V>
-void GenerationCache<K, V>::attachToCache(const sp<Entry<K, V> >& entry) {
- if (!mYoungest.get()) {
- mYoungest = mOldest = entry;
- } else {
- entry->parent = mYoungest;
- mYoungest->child = entry;
- mYoungest = entry;
- }
-}
-
-template<typename K, typename V>
-void GenerationCache<K, V>::detachFromCache(const sp<Entry<K, V> >& entry) {
- if (entry->parent.get()) {
- entry->parent->child = entry->child;
- } else {
- mOldest = entry->child;
- }
-
- if (entry->child.get()) {
- entry->child->parent = entry->parent;
- } else {
- mYoungest = entry->parent;
- }
-
- entry->parent.clear();
- entry->child.clear();
-}
-
-}; // namespace android
-
-#endif // ANDROID_UTILS_GENERATION_CACHE_H
diff --git a/include/utils/KeyedVector.h b/include/utils/KeyedVector.h
deleted file mode 100644
index 85535bd..0000000
--- a/include/utils/KeyedVector.h
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright (C) 2005 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_KEYED_VECTOR_H
-#define ANDROID_KEYED_VECTOR_H
-
-#include <assert.h>
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/SortedVector.h>
-#include <utils/TypeHelpers.h>
-#include <utils/Errors.h>
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-template <typename KEY, typename VALUE>
-class KeyedVector
-{
-public:
- typedef KEY key_type;
- typedef VALUE value_type;
-
- inline KeyedVector();
-
- /*
- * empty the vector
- */
-
- inline void clear() { mVector.clear(); }
-
- /*!
- * vector stats
- */
-
- //! returns number of items in the vector
- inline size_t size() const { return mVector.size(); }
- //! returns wether or not the vector is empty
- inline bool isEmpty() const { return mVector.isEmpty(); }
- //! returns how many items can be stored without reallocating the backing store
- inline size_t capacity() const { return mVector.capacity(); }
- //! setst the capacity. capacity can never be reduced less than size()
- inline ssize_t setCapacity(size_t size) { return mVector.setCapacity(size); }
-
- /*!
- * accessors
- */
- const VALUE& valueFor(const KEY& key) const;
- const VALUE& valueAt(size_t index) const;
- const KEY& keyAt(size_t index) const;
- ssize_t indexOfKey(const KEY& key) const;
-
- /*!
- * modifying the array
- */
-
- VALUE& editValueFor(const KEY& key);
- VALUE& editValueAt(size_t index);
-
- /*!
- * add/insert/replace items
- */
-
- ssize_t add(const KEY& key, const VALUE& item);
- ssize_t replaceValueFor(const KEY& key, const VALUE& item);
- ssize_t replaceValueAt(size_t index, const VALUE& item);
-
- /*!
- * remove items
- */
-
- ssize_t removeItem(const KEY& key);
- ssize_t removeItemsAt(size_t index, size_t count = 1);
-
-private:
- SortedVector< key_value_pair_t<KEY, VALUE> > mVector;
-};
-
-// ---------------------------------------------------------------------------
-
-/**
- * Variation of KeyedVector that holds a default value to return when
- * valueFor() is called with a key that doesn't exist.
- */
-template <typename KEY, typename VALUE>
-class DefaultKeyedVector : public KeyedVector<KEY, VALUE>
-{
-public:
- inline DefaultKeyedVector(const VALUE& defValue = VALUE());
- const VALUE& valueFor(const KEY& key) const;
-
-private:
- VALUE mDefault;
-};
-
-// ---------------------------------------------------------------------------
-
-template<typename KEY, typename VALUE> inline
-KeyedVector<KEY,VALUE>::KeyedVector()
-{
-}
-
-template<typename KEY, typename VALUE> inline
-ssize_t KeyedVector<KEY,VALUE>::indexOfKey(const KEY& key) const {
- return mVector.indexOf( key_value_pair_t<KEY,VALUE>(key) );
-}
-
-template<typename KEY, typename VALUE> inline
-const VALUE& KeyedVector<KEY,VALUE>::valueFor(const KEY& key) const {
- ssize_t i = this->indexOfKey(key);
- assert(i>=0);
- return mVector.itemAt(i).value;
-}
-
-template<typename KEY, typename VALUE> inline
-const VALUE& KeyedVector<KEY,VALUE>::valueAt(size_t index) const {
- return mVector.itemAt(index).value;
-}
-
-template<typename KEY, typename VALUE> inline
-const KEY& KeyedVector<KEY,VALUE>::keyAt(size_t index) const {
- return mVector.itemAt(index).key;
-}
-
-template<typename KEY, typename VALUE> inline
-VALUE& KeyedVector<KEY,VALUE>::editValueFor(const KEY& key) {
- ssize_t i = this->indexOfKey(key);
- assert(i>=0);
- return mVector.editItemAt(i).value;
-}
-
-template<typename KEY, typename VALUE> inline
-VALUE& KeyedVector<KEY,VALUE>::editValueAt(size_t index) {
- return mVector.editItemAt(index).value;
-}
-
-template<typename KEY, typename VALUE> inline
-ssize_t KeyedVector<KEY,VALUE>::add(const KEY& key, const VALUE& value) {
- return mVector.add( key_value_pair_t<KEY,VALUE>(key, value) );
-}
-
-template<typename KEY, typename VALUE> inline
-ssize_t KeyedVector<KEY,VALUE>::replaceValueFor(const KEY& key, const VALUE& value) {
- key_value_pair_t<KEY,VALUE> pair(key, value);
- mVector.remove(pair);
- return mVector.add(pair);
-}
-
-template<typename KEY, typename VALUE> inline
-ssize_t KeyedVector<KEY,VALUE>::replaceValueAt(size_t index, const VALUE& item) {
- if (index<size()) {
- mVector.editItemAt(index).value = item;
- return index;
- }
- return BAD_INDEX;
-}
-
-template<typename KEY, typename VALUE> inline
-ssize_t KeyedVector<KEY,VALUE>::removeItem(const KEY& key) {
- return mVector.remove(key_value_pair_t<KEY,VALUE>(key));
-}
-
-template<typename KEY, typename VALUE> inline
-ssize_t KeyedVector<KEY, VALUE>::removeItemsAt(size_t index, size_t count) {
- return mVector.removeItemsAt(index, count);
-}
-
-// ---------------------------------------------------------------------------
-
-template<typename KEY, typename VALUE> inline
-DefaultKeyedVector<KEY,VALUE>::DefaultKeyedVector(const VALUE& defValue)
- : mDefault(defValue)
-{
-}
-
-template<typename KEY, typename VALUE> inline
-const VALUE& DefaultKeyedVector<KEY,VALUE>::valueFor(const KEY& key) const {
- ssize_t i = this->indexOfKey(key);
- return i >= 0 ? KeyedVector<KEY,VALUE>::valueAt(i) : mDefault;
-}
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_KEYED_VECTOR_H
diff --git a/include/utils/LinearTransform.h b/include/utils/LinearTransform.h
deleted file mode 100644
index 04cb355..0000000
--- a/include/utils/LinearTransform.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2011 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 _LIBS_UTILS_LINEAR_TRANSFORM_H
-#define _LIBS_UTILS_LINEAR_TRANSFORM_H
-
-#include <stdint.h>
-
-namespace android {
-
-// LinearTransform defines a structure which hold the definition of a
-// transformation from single dimensional coordinate system A into coordinate
-// system B (and back again). Values in A and in B are 64 bit, the linear
-// scale factor is expressed as a rational number using two 32 bit values.
-//
-// Specifically, let
-// f(a) = b
-// F(b) = f^-1(b) = a
-// then
-//
-// f(a) = (((a - a_zero) * a_to_b_numer) / a_to_b_denom) + b_zero;
-//
-// and
-//
-// F(b) = (((b - b_zero) * a_to_b_denom) / a_to_b_numer) + a_zero;
-//
-struct LinearTransform {
- int64_t a_zero;
- int64_t b_zero;
- int32_t a_to_b_numer;
- uint32_t a_to_b_denom;
-
- // Transform from A->B
- // Returns true on success, or false in the case of a singularity or an
- // overflow.
- bool doForwardTransform(int64_t a_in, int64_t* b_out) const;
-
- // Transform from B->A
- // Returns true on success, or false in the case of a singularity or an
- // overflow.
- bool doReverseTransform(int64_t b_in, int64_t* a_out) const;
-
- // Helpers which will reduce the fraction N/D using Euclid's method.
- template <class T> static void reduce(T* N, T* D);
- static void reduce(int32_t* N, uint32_t* D);
-};
-
-
-}
-
-#endif // _LIBS_UTILS_LINEAR_TRANSFORM_H
diff --git a/include/utils/List.h b/include/utils/List.h
deleted file mode 100644
index 403cd7f..0000000
--- a/include/utils/List.h
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * Copyright (C) 2005 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.
- */
-
-//
-// Templated list class. Normally we'd use STL, but we don't have that.
-// This class mimics STL's interfaces.
-//
-// Objects are copied into the list with the '=' operator or with copy-
-// construction, so if the compiler's auto-generated versions won't work for
-// you, define your own.
-//
-// The only class you want to use from here is "List".
-//
-#ifndef _LIBS_UTILS_LIST_H
-#define _LIBS_UTILS_LIST_H
-
-#include <stddef.h>
-#include <stdint.h>
-
-namespace android {
-
-/*
- * Doubly-linked list. Instantiate with "List<MyClass> myList".
- *
- * Objects added to the list are copied using the assignment operator,
- * so this must be defined.
- */
-template<typename T>
-class List
-{
-protected:
- /*
- * One element in the list.
- */
- class _Node {
- public:
- explicit _Node(const T& val) : mVal(val) {}
- ~_Node() {}
- inline T& getRef() { return mVal; }
- inline const T& getRef() const { return mVal; }
- inline _Node* getPrev() const { return mpPrev; }
- inline _Node* getNext() const { return mpNext; }
- inline void setVal(const T& val) { mVal = val; }
- inline void setPrev(_Node* ptr) { mpPrev = ptr; }
- inline void setNext(_Node* ptr) { mpNext = ptr; }
- private:
- friend class List;
- friend class _ListIterator;
- T mVal;
- _Node* mpPrev;
- _Node* mpNext;
- };
-
- /*
- * Iterator for walking through the list.
- */
-
- template <typename TYPE>
- struct CONST_ITERATOR {
- typedef _Node const * NodePtr;
- typedef const TYPE Type;
- };
-
- template <typename TYPE>
- struct NON_CONST_ITERATOR {
- typedef _Node* NodePtr;
- typedef TYPE Type;
- };
-
- template<
- typename U,
- template <class> class Constness
- >
- class _ListIterator {
- typedef _ListIterator<U, Constness> _Iter;
- typedef typename Constness<U>::NodePtr _NodePtr;
- typedef typename Constness<U>::Type _Type;
-
- explicit _ListIterator(_NodePtr ptr) : mpNode(ptr) {}
-
- public:
- _ListIterator() {}
- _ListIterator(const _Iter& rhs) : mpNode(rhs.mpNode) {}
- ~_ListIterator() {}
-
- // this will handle conversions from iterator to const_iterator
- // (and also all convertible iterators)
- // Here, in this implementation, the iterators can be converted
- // if the nodes can be converted
- template<typename V> explicit
- _ListIterator(const V& rhs) : mpNode(rhs.mpNode) {}
-
-
- /*
- * Dereference operator. Used to get at the juicy insides.
- */
- _Type& operator*() const { return mpNode->getRef(); }
- _Type* operator->() const { return &(mpNode->getRef()); }
-
- /*
- * Iterator comparison.
- */
- inline bool operator==(const _Iter& right) const {
- return mpNode == right.mpNode; }
-
- inline bool operator!=(const _Iter& right) const {
- return mpNode != right.mpNode; }
-
- /*
- * handle comparisons between iterator and const_iterator
- */
- template<typename OTHER>
- inline bool operator==(const OTHER& right) const {
- return mpNode == right.mpNode; }
-
- template<typename OTHER>
- inline bool operator!=(const OTHER& right) const {
- return mpNode != right.mpNode; }
-
- /*
- * Incr/decr, used to move through the list.
- */
- inline _Iter& operator++() { // pre-increment
- mpNode = mpNode->getNext();
- return *this;
- }
- const _Iter operator++(int) { // post-increment
- _Iter tmp(*this);
- mpNode = mpNode->getNext();
- return tmp;
- }
- inline _Iter& operator--() { // pre-increment
- mpNode = mpNode->getPrev();
- return *this;
- }
- const _Iter operator--(int) { // post-increment
- _Iter tmp(*this);
- mpNode = mpNode->getPrev();
- return tmp;
- }
-
- inline _NodePtr getNode() const { return mpNode; }
-
- _NodePtr mpNode; /* should be private, but older gcc fails */
- private:
- friend class List;
- };
-
-public:
- List() {
- prep();
- }
- List(const List<T>& src) { // copy-constructor
- prep();
- insert(begin(), src.begin(), src.end());
- }
- virtual ~List() {
- clear();
- delete[] (unsigned char*) mpMiddle;
- }
-
- typedef _ListIterator<T, NON_CONST_ITERATOR> iterator;
- typedef _ListIterator<T, CONST_ITERATOR> const_iterator;
-
- List<T>& operator=(const List<T>& right);
-
- /* returns true if the list is empty */
- inline bool empty() const { return mpMiddle->getNext() == mpMiddle; }
-
- /* return #of elements in list */
- size_t size() const {
- return size_t(distance(begin(), end()));
- }
-
- /*
- * Return the first element or one past the last element. The
- * _Node* we're returning is converted to an "iterator" by a
- * constructor in _ListIterator.
- */
- inline iterator begin() {
- return iterator(mpMiddle->getNext());
- }
- inline const_iterator begin() const {
- return const_iterator(const_cast<_Node const*>(mpMiddle->getNext()));
- }
- inline iterator end() {
- return iterator(mpMiddle);
- }
- inline const_iterator end() const {
- return const_iterator(const_cast<_Node const*>(mpMiddle));
- }
-
- /* add the object to the head or tail of the list */
- void push_front(const T& val) { insert(begin(), val); }
- void push_back(const T& val) { insert(end(), val); }
-
- /* insert before the current node; returns iterator at new node */
- iterator insert(iterator posn, const T& val)
- {
- _Node* newNode = new _Node(val); // alloc & copy-construct
- newNode->setNext(posn.getNode());
- newNode->setPrev(posn.getNode()->getPrev());
- posn.getNode()->getPrev()->setNext(newNode);
- posn.getNode()->setPrev(newNode);
- return iterator(newNode);
- }
-
- /* insert a range of elements before the current node */
- void insert(iterator posn, const_iterator first, const_iterator last) {
- for ( ; first != last; ++first)
- insert(posn, *first);
- }
-
- /* remove one entry; returns iterator at next node */
- iterator erase(iterator posn) {
- _Node* pNext = posn.getNode()->getNext();
- _Node* pPrev = posn.getNode()->getPrev();
- pPrev->setNext(pNext);
- pNext->setPrev(pPrev);
- delete posn.getNode();
- return iterator(pNext);
- }
-
- /* remove a range of elements */
- iterator erase(iterator first, iterator last) {
- while (first != last)
- erase(first++); // don't erase than incr later!
- return iterator(last);
- }
-
- /* remove all contents of the list */
- void clear() {
- _Node* pCurrent = mpMiddle->getNext();
- _Node* pNext;
-
- while (pCurrent != mpMiddle) {
- pNext = pCurrent->getNext();
- delete pCurrent;
- pCurrent = pNext;
- }
- mpMiddle->setPrev(mpMiddle);
- mpMiddle->setNext(mpMiddle);
- }
-
- /*
- * Measure the distance between two iterators. On exist, "first"
- * will be equal to "last". The iterators must refer to the same
- * list.
- *
- * FIXME: This is actually a generic iterator function. It should be a
- * template function at the top-level with specializations for things like
- * vector<>, which can just do pointer math). Here we limit it to
- * _ListIterator of the same type but different constness.
- */
- template<
- typename U,
- template <class> class CL,
- template <class> class CR
- >
- ptrdiff_t distance(
- _ListIterator<U, CL> first, _ListIterator<U, CR> last) const
- {
- ptrdiff_t count = 0;
- while (first != last) {
- ++first;
- ++count;
- }
- return count;
- }
-
-private:
- /*
- * I want a _Node but don't need it to hold valid data. More
- * to the point, I don't want T's constructor to fire, since it
- * might have side-effects or require arguments. So, we do this
- * slightly uncouth storage alloc.
- */
- void prep() {
- mpMiddle = (_Node*) new unsigned char[sizeof(_Node)];
- mpMiddle->setPrev(mpMiddle);
- mpMiddle->setNext(mpMiddle);
- }
-
- /*
- * This node plays the role of "pointer to head" and "pointer to tail".
- * It sits in the middle of a circular list of nodes. The iterator
- * runs around the circle until it encounters this one.
- */
- _Node* mpMiddle;
-};
-
-/*
- * Assignment operator.
- *
- * The simplest way to do this would be to clear out the target list and
- * fill it with the source. However, we can speed things along by
- * re-using existing elements.
- */
-template<class T>
-List<T>& List<T>::operator=(const List<T>& right)
-{
- if (this == &right)
- return *this; // self-assignment
- iterator firstDst = begin();
- iterator lastDst = end();
- const_iterator firstSrc = right.begin();
- const_iterator lastSrc = right.end();
- while (firstSrc != lastSrc && firstDst != lastDst)
- *firstDst++ = *firstSrc++;
- if (firstSrc == lastSrc) // ran out of elements in source?
- erase(firstDst, lastDst); // yes, erase any extras
- else
- insert(lastDst, firstSrc, lastSrc); // copy remaining over
- return *this;
-}
-
-}; // namespace android
-
-#endif // _LIBS_UTILS_LIST_H
diff --git a/include/utils/Log.h b/include/utils/Log.h
deleted file mode 100644
index 3c6cc8b..0000000
--- a/include/utils/Log.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2005 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.
- */
-
-//
-// C/C++ logging functions. See the logging documentation for API details.
-//
-// We'd like these to be available from C code (in case we import some from
-// somewhere), so this has a C interface.
-//
-// The output will be correct when the log file is shared between multiple
-// threads and/or multiple processes so long as the operating system
-// supports O_APPEND. These calls have mutex-protected data structures
-// and so are NOT reentrant. Do not use LOG in a signal handler.
-//
-#ifndef _LIBS_UTILS_LOG_H
-#define _LIBS_UTILS_LOG_H
-
-#include <cutils/log.h>
-
-#endif // _LIBS_UTILS_LOG_H
diff --git a/include/utils/Looper.h b/include/utils/Looper.h
deleted file mode 100644
index 3c2905d..0000000
--- a/include/utils/Looper.h
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
- * 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 UTILS_LOOPER_H
-#define UTILS_LOOPER_H
-
-#include <utils/threads.h>
-#include <utils/RefBase.h>
-#include <utils/KeyedVector.h>
-#include <utils/Timers.h>
-
-#include <android/looper.h>
-
-// When defined, uses epoll_wait() for polling, otherwise uses poll().
-#define LOOPER_USES_EPOLL
-
-// When defined, logs performance statistics for tuning and debugging purposes.
-//#define LOOPER_STATISTICS
-
-#ifdef LOOPER_USES_EPOLL
-#include <sys/epoll.h>
-#else
-#include <sys/poll.h>
-#endif
-
-/*
- * Declare a concrete type for the NDK's looper forward declaration.
- */
-struct ALooper {
-};
-
-namespace android {
-
-/**
- * A message that can be posted to a Looper.
- */
-struct Message {
- Message() : what(0) { }
- Message(int what) : what(what) { }
-
- /* The message type. (interpretation is left up to the handler) */
- int what;
-};
-
-
-/**
- * Interface for a Looper message handler.
- *
- * The Looper holds a strong reference to the message handler whenever it has
- * a message to deliver to it. Make sure to call Looper::removeMessages
- * to remove any pending messages destined for the handler so that the handler
- * can be destroyed.
- */
-class MessageHandler : public virtual RefBase {
-protected:
- virtual ~MessageHandler() { }
-
-public:
- /**
- * Handles a message.
- */
- virtual void handleMessage(const Message& message) = 0;
-};
-
-
-/**
- * A simple proxy that holds a weak reference to a message handler.
- */
-class WeakMessageHandler : public MessageHandler {
-public:
- WeakMessageHandler(const wp<MessageHandler>& handler);
- virtual void handleMessage(const Message& message);
-
-private:
- wp<MessageHandler> mHandler;
-};
-
-
-/**
- * A polling loop that supports monitoring file descriptor events, optionally
- * using callbacks. The implementation uses epoll() internally.
- *
- * A looper can be associated with a thread although there is no requirement that it must be.
- */
-class Looper : public ALooper, public RefBase {
-protected:
- virtual ~Looper();
-
-public:
- /**
- * Creates a looper.
- *
- * If allowNonCallbaks is true, the looper will allow file descriptors to be
- * registered without associated callbacks. This assumes that the caller of
- * pollOnce() is prepared to handle callback-less events itself.
- */
- Looper(bool allowNonCallbacks);
-
- /**
- * Returns whether this looper instance allows the registration of file descriptors
- * using identifiers instead of callbacks.
- */
- bool getAllowNonCallbacks() const;
-
- /**
- * Waits for events to be available, with optional timeout in milliseconds.
- * Invokes callbacks for all file descriptors on which an event occurred.
- *
- * If the timeout is zero, returns immediately without blocking.
- * If the timeout is negative, waits indefinitely until an event appears.
- *
- * Returns ALOOPER_POLL_WAKE if the poll was awoken using wake() before
- * the timeout expired and no callbacks were invoked and no other file
- * descriptors were ready.
- *
- * Returns ALOOPER_POLL_CALLBACK if one or more callbacks were invoked.
- *
- * Returns ALOOPER_POLL_TIMEOUT if there was no data before the given
- * timeout expired.
- *
- * Returns ALOOPER_POLL_ERROR if an error occurred.
- *
- * Returns a value >= 0 containing an identifier if its file descriptor has data
- * and it has no callback function (requiring the caller here to handle it).
- * In this (and only this) case outFd, outEvents and outData will contain the poll
- * events and data associated with the fd, otherwise they will be set to NULL.
- *
- * This method does not return until it has finished invoking the appropriate callbacks
- * for all file descriptors that were signalled.
- */
- int pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outData);
- inline int pollOnce(int timeoutMillis) {
- return pollOnce(timeoutMillis, NULL, NULL, NULL);
- }
-
- /**
- * Like pollOnce(), but performs all pending callbacks until all
- * data has been consumed or a file descriptor is available with no callback.
- * This function will never return ALOOPER_POLL_CALLBACK.
- */
- int pollAll(int timeoutMillis, int* outFd, int* outEvents, void** outData);
- inline int pollAll(int timeoutMillis) {
- return pollAll(timeoutMillis, NULL, NULL, NULL);
- }
-
- /**
- * Wakes the poll asynchronously.
- *
- * This method can be called on any thread.
- * This method returns immediately.
- */
- void wake();
-
- /**
- * Adds a new file descriptor to be polled by the looper.
- * If the same file descriptor was previously added, it is replaced.
- *
- * "fd" is the file descriptor to be added.
- * "ident" is an identifier for this event, which is returned from ALooper_pollOnce().
- * The identifier must be >= 0, or ALOOPER_POLL_CALLBACK if providing a non-NULL callback.
- * "events" are the poll events to wake up on. Typically this is ALOOPER_EVENT_INPUT.
- * "callback" is the function to call when there is an event on the file descriptor.
- * "data" is a private data pointer to supply to the callback.
- *
- * There are two main uses of this function:
- *
- * (1) If "callback" is non-NULL, then this function will be called when there is
- * data on the file descriptor. It should execute any events it has pending,
- * appropriately reading from the file descriptor. The 'ident' is ignored in this case.
- *
- * (2) If "callback" is NULL, the 'ident' will be returned by ALooper_pollOnce
- * when its file descriptor has data available, requiring the caller to take
- * care of processing it.
- *
- * Returns 1 if the file descriptor was added, 0 if the arguments were invalid.
- *
- * This method can be called on any thread.
- * This method may block briefly if it needs to wake the poll.
- */
- int addFd(int fd, int ident, int events, ALooper_callbackFunc callback, void* data);
-
- /**
- * Removes a previously added file descriptor from the looper.
- *
- * When this method returns, it is safe to close the file descriptor since the looper
- * will no longer have a reference to it. However, it is possible for the callback to
- * already be running or for it to run one last time if the file descriptor was already
- * signalled. Calling code is responsible for ensuring that this case is safely handled.
- * For example, if the callback takes care of removing itself during its own execution either
- * by returning 0 or by calling this method, then it can be guaranteed to not be invoked
- * again at any later time unless registered anew.
- *
- * Returns 1 if the file descriptor was removed, 0 if none was previously registered.
- *
- * This method can be called on any thread.
- * This method may block briefly if it needs to wake the poll.
- */
- int removeFd(int fd);
-
- /**
- * Enqueues a message to be processed by the specified handler.
- *
- * The handler must not be null.
- * This method can be called on any thread.
- */
- void sendMessage(const sp<MessageHandler>& handler, const Message& message);
-
- /**
- * Enqueues a message to be processed by the specified handler after all pending messages
- * after the specified delay.
- *
- * The time delay is specified in uptime nanoseconds.
- * The handler must not be null.
- * This method can be called on any thread.
- */
- void sendMessageDelayed(nsecs_t uptimeDelay, const sp<MessageHandler>& handler,
- const Message& message);
-
- /**
- * Enqueues a message to be processed by the specified handler after all pending messages
- * at the specified time.
- *
- * The time is specified in uptime nanoseconds.
- * The handler must not be null.
- * This method can be called on any thread.
- */
- void sendMessageAtTime(nsecs_t uptime, const sp<MessageHandler>& handler,
- const Message& message);
-
- /**
- * Removes all messages for the specified handler from the queue.
- *
- * The handler must not be null.
- * This method can be called on any thread.
- */
- void removeMessages(const sp<MessageHandler>& handler);
-
- /**
- * Removes all messages of a particular type for the specified handler from the queue.
- *
- * The handler must not be null.
- * This method can be called on any thread.
- */
- void removeMessages(const sp<MessageHandler>& handler, int what);
-
- /**
- * Prepares a looper associated with the calling thread, and returns it.
- * If the thread already has a looper, it is returned. Otherwise, a new
- * one is created, associated with the thread, and returned.
- *
- * The opts may be ALOOPER_PREPARE_ALLOW_NON_CALLBACKS or 0.
- */
- static sp<Looper> prepare(int opts);
-
- /**
- * Sets the given looper to be associated with the calling thread.
- * If another looper is already associated with the thread, it is replaced.
- *
- * If "looper" is NULL, removes the currently associated looper.
- */
- static void setForThread(const sp<Looper>& looper);
-
- /**
- * Returns the looper associated with the calling thread, or NULL if
- * there is not one.
- */
- static sp<Looper> getForThread();
-
-private:
- struct Request {
- int fd;
- int ident;
- ALooper_callbackFunc callback;
- void* data;
- };
-
- struct Response {
- int events;
- Request request;
- };
-
- struct MessageEnvelope {
- MessageEnvelope() : uptime(0) { }
-
- MessageEnvelope(nsecs_t uptime, const sp<MessageHandler> handler,
- const Message& message) : uptime(uptime), handler(handler), message(message) {
- }
-
- nsecs_t uptime;
- sp<MessageHandler> handler;
- Message message;
- };
-
- const bool mAllowNonCallbacks; // immutable
-
- int mWakeReadPipeFd; // immutable
- int mWakeWritePipeFd; // immutable
- Mutex mLock;
-
- Vector<MessageEnvelope> mMessageEnvelopes; // guarded by mLock
- bool mSendingMessage; // guarded by mLock
-
-#ifdef LOOPER_USES_EPOLL
- int mEpollFd; // immutable
-
- // Locked list of file descriptor monitoring requests.
- KeyedVector<int, Request> mRequests; // guarded by mLock
-#else
- // The lock guards state used to track whether there is a poll() in progress and whether
- // there are any other threads waiting in wakeAndLock(). The condition variables
- // are used to transfer control among these threads such that all waiters are
- // serviced before a new poll can begin.
- // The wakeAndLock() method increments mWaiters, wakes the poll, blocks on mAwake
- // until mPolling becomes false, then decrements mWaiters again.
- // The poll() method blocks on mResume until mWaiters becomes 0, then sets
- // mPolling to true, blocks until the poll completes, then resets mPolling to false
- // and signals mResume if there are waiters.
- bool mPolling; // guarded by mLock
- uint32_t mWaiters; // guarded by mLock
- Condition mAwake; // guarded by mLock
- Condition mResume; // guarded by mLock
-
- Vector<struct pollfd> mRequestedFds; // must hold mLock and mPolling must be false to modify
- Vector<Request> mRequests; // must hold mLock and mPolling must be false to modify
-
- ssize_t getRequestIndexLocked(int fd);
- void wakeAndLock();
-#endif
-
-#ifdef LOOPER_STATISTICS
- static const int SAMPLED_WAKE_CYCLES_TO_AGGREGATE = 100;
- static const int SAMPLED_POLLS_TO_AGGREGATE = 1000;
-
- nsecs_t mPendingWakeTime;
- int mPendingWakeCount;
-
- int mSampledWakeCycles;
- int mSampledWakeCountSum;
- nsecs_t mSampledWakeLatencySum;
-
- int mSampledPolls;
- int mSampledZeroPollCount;
- int mSampledZeroPollLatencySum;
- int mSampledTimeoutPollCount;
- int mSampledTimeoutPollLatencySum;
-#endif
-
- // This state is only used privately by pollOnce and does not require a lock since
- // it runs on a single thread.
- Vector<Response> mResponses;
- size_t mResponseIndex;
- nsecs_t mNextMessageUptime; // set to LLONG_MAX when none
-
- int pollInner(int timeoutMillis);
- void awoken();
- void pushResponse(int events, const Request& request);
-
- static void initTLSKey();
- static void threadDestructor(void *st);
-};
-
-} // namespace android
-
-#endif // UTILS_LOOPER_H
diff --git a/include/utils/Mutex.h b/include/utils/Mutex.h
deleted file mode 100644
index de6fb39..0000000
--- a/include/utils/Mutex.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (C) 2007 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 _LIBS_UTILS_MUTEX_H
-#define _LIBS_UTILS_MUTEX_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <time.h>
-
-#if defined(HAVE_PTHREADS)
-# include <pthread.h>
-#endif
-
-#include <utils/Errors.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-// ---------------------------------------------------------------------------
-
-class Condition;
-
-/*
- * Simple mutex class. The implementation is system-dependent.
- *
- * The mutex must be unlocked by the thread that locked it. They are not
- * recursive, i.e. the same thread can't lock it multiple times.
- */
-class Mutex {
-public:
- enum {
- PRIVATE = 0,
- SHARED = 1
- };
-
- Mutex();
- Mutex(const char* name);
- Mutex(int type, const char* name = NULL);
- ~Mutex();
-
- // lock or unlock the mutex
- status_t lock();
- void unlock();
-
- // lock if possible; returns 0 on success, error otherwise
- status_t tryLock();
-
- // Manages the mutex automatically. It'll be locked when Autolock is
- // constructed and released when Autolock goes out of scope.
- class Autolock {
- public:
- inline Autolock(Mutex& mutex) : mLock(mutex) { mLock.lock(); }
- inline Autolock(Mutex* mutex) : mLock(*mutex) { mLock.lock(); }
- inline ~Autolock() { mLock.unlock(); }
- private:
- Mutex& mLock;
- };
-
-private:
- friend class Condition;
-
- // A mutex cannot be copied
- Mutex(const Mutex&);
- Mutex& operator = (const Mutex&);
-
-#if defined(HAVE_PTHREADS)
- pthread_mutex_t mMutex;
-#else
- void _init();
- void* mState;
-#endif
-};
-
-// ---------------------------------------------------------------------------
-
-#if defined(HAVE_PTHREADS)
-
-inline Mutex::Mutex() {
- pthread_mutex_init(&mMutex, NULL);
-}
-inline Mutex::Mutex(const char* name) {
- pthread_mutex_init(&mMutex, NULL);
-}
-inline Mutex::Mutex(int type, const char* name) {
- if (type == SHARED) {
- pthread_mutexattr_t attr;
- pthread_mutexattr_init(&attr);
- pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
- pthread_mutex_init(&mMutex, &attr);
- pthread_mutexattr_destroy(&attr);
- } else {
- pthread_mutex_init(&mMutex, NULL);
- }
-}
-inline Mutex::~Mutex() {
- pthread_mutex_destroy(&mMutex);
-}
-inline status_t Mutex::lock() {
- return -pthread_mutex_lock(&mMutex);
-}
-inline void Mutex::unlock() {
- pthread_mutex_unlock(&mMutex);
-}
-inline status_t Mutex::tryLock() {
- return -pthread_mutex_trylock(&mMutex);
-}
-
-#endif // HAVE_PTHREADS
-
-// ---------------------------------------------------------------------------
-
-/*
- * Automatic mutex. Declare one of these at the top of a function.
- * When the function returns, it will go out of scope, and release the
- * mutex.
- */
-
-typedef Mutex::Autolock AutoMutex;
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-// ---------------------------------------------------------------------------
-
-#endif // _LIBS_UTILS_MUTEX_H
diff --git a/include/utils/PropertyMap.h b/include/utils/PropertyMap.h
deleted file mode 100644
index a9e674f..0000000
--- a/include/utils/PropertyMap.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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 _UTILS_PROPERTY_MAP_H
-#define _UTILS_PROPERTY_MAP_H
-
-#include <utils/KeyedVector.h>
-#include <utils/String8.h>
-#include <utils/Errors.h>
-#include <utils/Tokenizer.h>
-
-namespace android {
-
-/*
- * Provides a mechanism for passing around string-based property key / value pairs
- * and loading them from property files.
- *
- * The property files have the following simple structure:
- *
- * # Comment
- * key = value
- *
- * Keys and values are any sequence of printable ASCII characters.
- * The '=' separates the key from the value.
- * The key and value may not contain whitespace.
- *
- * The '\' character is reserved for escape sequences and is not currently supported.
- * The '"" character is reserved for quoting and is not currently supported.
- * Files that contain the '\' or '"' character will fail to parse.
- *
- * The file must not contain duplicate keys.
- *
- * TODO Support escape sequences and quoted values when needed.
- */
-class PropertyMap {
-public:
- /* Creates an empty property map. */
- PropertyMap();
- ~PropertyMap();
-
- /* Clears the property map. */
- void clear();
-
- /* Adds a property.
- * Replaces the property with the same key if it is already present.
- */
- void addProperty(const String8& key, const String8& value);
-
- /* Returns true if the property map contains the specified key. */
- bool hasProperty(const String8& key) const;
-
- /* Gets the value of a property and parses it.
- * Returns true and sets outValue if the key was found and its value was parsed successfully.
- * Otherwise returns false and does not modify outValue. (Also logs a warning.)
- */
- bool tryGetProperty(const String8& key, String8& outValue) const;
- bool tryGetProperty(const String8& key, bool& outValue) const;
- bool tryGetProperty(const String8& key, int32_t& outValue) const;
- bool tryGetProperty(const String8& key, float& outValue) const;
-
- /* Adds all values from the specified property map. */
- void addAll(const PropertyMap* map);
-
- /* Gets the underlying property map. */
- inline const KeyedVector<String8, String8>& getProperties() const { return mProperties; }
-
- /* Loads a property map from a file. */
- static status_t load(const String8& filename, PropertyMap** outMap);
-
-private:
- class Parser {
- PropertyMap* mMap;
- Tokenizer* mTokenizer;
-
- public:
- Parser(PropertyMap* map, Tokenizer* tokenizer);
- ~Parser();
- status_t parse();
-
- private:
- status_t parseType();
- status_t parseKey();
- status_t parseKeyProperty();
- status_t parseModifier(const String8& token, int32_t* outMetaState);
- status_t parseCharacterLiteral(char16_t* outCharacter);
- };
-
- KeyedVector<String8, String8> mProperties;
-};
-
-} // namespace android
-
-#endif // _UTILS_PROPERTY_MAP_H
diff --git a/include/utils/RWLock.h b/include/utils/RWLock.h
deleted file mode 100644
index a5abea2..0000000
--- a/include/utils/RWLock.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (C) 2007 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 _LIBS_UTILS_RWLOCK_H
-#define _LIBS_UTILS_RWLOCK_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#if defined(HAVE_PTHREADS)
-# include <pthread.h>
-#endif
-
-#include <utils/Errors.h>
-#include <utils/ThreadDefs.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-// ---------------------------------------------------------------------------
-
-#if defined(HAVE_PTHREADS)
-
-/*
- * Simple mutex class. The implementation is system-dependent.
- *
- * The mutex must be unlocked by the thread that locked it. They are not
- * recursive, i.e. the same thread can't lock it multiple times.
- */
-class RWLock {
-public:
- enum {
- PRIVATE = 0,
- SHARED = 1
- };
-
- RWLock();
- RWLock(const char* name);
- RWLock(int type, const char* name = NULL);
- ~RWLock();
-
- status_t readLock();
- status_t tryReadLock();
- status_t writeLock();
- status_t tryWriteLock();
- void unlock();
-
- class AutoRLock {
- public:
- inline AutoRLock(RWLock& rwlock) : mLock(rwlock) { mLock.readLock(); }
- inline ~AutoRLock() { mLock.unlock(); }
- private:
- RWLock& mLock;
- };
-
- class AutoWLock {
- public:
- inline AutoWLock(RWLock& rwlock) : mLock(rwlock) { mLock.writeLock(); }
- inline ~AutoWLock() { mLock.unlock(); }
- private:
- RWLock& mLock;
- };
-
-private:
- // A RWLock cannot be copied
- RWLock(const RWLock&);
- RWLock& operator = (const RWLock&);
-
- pthread_rwlock_t mRWLock;
-};
-
-inline RWLock::RWLock() {
- pthread_rwlock_init(&mRWLock, NULL);
-}
-inline RWLock::RWLock(const char* name) {
- pthread_rwlock_init(&mRWLock, NULL);
-}
-inline RWLock::RWLock(int type, const char* name) {
- if (type == SHARED) {
- pthread_rwlockattr_t attr;
- pthread_rwlockattr_init(&attr);
- pthread_rwlockattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
- pthread_rwlock_init(&mRWLock, &attr);
- pthread_rwlockattr_destroy(&attr);
- } else {
- pthread_rwlock_init(&mRWLock, NULL);
- }
-}
-inline RWLock::~RWLock() {
- pthread_rwlock_destroy(&mRWLock);
-}
-inline status_t RWLock::readLock() {
- return -pthread_rwlock_rdlock(&mRWLock);
-}
-inline status_t RWLock::tryReadLock() {
- return -pthread_rwlock_tryrdlock(&mRWLock);
-}
-inline status_t RWLock::writeLock() {
- return -pthread_rwlock_wrlock(&mRWLock);
-}
-inline status_t RWLock::tryWriteLock() {
- return -pthread_rwlock_trywrlock(&mRWLock);
-}
-inline void RWLock::unlock() {
- pthread_rwlock_unlock(&mRWLock);
-}
-
-#endif // HAVE_PTHREADS
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-// ---------------------------------------------------------------------------
-
-#endif // _LIBS_UTILS_RWLOCK_H
diff --git a/include/utils/RefBase.h b/include/utils/RefBase.h
deleted file mode 100644
index c7a9b78..0000000
--- a/include/utils/RefBase.h
+++ /dev/null
@@ -1,528 +0,0 @@
-/*
- * Copyright (C) 2005 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_REF_BASE_H
-#define ANDROID_REF_BASE_H
-
-#include <cutils/atomic.h>
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <utils/StrongPointer.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-
-class TextOutput;
-TextOutput& printWeakPointer(TextOutput& to, const void* val);
-
-// ---------------------------------------------------------------------------
-
-#define COMPARE_WEAK(_op_) \
-inline bool operator _op_ (const sp<T>& o) const { \
- return m_ptr _op_ o.m_ptr; \
-} \
-inline bool operator _op_ (const T* o) const { \
- return m_ptr _op_ o; \
-} \
-template<typename U> \
-inline bool operator _op_ (const sp<U>& o) const { \
- return m_ptr _op_ o.m_ptr; \
-} \
-template<typename U> \
-inline bool operator _op_ (const U* o) const { \
- return m_ptr _op_ o; \
-}
-
-// ---------------------------------------------------------------------------
-class ReferenceMover;
-class ReferenceConverterBase {
-public:
- virtual size_t getReferenceTypeSize() const = 0;
- virtual void* getReferenceBase(void const*) const = 0;
- inline virtual ~ReferenceConverterBase() { }
-};
-
-// ---------------------------------------------------------------------------
-
-class RefBase
-{
-public:
- void incStrong(const void* id) const;
- void decStrong(const void* id) const;
-
- void forceIncStrong(const void* id) const;
-
- //! DEBUGGING ONLY: Get current strong ref count.
- int32_t getStrongCount() const;
-
- class weakref_type
- {
- public:
- RefBase* refBase() const;
-
- void incWeak(const void* id);
- void decWeak(const void* id);
-
- // acquires a strong reference if there is already one.
- bool attemptIncStrong(const void* id);
-
- // acquires a weak reference if there is already one.
- // This is not always safe. see ProcessState.cpp and BpBinder.cpp
- // for proper use.
- bool attemptIncWeak(const void* id);
-
- //! DEBUGGING ONLY: Get current weak ref count.
- int32_t getWeakCount() const;
-
- //! DEBUGGING ONLY: Print references held on object.
- void printRefs() const;
-
- //! DEBUGGING ONLY: Enable tracking for this object.
- // enable -- enable/disable tracking
- // retain -- when tracking is enable, if true, then we save a stack trace
- // for each reference and dereference; when retain == false, we
- // match up references and dereferences and keep only the
- // outstanding ones.
-
- void trackMe(bool enable, bool retain);
- };
-
- weakref_type* createWeak(const void* id) const;
-
- weakref_type* getWeakRefs() const;
-
- //! DEBUGGING ONLY: Print references held on object.
- inline void printRefs() const { getWeakRefs()->printRefs(); }
-
- //! DEBUGGING ONLY: Enable tracking of object.
- inline void trackMe(bool enable, bool retain)
- {
- getWeakRefs()->trackMe(enable, retain);
- }
-
- typedef RefBase basetype;
-
-protected:
- RefBase();
- virtual ~RefBase();
-
- //! Flags for extendObjectLifetime()
- enum {
- OBJECT_LIFETIME_STRONG = 0x0000,
- OBJECT_LIFETIME_WEAK = 0x0001,
- OBJECT_LIFETIME_MASK = 0x0001
- };
-
- void extendObjectLifetime(int32_t mode);
-
- //! Flags for onIncStrongAttempted()
- enum {
- FIRST_INC_STRONG = 0x0001
- };
-
- virtual void onFirstRef();
- virtual void onLastStrongRef(const void* id);
- virtual bool onIncStrongAttempted(uint32_t flags, const void* id);
- virtual void onLastWeakRef(const void* id);
-
-private:
- friend class ReferenceMover;
- static void moveReferences(void* d, void const* s, size_t n,
- const ReferenceConverterBase& caster);
-
-private:
- friend class weakref_type;
- class weakref_impl;
-
- RefBase(const RefBase& o);
- RefBase& operator=(const RefBase& o);
-
- weakref_impl* const mRefs;
-};
-
-// ---------------------------------------------------------------------------
-
-template <class T>
-class LightRefBase
-{
-public:
- inline LightRefBase() : mCount(0) { }
- inline void incStrong(const void* id) const {
- android_atomic_inc(&mCount);
- }
- inline void decStrong(const void* id) const {
- if (android_atomic_dec(&mCount) == 1) {
- delete static_cast<const T*>(this);
- }
- }
- //! DEBUGGING ONLY: Get current strong ref count.
- inline int32_t getStrongCount() const {
- return mCount;
- }
-
- typedef LightRefBase<T> basetype;
-
-protected:
- inline ~LightRefBase() { }
-
-private:
- friend class ReferenceMover;
- inline static void moveReferences(void* d, void const* s, size_t n,
- const ReferenceConverterBase& caster) { }
-
-private:
- mutable volatile int32_t mCount;
-};
-
-// ---------------------------------------------------------------------------
-
-template <typename T>
-class wp
-{
-public:
- typedef typename RefBase::weakref_type weakref_type;
-
- inline wp() : m_ptr(0) { }
-
- wp(T* other);
- wp(const wp<T>& other);
- wp(const sp<T>& other);
- template<typename U> wp(U* other);
- template<typename U> wp(const sp<U>& other);
- template<typename U> wp(const wp<U>& other);
-
- ~wp();
-
- // Assignment
-
- wp& operator = (T* other);
- wp& operator = (const wp<T>& other);
- wp& operator = (const sp<T>& other);
-
- template<typename U> wp& operator = (U* other);
- template<typename U> wp& operator = (const wp<U>& other);
- template<typename U> wp& operator = (const sp<U>& other);
-
- void set_object_and_refs(T* other, weakref_type* refs);
-
- // promotion to sp
-
- sp<T> promote() const;
-
- // Reset
-
- void clear();
-
- // Accessors
-
- inline weakref_type* get_refs() const { return m_refs; }
-
- inline T* unsafe_get() const { return m_ptr; }
-
- // Operators
-
- COMPARE_WEAK(==)
- COMPARE_WEAK(!=)
- COMPARE_WEAK(>)
- COMPARE_WEAK(<)
- COMPARE_WEAK(<=)
- COMPARE_WEAK(>=)
-
- inline bool operator == (const wp<T>& o) const {
- return (m_ptr == o.m_ptr) && (m_refs == o.m_refs);
- }
- template<typename U>
- inline bool operator == (const wp<U>& o) const {
- return m_ptr == o.m_ptr;
- }
-
- inline bool operator > (const wp<T>& o) const {
- return (m_ptr == o.m_ptr) ? (m_refs > o.m_refs) : (m_ptr > o.m_ptr);
- }
- template<typename U>
- inline bool operator > (const wp<U>& o) const {
- return (m_ptr == o.m_ptr) ? (m_refs > o.m_refs) : (m_ptr > o.m_ptr);
- }
-
- inline bool operator < (const wp<T>& o) const {
- return (m_ptr == o.m_ptr) ? (m_refs < o.m_refs) : (m_ptr < o.m_ptr);
- }
- template<typename U>
- inline bool operator < (const wp<U>& o) const {
- return (m_ptr == o.m_ptr) ? (m_refs < o.m_refs) : (m_ptr < o.m_ptr);
- }
- inline bool operator != (const wp<T>& o) const { return m_refs != o.m_refs; }
- template<typename U> inline bool operator != (const wp<U>& o) const { return !operator == (o); }
- inline bool operator <= (const wp<T>& o) const { return !operator > (o); }
- template<typename U> inline bool operator <= (const wp<U>& o) const { return !operator > (o); }
- inline bool operator >= (const wp<T>& o) const { return !operator < (o); }
- template<typename U> inline bool operator >= (const wp<U>& o) const { return !operator < (o); }
-
-private:
- template<typename Y> friend class sp;
- template<typename Y> friend class wp;
-
- T* m_ptr;
- weakref_type* m_refs;
-};
-
-template <typename T>
-TextOutput& operator<<(TextOutput& to, const wp<T>& val);
-
-#undef COMPARE_WEAK
-
-// ---------------------------------------------------------------------------
-// No user serviceable parts below here.
-
-template<typename T>
-wp<T>::wp(T* other)
- : m_ptr(other)
-{
- if (other) m_refs = other->createWeak(this);
-}
-
-template<typename T>
-wp<T>::wp(const wp<T>& other)
- : m_ptr(other.m_ptr), m_refs(other.m_refs)
-{
- if (m_ptr) m_refs->incWeak(this);
-}
-
-template<typename T>
-wp<T>::wp(const sp<T>& other)
- : m_ptr(other.m_ptr)
-{
- if (m_ptr) {
- m_refs = m_ptr->createWeak(this);
- }
-}
-
-template<typename T> template<typename U>
-wp<T>::wp(U* other)
- : m_ptr(other)
-{
- if (other) m_refs = other->createWeak(this);
-}
-
-template<typename T> template<typename U>
-wp<T>::wp(const wp<U>& other)
- : m_ptr(other.m_ptr)
-{
- if (m_ptr) {
- m_refs = other.m_refs;
- m_refs->incWeak(this);
- }
-}
-
-template<typename T> template<typename U>
-wp<T>::wp(const sp<U>& other)
- : m_ptr(other.m_ptr)
-{
- if (m_ptr) {
- m_refs = m_ptr->createWeak(this);
- }
-}
-
-template<typename T>
-wp<T>::~wp()
-{
- if (m_ptr) m_refs->decWeak(this);
-}
-
-template<typename T>
-wp<T>& wp<T>::operator = (T* other)
-{
- weakref_type* newRefs =
- other ? other->createWeak(this) : 0;
- if (m_ptr) m_refs->decWeak(this);
- m_ptr = other;
- m_refs = newRefs;
- return *this;
-}
-
-template<typename T>
-wp<T>& wp<T>::operator = (const wp<T>& other)
-{
- weakref_type* otherRefs(other.m_refs);
- T* otherPtr(other.m_ptr);
- if (otherPtr) otherRefs->incWeak(this);
- if (m_ptr) m_refs->decWeak(this);
- m_ptr = otherPtr;
- m_refs = otherRefs;
- return *this;
-}
-
-template<typename T>
-wp<T>& wp<T>::operator = (const sp<T>& other)
-{
- weakref_type* newRefs =
- other != NULL ? other->createWeak(this) : 0;
- T* otherPtr(other.m_ptr);
- if (m_ptr) m_refs->decWeak(this);
- m_ptr = otherPtr;
- m_refs = newRefs;
- return *this;
-}
-
-template<typename T> template<typename U>
-wp<T>& wp<T>::operator = (U* other)
-{
- weakref_type* newRefs =
- other ? other->createWeak(this) : 0;
- if (m_ptr) m_refs->decWeak(this);
- m_ptr = other;
- m_refs = newRefs;
- return *this;
-}
-
-template<typename T> template<typename U>
-wp<T>& wp<T>::operator = (const wp<U>& other)
-{
- weakref_type* otherRefs(other.m_refs);
- U* otherPtr(other.m_ptr);
- if (otherPtr) otherRefs->incWeak(this);
- if (m_ptr) m_refs->decWeak(this);
- m_ptr = otherPtr;
- m_refs = otherRefs;
- return *this;
-}
-
-template<typename T> template<typename U>
-wp<T>& wp<T>::operator = (const sp<U>& other)
-{
- weakref_type* newRefs =
- other != NULL ? other->createWeak(this) : 0;
- U* otherPtr(other.m_ptr);
- if (m_ptr) m_refs->decWeak(this);
- m_ptr = otherPtr;
- m_refs = newRefs;
- return *this;
-}
-
-template<typename T>
-void wp<T>::set_object_and_refs(T* other, weakref_type* refs)
-{
- if (other) refs->incWeak(this);
- if (m_ptr) m_refs->decWeak(this);
- m_ptr = other;
- m_refs = refs;
-}
-
-template<typename T>
-sp<T> wp<T>::promote() const
-{
- sp<T> result;
- if (m_ptr && m_refs->attemptIncStrong(&result)) {
- result.set_pointer(m_ptr);
- }
- return result;
-}
-
-template<typename T>
-void wp<T>::clear()
-{
- if (m_ptr) {
- m_refs->decWeak(this);
- m_ptr = 0;
- }
-}
-
-template <typename T>
-inline TextOutput& operator<<(TextOutput& to, const wp<T>& val)
-{
- return printWeakPointer(to, val.unsafe_get());
-}
-
-// ---------------------------------------------------------------------------
-
-// this class just serves as a namespace so TYPE::moveReferences can stay
-// private.
-
-class ReferenceMover {
- // StrongReferenceCast and WeakReferenceCast do the impedance matching
- // between the generic (void*) implementation in Refbase and the strongly typed
- // template specializations below.
-
- template <typename TYPE>
- struct StrongReferenceCast : public ReferenceConverterBase {
- virtual size_t getReferenceTypeSize() const { return sizeof( sp<TYPE> ); }
- virtual void* getReferenceBase(void const* p) const {
- sp<TYPE> const* sptr(reinterpret_cast<sp<TYPE> const*>(p));
- return static_cast<typename TYPE::basetype *>(sptr->get());
- }
- };
-
- template <typename TYPE>
- struct WeakReferenceCast : public ReferenceConverterBase {
- virtual size_t getReferenceTypeSize() const { return sizeof( wp<TYPE> ); }
- virtual void* getReferenceBase(void const* p) const {
- wp<TYPE> const* sptr(reinterpret_cast<wp<TYPE> const*>(p));
- return static_cast<typename TYPE::basetype *>(sptr->unsafe_get());
- }
- };
-
-public:
- template<typename TYPE> static inline
- void move_references(sp<TYPE>* d, sp<TYPE> const* s, size_t n) {
- memmove(d, s, n*sizeof(sp<TYPE>));
- StrongReferenceCast<TYPE> caster;
- TYPE::moveReferences(d, s, n, caster);
- }
- template<typename TYPE> static inline
- void move_references(wp<TYPE>* d, wp<TYPE> const* s, size_t n) {
- memmove(d, s, n*sizeof(wp<TYPE>));
- WeakReferenceCast<TYPE> caster;
- TYPE::moveReferences(d, s, n, caster);
- }
-};
-
-// specialization for moving sp<> and wp<> types.
-// these are used by the [Sorted|Keyed]Vector<> implementations
-// sp<> and wp<> need to be handled specially, because they do not
-// have trivial copy operation in the general case (see RefBase.cpp
-// when DEBUG ops are enabled), but can be implemented very
-// efficiently in most cases.
-
-template<typename TYPE> inline
-void move_forward_type(sp<TYPE>* d, sp<TYPE> const* s, size_t n) {
- ReferenceMover::move_references(d, s, n);
-}
-
-template<typename TYPE> inline
-void move_backward_type(sp<TYPE>* d, sp<TYPE> const* s, size_t n) {
- ReferenceMover::move_references(d, s, n);
-}
-
-template<typename TYPE> inline
-void move_forward_type(wp<TYPE>* d, wp<TYPE> const* s, size_t n) {
- ReferenceMover::move_references(d, s, n);
-}
-
-template<typename TYPE> inline
-void move_backward_type(wp<TYPE>* d, wp<TYPE> const* s, size_t n) {
- ReferenceMover::move_references(d, s, n);
-}
-
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_REF_BASE_H
diff --git a/include/utils/SharedBuffer.h b/include/utils/SharedBuffer.h
deleted file mode 100644
index 24508b0..0000000
--- a/include/utils/SharedBuffer.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (C) 2005 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_SHARED_BUFFER_H
-#define ANDROID_SHARED_BUFFER_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-class SharedBuffer
-{
-public:
-
- /* flags to use with release() */
- enum {
- eKeepStorage = 0x00000001
- };
-
- /*! allocate a buffer of size 'size' and acquire() it.
- * call release() to free it.
- */
- static SharedBuffer* alloc(size_t size);
-
- /*! free the memory associated with the SharedBuffer.
- * Fails if there are any users associated with this SharedBuffer.
- * In other words, the buffer must have been release by all its
- * users.
- */
- static ssize_t dealloc(const SharedBuffer* released);
-
- //! get the SharedBuffer from the data pointer
- static inline const SharedBuffer* sharedBuffer(const void* data);
-
- //! access the data for read
- inline const void* data() const;
-
- //! access the data for read/write
- inline void* data();
-
- //! get size of the buffer
- inline size_t size() const;
-
- //! get back a SharedBuffer object from its data
- static inline SharedBuffer* bufferFromData(void* data);
-
- //! get back a SharedBuffer object from its data
- static inline const SharedBuffer* bufferFromData(const void* data);
-
- //! get the size of a SharedBuffer object from its data
- static inline size_t sizeFromData(const void* data);
-
- //! edit the buffer (get a writtable, or non-const, version of it)
- SharedBuffer* edit() const;
-
- //! edit the buffer, resizing if needed
- SharedBuffer* editResize(size_t size) const;
-
- //! like edit() but fails if a copy is required
- SharedBuffer* attemptEdit() const;
-
- //! resize and edit the buffer, loose it's content.
- SharedBuffer* reset(size_t size) const;
-
- //! acquire/release a reference on this buffer
- void acquire() const;
-
- /*! release a reference on this buffer, with the option of not
- * freeing the memory associated with it if it was the last reference
- * returns the previous reference count
- */
- int32_t release(uint32_t flags = 0) const;
-
- //! returns wether or not we're the only owner
- inline bool onlyOwner() const;
-
-
-private:
- inline SharedBuffer() { }
- inline ~SharedBuffer() { }
- inline SharedBuffer(const SharedBuffer&);
-
- // 16 bytes. must be sized to preserve correct alingment.
- mutable int32_t mRefs;
- size_t mSize;
- uint32_t mReserved[2];
-};
-
-// ---------------------------------------------------------------------------
-
-const SharedBuffer* SharedBuffer::sharedBuffer(const void* data) {
- return data ? reinterpret_cast<const SharedBuffer *>(data)-1 : 0;
-}
-
-const void* SharedBuffer::data() const {
- return this + 1;
-}
-
-void* SharedBuffer::data() {
- return this + 1;
-}
-
-size_t SharedBuffer::size() const {
- return mSize;
-}
-
-SharedBuffer* SharedBuffer::bufferFromData(void* data)
-{
- return ((SharedBuffer*)data)-1;
-}
-
-const SharedBuffer* SharedBuffer::bufferFromData(const void* data)
-{
- return ((const SharedBuffer*)data)-1;
-}
-
-size_t SharedBuffer::sizeFromData(const void* data)
-{
- return (((const SharedBuffer*)data)-1)->mSize;
-}
-
-bool SharedBuffer::onlyOwner() const {
- return (mRefs == 1);
-}
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_VECTOR_H
diff --git a/include/utils/Singleton.h b/include/utils/Singleton.h
deleted file mode 100644
index a42ce21..0000000
--- a/include/utils/Singleton.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2007 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_SINGLETON_H
-#define ANDROID_UTILS_SINGLETON_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <utils/threads.h>
-#include <cutils/compiler.h>
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-template <typename TYPE>
-class ANDROID_API Singleton
-{
-public:
- static TYPE& getInstance() {
- Mutex::Autolock _l(sLock);
- TYPE* instance = sInstance;
- if (instance == 0) {
- instance = new TYPE();
- sInstance = instance;
- }
- return *instance;
- }
-
- static bool hasInstance() {
- Mutex::Autolock _l(sLock);
- return sInstance != 0;
- }
-
-protected:
- ~Singleton() { };
- Singleton() { };
-
-private:
- Singleton(const Singleton&);
- Singleton& operator = (const Singleton&);
- static Mutex sLock;
- static TYPE* sInstance;
-};
-
-/*
- * use ANDROID_SINGLETON_STATIC_INSTANCE(TYPE) in your implementation file
- * (eg: <TYPE>.cpp) to create the static instance of Singleton<>'s attributes,
- * and avoid to have a copy of them in each compilation units Singleton<TYPE>
- * is used.
- * NOTE: we use a version of Mutex ctor that takes a parameter, because
- * for some unknown reason using the default ctor doesn't emit the variable!
- */
-
-#define ANDROID_SINGLETON_STATIC_INSTANCE(TYPE) \
- template class Singleton< TYPE >; \
- template<> Mutex Singleton< TYPE >::sLock(Mutex::PRIVATE); \
- template<> TYPE* Singleton< TYPE >::sInstance(0);
-
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_UTILS_SINGLETON_H
-
diff --git a/include/utils/SortedVector.h b/include/utils/SortedVector.h
deleted file mode 100644
index 0e98aeb..0000000
--- a/include/utils/SortedVector.h
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * Copyright (C) 2005 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_SORTED_VECTOR_H
-#define ANDROID_SORTED_VECTOR_H
-
-#include <assert.h>
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Vector.h>
-#include <utils/VectorImpl.h>
-#include <utils/TypeHelpers.h>
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-template <class TYPE>
-class SortedVector : private SortedVectorImpl
-{
- friend class Vector<TYPE>;
-
-public:
- typedef TYPE value_type;
-
- /*!
- * Constructors and destructors
- */
-
- SortedVector();
- SortedVector(const SortedVector<TYPE>& rhs);
- virtual ~SortedVector();
-
- /*! copy operator */
- const SortedVector<TYPE>& operator = (const SortedVector<TYPE>& rhs) const;
- SortedVector<TYPE>& operator = (const SortedVector<TYPE>& rhs);
-
- /*
- * empty the vector
- */
-
- inline void clear() { VectorImpl::clear(); }
-
- /*!
- * vector stats
- */
-
- //! returns number of items in the vector
- inline size_t size() const { return VectorImpl::size(); }
- //! returns wether or not the vector is empty
- inline bool isEmpty() const { return VectorImpl::isEmpty(); }
- //! returns how many items can be stored without reallocating the backing store
- inline size_t capacity() const { return VectorImpl::capacity(); }
- //! setst the capacity. capacity can never be reduced less than size()
- inline ssize_t setCapacity(size_t size) { return VectorImpl::setCapacity(size); }
-
- /*!
- * C-style array access
- */
-
- //! read-only C-style access
- inline const TYPE* array() const;
-
- //! read-write C-style access. BE VERY CAREFUL when modifying the array
- //! you ust keep it sorted! You usually don't use this function.
- TYPE* editArray();
-
- //! finds the index of an item
- ssize_t indexOf(const TYPE& item) const;
-
- //! finds where this item should be inserted
- size_t orderOf(const TYPE& item) const;
-
-
- /*!
- * accessors
- */
-
- //! read-only access to an item at a given index
- inline const TYPE& operator [] (size_t index) const;
- //! alternate name for operator []
- inline const TYPE& itemAt(size_t index) const;
- //! stack-usage of the vector. returns the top of the stack (last element)
- const TYPE& top() const;
- //! same as operator [], but allows to access the vector backward (from the end) with a negative index
- const TYPE& mirrorItemAt(ssize_t index) const;
-
- /*!
- * modifing the array
- */
-
- //! add an item in the right place (and replace the one that is there)
- ssize_t add(const TYPE& item);
-
- //! editItemAt() MUST NOT change the order of this item
- TYPE& editItemAt(size_t index) {
- return *( static_cast<TYPE *>(VectorImpl::editItemLocation(index)) );
- }
-
- //! merges a vector into this one
- ssize_t merge(const Vector<TYPE>& vector);
- ssize_t merge(const SortedVector<TYPE>& vector);
-
- //! removes an item
- ssize_t remove(const TYPE&);
-
- //! remove several items
- inline ssize_t removeItemsAt(size_t index, size_t count = 1);
- //! remove one item
- inline ssize_t removeAt(size_t index) { return removeItemsAt(index); }
-
-protected:
- virtual void do_construct(void* storage, size_t num) const;
- virtual void do_destroy(void* storage, size_t num) const;
- virtual void do_copy(void* dest, const void* from, size_t num) const;
- virtual void do_splat(void* dest, const void* item, size_t num) const;
- virtual void do_move_forward(void* dest, const void* from, size_t num) const;
- virtual void do_move_backward(void* dest, const void* from, size_t num) const;
- virtual int do_compare(const void* lhs, const void* rhs) const;
-};
-
-
-// ---------------------------------------------------------------------------
-// No user serviceable parts from here...
-// ---------------------------------------------------------------------------
-
-template<class TYPE> inline
-SortedVector<TYPE>::SortedVector()
- : SortedVectorImpl(sizeof(TYPE),
- ((traits<TYPE>::has_trivial_ctor ? HAS_TRIVIAL_CTOR : 0)
- |(traits<TYPE>::has_trivial_dtor ? HAS_TRIVIAL_DTOR : 0)
- |(traits<TYPE>::has_trivial_copy ? HAS_TRIVIAL_COPY : 0))
- )
-{
-}
-
-template<class TYPE> inline
-SortedVector<TYPE>::SortedVector(const SortedVector<TYPE>& rhs)
- : SortedVectorImpl(rhs) {
-}
-
-template<class TYPE> inline
-SortedVector<TYPE>::~SortedVector() {
- finish_vector();
-}
-
-template<class TYPE> inline
-SortedVector<TYPE>& SortedVector<TYPE>::operator = (const SortedVector<TYPE>& rhs) {
- SortedVectorImpl::operator = (rhs);
- return *this;
-}
-
-template<class TYPE> inline
-const SortedVector<TYPE>& SortedVector<TYPE>::operator = (const SortedVector<TYPE>& rhs) const {
- SortedVectorImpl::operator = (rhs);
- return *this;
-}
-
-template<class TYPE> inline
-const TYPE* SortedVector<TYPE>::array() const {
- return static_cast<const TYPE *>(arrayImpl());
-}
-
-template<class TYPE> inline
-TYPE* SortedVector<TYPE>::editArray() {
- return static_cast<TYPE *>(editArrayImpl());
-}
-
-
-template<class TYPE> inline
-const TYPE& SortedVector<TYPE>::operator[](size_t index) const {
- assert( index<size() );
- return *(array() + index);
-}
-
-template<class TYPE> inline
-const TYPE& SortedVector<TYPE>::itemAt(size_t index) const {
- return operator[](index);
-}
-
-template<class TYPE> inline
-const TYPE& SortedVector<TYPE>::mirrorItemAt(ssize_t index) const {
- assert( (index>0 ? index : -index)<size() );
- return *(array() + ((index<0) ? (size()-index) : index));
-}
-
-template<class TYPE> inline
-const TYPE& SortedVector<TYPE>::top() const {
- return *(array() + size() - 1);
-}
-
-template<class TYPE> inline
-ssize_t SortedVector<TYPE>::add(const TYPE& item) {
- return SortedVectorImpl::add(&item);
-}
-
-template<class TYPE> inline
-ssize_t SortedVector<TYPE>::indexOf(const TYPE& item) const {
- return SortedVectorImpl::indexOf(&item);
-}
-
-template<class TYPE> inline
-size_t SortedVector<TYPE>::orderOf(const TYPE& item) const {
- return SortedVectorImpl::orderOf(&item);
-}
-
-template<class TYPE> inline
-ssize_t SortedVector<TYPE>::merge(const Vector<TYPE>& vector) {
- return SortedVectorImpl::merge(reinterpret_cast<const VectorImpl&>(vector));
-}
-
-template<class TYPE> inline
-ssize_t SortedVector<TYPE>::merge(const SortedVector<TYPE>& vector) {
- return SortedVectorImpl::merge(reinterpret_cast<const SortedVectorImpl&>(vector));
-}
-
-template<class TYPE> inline
-ssize_t SortedVector<TYPE>::remove(const TYPE& item) {
- return SortedVectorImpl::remove(&item);
-}
-
-template<class TYPE> inline
-ssize_t SortedVector<TYPE>::removeItemsAt(size_t index, size_t count) {
- return VectorImpl::removeItemsAt(index, count);
-}
-
-// ---------------------------------------------------------------------------
-
-template<class TYPE>
-void SortedVector<TYPE>::do_construct(void* storage, size_t num) const {
- construct_type( reinterpret_cast<TYPE*>(storage), num );
-}
-
-template<class TYPE>
-void SortedVector<TYPE>::do_destroy(void* storage, size_t num) const {
- destroy_type( reinterpret_cast<TYPE*>(storage), num );
-}
-
-template<class TYPE>
-void SortedVector<TYPE>::do_copy(void* dest, const void* from, size_t num) const {
- copy_type( reinterpret_cast<TYPE*>(dest), reinterpret_cast<const TYPE*>(from), num );
-}
-
-template<class TYPE>
-void SortedVector<TYPE>::do_splat(void* dest, const void* item, size_t num) const {
- splat_type( reinterpret_cast<TYPE*>(dest), reinterpret_cast<const TYPE*>(item), num );
-}
-
-template<class TYPE>
-void SortedVector<TYPE>::do_move_forward(void* dest, const void* from, size_t num) const {
- move_forward_type( reinterpret_cast<TYPE*>(dest), reinterpret_cast<const TYPE*>(from), num );
-}
-
-template<class TYPE>
-void SortedVector<TYPE>::do_move_backward(void* dest, const void* from, size_t num) const {
- move_backward_type( reinterpret_cast<TYPE*>(dest), reinterpret_cast<const TYPE*>(from), num );
-}
-
-template<class TYPE>
-int SortedVector<TYPE>::do_compare(const void* lhs, const void* rhs) const {
- return compare_type( *reinterpret_cast<const TYPE*>(lhs), *reinterpret_cast<const TYPE*>(rhs) );
-}
-
-}; // namespace android
-
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_SORTED_VECTOR_H
diff --git a/include/utils/StopWatch.h b/include/utils/StopWatch.h
deleted file mode 100644
index 693dd3c..0000000
--- a/include/utils/StopWatch.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2005 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_STOPWATCH_H
-#define ANDROID_STOPWATCH_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Timers.h>
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-class StopWatch
-{
-public:
- StopWatch( const char *name,
- int clock = SYSTEM_TIME_MONOTONIC,
- uint32_t flags = 0);
- ~StopWatch();
-
- const char* name() const;
- nsecs_t lap();
- nsecs_t elapsedTime() const;
-
- void reset();
-
-private:
- const char* mName;
- int mClock;
- uint32_t mFlags;
-
- struct lap_t {
- nsecs_t soFar;
- nsecs_t thisLap;
- };
-
- nsecs_t mStartTime;
- lap_t mLaps[8];
- int mNumLaps;
-};
-
-
-}; // namespace android
-
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_STOPWATCH_H
diff --git a/include/utils/String16.h b/include/utils/String16.h
deleted file mode 100644
index 360f407..0000000
--- a/include/utils/String16.h
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Copyright (C) 2005 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_STRING16_H
-#define ANDROID_STRING16_H
-
-#include <utils/Errors.h>
-#include <utils/SharedBuffer.h>
-#include <utils/Unicode.h>
-
-// ---------------------------------------------------------------------------
-
-extern "C" {
-
-}
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-class String8;
-class TextOutput;
-
-//! This is a string holding UTF-16 characters.
-class String16
-{
-public:
- String16();
- String16(const String16& o);
- String16(const String16& o,
- size_t len,
- size_t begin=0);
- explicit String16(const char16_t* o);
- explicit String16(const char16_t* o, size_t len);
- explicit String16(const String8& o);
- explicit String16(const char* o);
- explicit String16(const char* o, size_t len);
-
- ~String16();
-
- inline const char16_t* string() const;
- inline size_t size() const;
-
- inline const SharedBuffer* sharedBuffer() const;
-
- void setTo(const String16& other);
- status_t setTo(const char16_t* other);
- status_t setTo(const char16_t* other, size_t len);
- status_t setTo(const String16& other,
- size_t len,
- size_t begin=0);
-
- status_t append(const String16& other);
- status_t append(const char16_t* other, size_t len);
-
- inline String16& operator=(const String16& other);
-
- inline String16& operator+=(const String16& other);
- inline String16 operator+(const String16& other) const;
-
- status_t insert(size_t pos, const char16_t* chrs);
- status_t insert(size_t pos,
- const char16_t* chrs, size_t len);
-
- ssize_t findFirst(char16_t c) const;
- ssize_t findLast(char16_t c) const;
-
- bool startsWith(const String16& prefix) const;
- bool startsWith(const char16_t* prefix) const;
-
- status_t makeLower();
-
- status_t replaceAll(char16_t replaceThis,
- char16_t withThis);
-
- status_t remove(size_t len, size_t begin=0);
-
- inline int compare(const String16& other) const;
-
- inline bool operator<(const String16& other) const;
- inline bool operator<=(const String16& other) const;
- inline bool operator==(const String16& other) const;
- inline bool operator!=(const String16& other) const;
- inline bool operator>=(const String16& other) const;
- inline bool operator>(const String16& other) const;
-
- inline bool operator<(const char16_t* other) const;
- inline bool operator<=(const char16_t* other) const;
- inline bool operator==(const char16_t* other) const;
- inline bool operator!=(const char16_t* other) const;
- inline bool operator>=(const char16_t* other) const;
- inline bool operator>(const char16_t* other) const;
-
- inline operator const char16_t*() const;
-
-private:
- const char16_t* mString;
-};
-
-TextOutput& operator<<(TextOutput& to, const String16& val);
-
-// ---------------------------------------------------------------------------
-// No user servicable parts below.
-
-inline int compare_type(const String16& lhs, const String16& rhs)
-{
- return lhs.compare(rhs);
-}
-
-inline int strictly_order_type(const String16& lhs, const String16& rhs)
-{
- return compare_type(lhs, rhs) < 0;
-}
-
-inline const char16_t* String16::string() const
-{
- return mString;
-}
-
-inline size_t String16::size() const
-{
- return SharedBuffer::sizeFromData(mString)/sizeof(char16_t)-1;
-}
-
-inline const SharedBuffer* String16::sharedBuffer() const
-{
- return SharedBuffer::bufferFromData(mString);
-}
-
-inline String16& String16::operator=(const String16& other)
-{
- setTo(other);
- return *this;
-}
-
-inline String16& String16::operator+=(const String16& other)
-{
- append(other);
- return *this;
-}
-
-inline String16 String16::operator+(const String16& other) const
-{
- String16 tmp(*this);
- tmp += other;
- return tmp;
-}
-
-inline int String16::compare(const String16& other) const
-{
- return strzcmp16(mString, size(), other.mString, other.size());
-}
-
-inline bool String16::operator<(const String16& other) const
-{
- return strzcmp16(mString, size(), other.mString, other.size()) < 0;
-}
-
-inline bool String16::operator<=(const String16& other) const
-{
- return strzcmp16(mString, size(), other.mString, other.size()) <= 0;
-}
-
-inline bool String16::operator==(const String16& other) const
-{
- return strzcmp16(mString, size(), other.mString, other.size()) == 0;
-}
-
-inline bool String16::operator!=(const String16& other) const
-{
- return strzcmp16(mString, size(), other.mString, other.size()) != 0;
-}
-
-inline bool String16::operator>=(const String16& other) const
-{
- return strzcmp16(mString, size(), other.mString, other.size()) >= 0;
-}
-
-inline bool String16::operator>(const String16& other) const
-{
- return strzcmp16(mString, size(), other.mString, other.size()) > 0;
-}
-
-inline bool String16::operator<(const char16_t* other) const
-{
- return strcmp16(mString, other) < 0;
-}
-
-inline bool String16::operator<=(const char16_t* other) const
-{
- return strcmp16(mString, other) <= 0;
-}
-
-inline bool String16::operator==(const char16_t* other) const
-{
- return strcmp16(mString, other) == 0;
-}
-
-inline bool String16::operator!=(const char16_t* other) const
-{
- return strcmp16(mString, other) != 0;
-}
-
-inline bool String16::operator>=(const char16_t* other) const
-{
- return strcmp16(mString, other) >= 0;
-}
-
-inline bool String16::operator>(const char16_t* other) const
-{
- return strcmp16(mString, other) > 0;
-}
-
-inline String16::operator const char16_t*() const
-{
- return mString;
-}
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_STRING16_H
diff --git a/include/utils/String8.h b/include/utils/String8.h
deleted file mode 100644
index 4163697..0000000
--- a/include/utils/String8.h
+++ /dev/null
@@ -1,383 +0,0 @@
-/*
- * Copyright (C) 2005 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_STRING8_H
-#define ANDROID_STRING8_H
-
-#include <utils/Errors.h>
-#include <utils/SharedBuffer.h>
-#include <utils/Unicode.h>
-
-#include <string.h> // for strcmp
-#include <stdarg.h>
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-class String16;
-class TextOutput;
-
-//! This is a string holding UTF-8 characters. Does not allow the value more
-// than 0x10FFFF, which is not valid unicode codepoint.
-class String8
-{
-public:
- String8();
- String8(const String8& o);
- explicit String8(const char* o);
- explicit String8(const char* o, size_t numChars);
-
- explicit String8(const String16& o);
- explicit String8(const char16_t* o);
- explicit String8(const char16_t* o, size_t numChars);
- explicit String8(const char32_t* o);
- explicit String8(const char32_t* o, size_t numChars);
- ~String8();
-
- static inline const String8 empty();
-
- static String8 format(const char* fmt, ...) __attribute__((format (printf, 1, 2)));
- static String8 formatV(const char* fmt, va_list args);
-
- inline const char* string() const;
- inline size_t size() const;
- inline size_t length() const;
- inline size_t bytes() const;
- inline bool isEmpty() const;
-
- inline const SharedBuffer* sharedBuffer() const;
-
- void clear();
-
- void setTo(const String8& other);
- status_t setTo(const char* other);
- status_t setTo(const char* other, size_t numChars);
- status_t setTo(const char16_t* other, size_t numChars);
- status_t setTo(const char32_t* other,
- size_t length);
-
- status_t append(const String8& other);
- status_t append(const char* other);
- status_t append(const char* other, size_t numChars);
-
- status_t appendFormat(const char* fmt, ...)
- __attribute__((format (printf, 2, 3)));
- status_t appendFormatV(const char* fmt, va_list args);
-
- // Note that this function takes O(N) time to calculate the value.
- // No cache value is stored.
- size_t getUtf32Length() const;
- int32_t getUtf32At(size_t index,
- size_t *next_index) const;
- void getUtf32(char32_t* dst) const;
-
- inline String8& operator=(const String8& other);
- inline String8& operator=(const char* other);
-
- inline String8& operator+=(const String8& other);
- inline String8 operator+(const String8& other) const;
-
- inline String8& operator+=(const char* other);
- inline String8 operator+(const char* other) const;
-
- inline int compare(const String8& other) const;
-
- inline bool operator<(const String8& other) const;
- inline bool operator<=(const String8& other) const;
- inline bool operator==(const String8& other) const;
- inline bool operator!=(const String8& other) const;
- inline bool operator>=(const String8& other) const;
- inline bool operator>(const String8& other) const;
-
- inline bool operator<(const char* other) const;
- inline bool operator<=(const char* other) const;
- inline bool operator==(const char* other) const;
- inline bool operator!=(const char* other) const;
- inline bool operator>=(const char* other) const;
- inline bool operator>(const char* other) const;
-
- inline operator const char*() const;
-
- char* lockBuffer(size_t size);
- void unlockBuffer();
- status_t unlockBuffer(size_t size);
-
- // return the index of the first byte of other in this at or after
- // start, or -1 if not found
- ssize_t find(const char* other, size_t start = 0) const;
-
- void toLower();
- void toLower(size_t start, size_t numChars);
- void toUpper();
- void toUpper(size_t start, size_t numChars);
-
- /*
- * These methods operate on the string as if it were a path name.
- */
-
- /*
- * Set the filename field to a specific value.
- *
- * Normalizes the filename, removing a trailing '/' if present.
- */
- void setPathName(const char* name);
- void setPathName(const char* name, size_t numChars);
-
- /*
- * Get just the filename component.
- *
- * "/tmp/foo/bar.c" --> "bar.c"
- */
- String8 getPathLeaf(void) const;
-
- /*
- * Remove the last (file name) component, leaving just the directory
- * name.
- *
- * "/tmp/foo/bar.c" --> "/tmp/foo"
- * "/tmp" --> "" // ????? shouldn't this be "/" ???? XXX
- * "bar.c" --> ""
- */
- String8 getPathDir(void) const;
-
- /*
- * Retrieve the front (root dir) component. Optionally also return the
- * remaining components.
- *
- * "/tmp/foo/bar.c" --> "tmp" (remain = "foo/bar.c")
- * "/tmp" --> "tmp" (remain = "")
- * "bar.c" --> "bar.c" (remain = "")
- */
- String8 walkPath(String8* outRemains = NULL) const;
-
- /*
- * Return the filename extension. This is the last '.' and any number
- * of characters that follow it. The '.' is included in case we
- * decide to expand our definition of what constitutes an extension.
- *
- * "/tmp/foo/bar.c" --> ".c"
- * "/tmp" --> ""
- * "/tmp/foo.bar/baz" --> ""
- * "foo.jpeg" --> ".jpeg"
- * "foo." --> ""
- */
- String8 getPathExtension(void) const;
-
- /*
- * Return the path without the extension. Rules for what constitutes
- * an extension are described in the comment for getPathExtension().
- *
- * "/tmp/foo/bar.c" --> "/tmp/foo/bar"
- */
- String8 getBasePath(void) const;
-
- /*
- * Add a component to the pathname. We guarantee that there is
- * exactly one path separator between the old path and the new.
- * If there is no existing name, we just copy the new name in.
- *
- * If leaf is a fully qualified path (i.e. starts with '/', it
- * replaces whatever was there before.
- */
- String8& appendPath(const char* leaf);
- String8& appendPath(const String8& leaf) { return appendPath(leaf.string()); }
-
- /*
- * Like appendPath(), but does not affect this string. Returns a new one instead.
- */
- String8 appendPathCopy(const char* leaf) const
- { String8 p(*this); p.appendPath(leaf); return p; }
- String8 appendPathCopy(const String8& leaf) const { return appendPathCopy(leaf.string()); }
-
- /*
- * Converts all separators in this string to /, the default path separator.
- *
- * If the default OS separator is backslash, this converts all
- * backslashes to slashes, in-place. Otherwise it does nothing.
- * Returns self.
- */
- String8& convertToResPath();
-
-private:
- status_t real_append(const char* other, size_t numChars);
- char* find_extension(void) const;
-
- const char* mString;
-};
-
-TextOutput& operator<<(TextOutput& to, const String16& val);
-
-// ---------------------------------------------------------------------------
-// No user servicable parts below.
-
-inline int compare_type(const String8& lhs, const String8& rhs)
-{
- return lhs.compare(rhs);
-}
-
-inline int strictly_order_type(const String8& lhs, const String8& rhs)
-{
- return compare_type(lhs, rhs) < 0;
-}
-
-inline const String8 String8::empty() {
- return String8();
-}
-
-inline const char* String8::string() const
-{
- return mString;
-}
-
-inline size_t String8::length() const
-{
- return SharedBuffer::sizeFromData(mString)-1;
-}
-
-inline size_t String8::size() const
-{
- return length();
-}
-
-inline bool String8::isEmpty() const
-{
- return length() == 0;
-}
-
-inline size_t String8::bytes() const
-{
- return SharedBuffer::sizeFromData(mString)-1;
-}
-
-inline const SharedBuffer* String8::sharedBuffer() const
-{
- return SharedBuffer::bufferFromData(mString);
-}
-
-inline String8& String8::operator=(const String8& other)
-{
- setTo(other);
- return *this;
-}
-
-inline String8& String8::operator=(const char* other)
-{
- setTo(other);
- return *this;
-}
-
-inline String8& String8::operator+=(const String8& other)
-{
- append(other);
- return *this;
-}
-
-inline String8 String8::operator+(const String8& other) const
-{
- String8 tmp(*this);
- tmp += other;
- return tmp;
-}
-
-inline String8& String8::operator+=(const char* other)
-{
- append(other);
- return *this;
-}
-
-inline String8 String8::operator+(const char* other) const
-{
- String8 tmp(*this);
- tmp += other;
- return tmp;
-}
-
-inline int String8::compare(const String8& other) const
-{
- return strcmp(mString, other.mString);
-}
-
-inline bool String8::operator<(const String8& other) const
-{
- return strcmp(mString, other.mString) < 0;
-}
-
-inline bool String8::operator<=(const String8& other) const
-{
- return strcmp(mString, other.mString) <= 0;
-}
-
-inline bool String8::operator==(const String8& other) const
-{
- return strcmp(mString, other.mString) == 0;
-}
-
-inline bool String8::operator!=(const String8& other) const
-{
- return strcmp(mString, other.mString) != 0;
-}
-
-inline bool String8::operator>=(const String8& other) const
-{
- return strcmp(mString, other.mString) >= 0;
-}
-
-inline bool String8::operator>(const String8& other) const
-{
- return strcmp(mString, other.mString) > 0;
-}
-
-inline bool String8::operator<(const char* other) const
-{
- return strcmp(mString, other) < 0;
-}
-
-inline bool String8::operator<=(const char* other) const
-{
- return strcmp(mString, other) <= 0;
-}
-
-inline bool String8::operator==(const char* other) const
-{
- return strcmp(mString, other) == 0;
-}
-
-inline bool String8::operator!=(const char* other) const
-{
- return strcmp(mString, other) != 0;
-}
-
-inline bool String8::operator>=(const char* other) const
-{
- return strcmp(mString, other) >= 0;
-}
-
-inline bool String8::operator>(const char* other) const
-{
- return strcmp(mString, other) > 0;
-}
-
-inline String8::operator const char*() const
-{
- return mString;
-}
-
-} // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_STRING8_H
diff --git a/include/utils/StringArray.h b/include/utils/StringArray.h
deleted file mode 100644
index c244587..0000000
--- a/include/utils/StringArray.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-//
-// Sortable array of strings. STL-ish, but STL-free.
-//
-#ifndef _LIBS_UTILS_STRING_ARRAY_H
-#define _LIBS_UTILS_STRING_ARRAY_H
-
-#include <stdlib.h>
-#include <string.h>
-
-namespace android {
-
-//
-// An expanding array of strings. Add, get, sort, delete.
-//
-class StringArray {
-public:
- StringArray();
- virtual ~StringArray();
-
- //
- // Add a string. A copy of the string is made.
- //
- bool push_back(const char* str);
-
- //
- // Delete an entry.
- //
- void erase(int idx);
-
- //
- // Sort the array.
- //
- void sort(int (*compare)(const void*, const void*));
-
- //
- // Pass this to the sort routine to do an ascending alphabetical sort.
- //
- static int cmpAscendingAlpha(const void* pstr1, const void* pstr2);
-
- //
- // Get the #of items in the array.
- //
- inline int size(void) const { return mCurrent; }
-
- //
- // Return entry N.
- // [should use operator[] here]
- //
- const char* getEntry(int idx) const {
- return (unsigned(idx) >= unsigned(mCurrent)) ? NULL : mArray[idx];
- }
-
- //
- // Set entry N to specified string.
- // [should use operator[] here]
- //
- void setEntry(int idx, const char* str);
-
-private:
- int mMax;
- int mCurrent;
- char** mArray;
-};
-
-}; // namespace android
-
-#endif // _LIBS_UTILS_STRING_ARRAY_H
diff --git a/include/utils/StrongPointer.h b/include/utils/StrongPointer.h
deleted file mode 100644
index 49fa3a8..0000000
--- a/include/utils/StrongPointer.h
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright (C) 2005 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_STRONG_POINTER_H
-#define ANDROID_STRONG_POINTER_H
-
-#include <cutils/atomic.h>
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <stdlib.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-
-class TextOutput;
-TextOutput& printStrongPointer(TextOutput& to, const void* val);
-
-template<typename T> class wp;
-
-// ---------------------------------------------------------------------------
-
-#define COMPARE(_op_) \
-inline bool operator _op_ (const sp<T>& o) const { \
- return m_ptr _op_ o.m_ptr; \
-} \
-inline bool operator _op_ (const T* o) const { \
- return m_ptr _op_ o; \
-} \
-template<typename U> \
-inline bool operator _op_ (const sp<U>& o) const { \
- return m_ptr _op_ o.m_ptr; \
-} \
-template<typename U> \
-inline bool operator _op_ (const U* o) const { \
- return m_ptr _op_ o; \
-} \
-inline bool operator _op_ (const wp<T>& o) const { \
- return m_ptr _op_ o.m_ptr; \
-} \
-template<typename U> \
-inline bool operator _op_ (const wp<U>& o) const { \
- return m_ptr _op_ o.m_ptr; \
-}
-
-// ---------------------------------------------------------------------------
-
-template <typename T>
-class sp
-{
-public:
- inline sp() : m_ptr(0) { }
-
- sp(T* other);
- sp(const sp<T>& other);
- template<typename U> sp(U* other);
- template<typename U> sp(const sp<U>& other);
-
- ~sp();
-
- // Assignment
-
- sp& operator = (T* other);
- sp& operator = (const sp<T>& other);
-
- template<typename U> sp& operator = (const sp<U>& other);
- template<typename U> sp& operator = (U* other);
-
- //! Special optimization for use by ProcessState (and nobody else).
- void force_set(T* other);
-
- // Reset
-
- void clear();
-
- // Accessors
-
- inline T& operator* () const { return *m_ptr; }
- inline T* operator-> () const { return m_ptr; }
- inline T* get() const { return m_ptr; }
-
- // Operators
-
- COMPARE(==)
- COMPARE(!=)
- COMPARE(>)
- COMPARE(<)
- COMPARE(<=)
- COMPARE(>=)
-
-private:
- template<typename Y> friend class sp;
- template<typename Y> friend class wp;
- void set_pointer(T* ptr);
- T* m_ptr;
-};
-
-#undef COMPARE
-
-template <typename T>
-TextOutput& operator<<(TextOutput& to, const sp<T>& val);
-
-// ---------------------------------------------------------------------------
-// No user serviceable parts below here.
-
-template<typename T>
-sp<T>::sp(T* other)
-: m_ptr(other)
- {
- if (other) other->incStrong(this);
- }
-
-template<typename T>
-sp<T>::sp(const sp<T>& other)
-: m_ptr(other.m_ptr)
- {
- if (m_ptr) m_ptr->incStrong(this);
- }
-
-template<typename T> template<typename U>
-sp<T>::sp(U* other) : m_ptr(other)
-{
- if (other) ((T*)other)->incStrong(this);
-}
-
-template<typename T> template<typename U>
-sp<T>::sp(const sp<U>& other)
-: m_ptr(other.m_ptr)
- {
- if (m_ptr) m_ptr->incStrong(this);
- }
-
-template<typename T>
-sp<T>::~sp()
-{
- if (m_ptr) m_ptr->decStrong(this);
-}
-
-template<typename T>
-sp<T>& sp<T>::operator = (const sp<T>& other) {
- T* otherPtr(other.m_ptr);
- if (otherPtr) otherPtr->incStrong(this);
- if (m_ptr) m_ptr->decStrong(this);
- m_ptr = otherPtr;
- return *this;
-}
-
-template<typename T>
-sp<T>& sp<T>::operator = (T* other)
-{
- if (other) other->incStrong(this);
- if (m_ptr) m_ptr->decStrong(this);
- m_ptr = other;
- return *this;
-}
-
-template<typename T> template<typename U>
-sp<T>& sp<T>::operator = (const sp<U>& other)
-{
- T* otherPtr(other.m_ptr);
- if (otherPtr) otherPtr->incStrong(this);
- if (m_ptr) m_ptr->decStrong(this);
- m_ptr = otherPtr;
- return *this;
-}
-
-template<typename T> template<typename U>
-sp<T>& sp<T>::operator = (U* other)
-{
- if (other) ((T*)other)->incStrong(this);
- if (m_ptr) m_ptr->decStrong(this);
- m_ptr = other;
- return *this;
-}
-
-template<typename T>
-void sp<T>::force_set(T* other)
-{
- other->forceIncStrong(this);
- m_ptr = other;
-}
-
-template<typename T>
-void sp<T>::clear()
-{
- if (m_ptr) {
- m_ptr->decStrong(this);
- m_ptr = 0;
- }
-}
-
-template<typename T>
-void sp<T>::set_pointer(T* ptr) {
- m_ptr = ptr;
-}
-
-template <typename T>
-inline TextOutput& operator<<(TextOutput& to, const sp<T>& val)
-{
- return printStrongPointer(to, val.get());
-}
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_STRONG_POINTER_H
diff --git a/include/utils/SystemClock.h b/include/utils/SystemClock.h
deleted file mode 100644
index 7c319be..0000000
--- a/include/utils/SystemClock.h
+++ /dev/null
@@ -1,32 +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_UTILS_SYSTEMCLOCK_H
-#define ANDROID_UTILS_SYSTEMCLOCK_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-namespace android {
-
-int setCurrentTimeMillis(int64_t millis);
-int64_t uptimeMillis();
-int64_t elapsedRealtime();
-
-}; // namespace android
-
-#endif // ANDROID_UTILS_SYSTEMCLOCK_H
-
diff --git a/include/utils/TextOutput.h b/include/utils/TextOutput.h
deleted file mode 100644
index de2fbbe..0000000
--- a/include/utils/TextOutput.h
+++ /dev/null
@@ -1,190 +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_TEXTOUTPUT_H
-#define ANDROID_TEXTOUTPUT_H
-
-#include <utils/Errors.h>
-
-#include <stdint.h>
-#include <string.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-
-class TextOutput
-{
-public:
- TextOutput();
- virtual ~TextOutput();
-
- virtual status_t print(const char* txt, size_t len) = 0;
- virtual void moveIndent(int delta) = 0;
-
- class Bundle {
- public:
- inline Bundle(TextOutput& to) : mTO(to) { to.pushBundle(); }
- inline ~Bundle() { mTO.popBundle(); }
- private:
- TextOutput& mTO;
- };
-
- virtual void pushBundle() = 0;
- virtual void popBundle() = 0;
-};
-
-// ---------------------------------------------------------------------------
-
-// Text output stream for printing to the log (via utils/Log.h).
-extern TextOutput& alog;
-
-// Text output stream for printing to stdout.
-extern TextOutput& aout;
-
-// Text output stream for printing to stderr.
-extern TextOutput& aerr;
-
-typedef TextOutput& (*TextOutputManipFunc)(TextOutput&);
-
-TextOutput& endl(TextOutput& to);
-TextOutput& indent(TextOutput& to);
-TextOutput& dedent(TextOutput& to);
-
-TextOutput& operator<<(TextOutput& to, const char* str);
-TextOutput& operator<<(TextOutput& to, char); // writes raw character
-TextOutput& operator<<(TextOutput& to, bool);
-TextOutput& operator<<(TextOutput& to, int);
-TextOutput& operator<<(TextOutput& to, long);
-TextOutput& operator<<(TextOutput& to, unsigned int);
-TextOutput& operator<<(TextOutput& to, unsigned long);
-TextOutput& operator<<(TextOutput& to, long long);
-TextOutput& operator<<(TextOutput& to, unsigned long long);
-TextOutput& operator<<(TextOutput& to, float);
-TextOutput& operator<<(TextOutput& to, double);
-TextOutput& operator<<(TextOutput& to, TextOutputManipFunc func);
-TextOutput& operator<<(TextOutput& to, const void*);
-
-class TypeCode
-{
-public:
- inline TypeCode(uint32_t code);
- inline ~TypeCode();
-
- inline uint32_t typeCode() const;
-
-private:
- uint32_t mCode;
-};
-
-TextOutput& operator<<(TextOutput& to, const TypeCode& val);
-
-class HexDump
-{
-public:
- HexDump(const void *buf, size_t size, size_t bytesPerLine=16);
- inline ~HexDump();
-
- inline HexDump& setBytesPerLine(size_t bytesPerLine);
- inline HexDump& setSingleLineCutoff(int32_t bytes);
- inline HexDump& setAlignment(size_t alignment);
- inline HexDump& setCArrayStyle(bool enabled);
-
- inline const void* buffer() const;
- inline size_t size() const;
- inline size_t bytesPerLine() const;
- inline int32_t singleLineCutoff() const;
- inline size_t alignment() const;
- inline bool carrayStyle() const;
-
-private:
- const void* mBuffer;
- size_t mSize;
- size_t mBytesPerLine;
- int32_t mSingleLineCutoff;
- size_t mAlignment;
- bool mCArrayStyle;
-};
-
-TextOutput& operator<<(TextOutput& to, const HexDump& val);
-
-// ---------------------------------------------------------------------------
-// No user servicable parts below.
-
-inline TextOutput& endl(TextOutput& to)
-{
- to.print("\n", 1);
- return to;
-}
-
-inline TextOutput& indent(TextOutput& to)
-{
- to.moveIndent(1);
- return to;
-}
-
-inline TextOutput& dedent(TextOutput& to)
-{
- to.moveIndent(-1);
- return to;
-}
-
-inline TextOutput& operator<<(TextOutput& to, const char* str)
-{
- to.print(str, strlen(str));
- return to;
-}
-
-inline TextOutput& operator<<(TextOutput& to, char c)
-{
- to.print(&c, 1);
- return to;
-}
-
-inline TextOutput& operator<<(TextOutput& to, TextOutputManipFunc func)
-{
- return (*func)(to);
-}
-
-inline TypeCode::TypeCode(uint32_t code) : mCode(code) { }
-inline TypeCode::~TypeCode() { }
-inline uint32_t TypeCode::typeCode() const { return mCode; }
-
-inline HexDump::~HexDump() { }
-
-inline HexDump& HexDump::setBytesPerLine(size_t bytesPerLine) {
- mBytesPerLine = bytesPerLine; return *this;
-}
-inline HexDump& HexDump::setSingleLineCutoff(int32_t bytes) {
- mSingleLineCutoff = bytes; return *this;
-}
-inline HexDump& HexDump::setAlignment(size_t alignment) {
- mAlignment = alignment; return *this;
-}
-inline HexDump& HexDump::setCArrayStyle(bool enabled) {
- mCArrayStyle = enabled; return *this;
-}
-
-inline const void* HexDump::buffer() const { return mBuffer; }
-inline size_t HexDump::size() const { return mSize; }
-inline size_t HexDump::bytesPerLine() const { return mBytesPerLine; }
-inline int32_t HexDump::singleLineCutoff() const { return mSingleLineCutoff; }
-inline size_t HexDump::alignment() const { return mAlignment; }
-inline bool HexDump::carrayStyle() const { return mCArrayStyle; }
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_TEXTOUTPUT_H
diff --git a/include/utils/Thread.h b/include/utils/Thread.h
deleted file mode 100644
index 4a34abd..0000000
--- a/include/utils/Thread.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2007 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 _LIBS_UTILS_THREAD_H
-#define _LIBS_UTILS_THREAD_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <time.h>
-
-#if defined(HAVE_PTHREADS)
-# include <pthread.h>
-#endif
-
-#include <utils/Condition.h>
-#include <utils/Errors.h>
-#include <utils/Mutex.h>
-#include <utils/RefBase.h>
-#include <utils/Timers.h>
-#include <utils/ThreadDefs.h>
-
-// ---------------------------------------------------------------------------
-namespace android {
-// ---------------------------------------------------------------------------
-
-class Thread : virtual public RefBase
-{
-public:
- // Create a Thread object, but doesn't create or start the associated
- // thread. See the run() method.
- Thread(bool canCallJava = true);
- virtual ~Thread();
-
- // Start the thread in threadLoop() which needs to be implemented.
- virtual status_t run( const char* name = 0,
- int32_t priority = PRIORITY_DEFAULT,
- size_t stack = 0);
-
- // Ask this object's thread to exit. This function is asynchronous, when the
- // function returns the thread might still be running. Of course, this
- // function can be called from a different thread.
- virtual void requestExit();
-
- // Good place to do one-time initializations
- virtual status_t readyToRun();
-
- // Call requestExit() and wait until this object's thread exits.
- // BE VERY CAREFUL of deadlocks. In particular, it would be silly to call
- // this function from this object's thread. Will return WOULD_BLOCK in
- // that case.
- status_t requestExitAndWait();
-
- // Wait until this object's thread exits. Returns immediately if not yet running.
- // Do not call from this object's thread; will return WOULD_BLOCK in that case.
- status_t join();
-
-#ifdef HAVE_ANDROID_OS
- // Return the thread's kernel ID, same as the thread itself calling gettid() or
- // androidGetTid(), or -1 if the thread is not running.
- pid_t getTid() const;
-#endif
-
-protected:
- // exitPending() returns true if requestExit() has been called.
- bool exitPending() const;
-
-private:
- // Derived class must implement threadLoop(). The thread starts its life
- // here. There are two ways of using the Thread object:
- // 1) loop: if threadLoop() returns true, it will be called again if
- // requestExit() wasn't called.
- // 2) once: if threadLoop() returns false, the thread will exit upon return.
- virtual bool threadLoop() = 0;
-
-private:
- Thread& operator=(const Thread&);
- static int _threadLoop(void* user);
- const bool mCanCallJava;
- // always hold mLock when reading or writing
- thread_id_t mThread;
- mutable Mutex mLock;
- Condition mThreadExitedCondition;
- status_t mStatus;
- // note that all accesses of mExitPending and mRunning need to hold mLock
- volatile bool mExitPending;
- volatile bool mRunning;
- sp<Thread> mHoldSelf;
-#ifdef HAVE_ANDROID_OS
- // legacy for debugging, not used by getTid() as it is set by the child thread
- // and so is not initialized until the child reaches that point
- pid_t mTid;
-#endif
-};
-
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-#endif // _LIBS_UTILS_THREAD_H
-// ---------------------------------------------------------------------------
diff --git a/include/utils/ThreadDefs.h b/include/utils/ThreadDefs.h
deleted file mode 100644
index 3e56373..0000000
--- a/include/utils/ThreadDefs.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2007 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 _LIBS_UTILS_THREAD_DEFS_H
-#define _LIBS_UTILS_THREAD_DEFS_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <system/graphics.h>
-
-// ---------------------------------------------------------------------------
-// C API
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void* android_thread_id_t;
-
-typedef int (*android_thread_func_t)(void*);
-
-enum {
- /*
- * ***********************************************
- * ** Keep in sync with android.os.Process.java **
- * ***********************************************
- *
- * This maps directly to the "nice" priorities we use in Android.
- * A thread priority should be chosen inverse-proportionally to
- * the amount of work the thread is expected to do. The more work
- * a thread will do, the less favorable priority it should get so that
- * it doesn't starve the system. Threads not behaving properly might
- * be "punished" by the kernel.
- * Use the levels below when appropriate. Intermediate values are
- * acceptable, preferably use the {MORE|LESS}_FAVORABLE constants below.
- */
- ANDROID_PRIORITY_LOWEST = 19,
-
- /* use for background tasks */
- ANDROID_PRIORITY_BACKGROUND = 10,
-
- /* most threads run at normal priority */
- ANDROID_PRIORITY_NORMAL = 0,
-
- /* threads currently running a UI that the user is interacting with */
- ANDROID_PRIORITY_FOREGROUND = -2,
-
- /* the main UI thread has a slightly more favorable priority */
- ANDROID_PRIORITY_DISPLAY = -4,
-
- /* ui service treads might want to run at a urgent display (uncommon) */
- ANDROID_PRIORITY_URGENT_DISPLAY = HAL_PRIORITY_URGENT_DISPLAY,
-
- /* all normal audio threads */
- ANDROID_PRIORITY_AUDIO = -16,
-
- /* service audio threads (uncommon) */
- ANDROID_PRIORITY_URGENT_AUDIO = -19,
-
- /* should never be used in practice. regular process might not
- * be allowed to use this level */
- ANDROID_PRIORITY_HIGHEST = -20,
-
- ANDROID_PRIORITY_DEFAULT = ANDROID_PRIORITY_NORMAL,
- ANDROID_PRIORITY_MORE_FAVORABLE = -1,
- ANDROID_PRIORITY_LESS_FAVORABLE = +1,
-};
-
-enum {
- ANDROID_TGROUP_DEFAULT = 0,
- ANDROID_TGROUP_BG_NONINTERACT = 1,
- ANDROID_TGROUP_FG_BOOST = 2,
- ANDROID_TGROUP_MAX = ANDROID_TGROUP_FG_BOOST,
-};
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-// ---------------------------------------------------------------------------
-// C++ API
-#ifdef __cplusplus
-namespace android {
-// ---------------------------------------------------------------------------
-
-typedef android_thread_id_t thread_id_t;
-typedef android_thread_func_t thread_func_t;
-
-enum {
- PRIORITY_LOWEST = ANDROID_PRIORITY_LOWEST,
- PRIORITY_BACKGROUND = ANDROID_PRIORITY_BACKGROUND,
- PRIORITY_NORMAL = ANDROID_PRIORITY_NORMAL,
- PRIORITY_FOREGROUND = ANDROID_PRIORITY_FOREGROUND,
- PRIORITY_DISPLAY = ANDROID_PRIORITY_DISPLAY,
- PRIORITY_URGENT_DISPLAY = ANDROID_PRIORITY_URGENT_DISPLAY,
- PRIORITY_AUDIO = ANDROID_PRIORITY_AUDIO,
- PRIORITY_URGENT_AUDIO = ANDROID_PRIORITY_URGENT_AUDIO,
- PRIORITY_HIGHEST = ANDROID_PRIORITY_HIGHEST,
- PRIORITY_DEFAULT = ANDROID_PRIORITY_DEFAULT,
- PRIORITY_MORE_FAVORABLE = ANDROID_PRIORITY_MORE_FAVORABLE,
- PRIORITY_LESS_FAVORABLE = ANDROID_PRIORITY_LESS_FAVORABLE,
-};
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-#endif // __cplusplus
-// ---------------------------------------------------------------------------
-
-
-#endif // _LIBS_UTILS_THREAD_DEFS_H
diff --git a/include/utils/Timers.h b/include/utils/Timers.h
deleted file mode 100644
index 8b4d322..0000000
--- a/include/utils/Timers.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (C) 2005 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.
- */
-
-//
-// Timer functions.
-//
-#ifndef _LIBS_UTILS_TIMERS_H
-#define _LIBS_UTILS_TIMERS_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <sys/time.h>
-
-// ------------------------------------------------------------------
-// C API
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef int64_t nsecs_t; // nano-seconds
-
-static inline nsecs_t seconds_to_nanoseconds(nsecs_t secs)
-{
- return secs*1000000000;
-}
-
-static inline nsecs_t milliseconds_to_nanoseconds(nsecs_t secs)
-{
- return secs*1000000;
-}
-
-static inline nsecs_t microseconds_to_nanoseconds(nsecs_t secs)
-{
- return secs*1000;
-}
-
-static inline nsecs_t nanoseconds_to_seconds(nsecs_t secs)
-{
- return secs/1000000000;
-}
-
-static inline nsecs_t nanoseconds_to_milliseconds(nsecs_t secs)
-{
- return secs/1000000;
-}
-
-static inline nsecs_t nanoseconds_to_microseconds(nsecs_t secs)
-{
- return secs/1000;
-}
-
-static inline nsecs_t s2ns(nsecs_t v) {return seconds_to_nanoseconds(v);}
-static inline nsecs_t ms2ns(nsecs_t v) {return milliseconds_to_nanoseconds(v);}
-static inline nsecs_t us2ns(nsecs_t v) {return microseconds_to_nanoseconds(v);}
-static inline nsecs_t ns2s(nsecs_t v) {return nanoseconds_to_seconds(v);}
-static inline nsecs_t ns2ms(nsecs_t v) {return nanoseconds_to_milliseconds(v);}
-static inline nsecs_t ns2us(nsecs_t v) {return nanoseconds_to_microseconds(v);}
-
-static inline nsecs_t seconds(nsecs_t v) { return s2ns(v); }
-static inline nsecs_t milliseconds(nsecs_t v) { return ms2ns(v); }
-static inline nsecs_t microseconds(nsecs_t v) { return us2ns(v); }
-
-enum {
- SYSTEM_TIME_REALTIME = 0, // system-wide realtime clock
- SYSTEM_TIME_MONOTONIC = 1, // monotonic time since unspecified starting point
- SYSTEM_TIME_PROCESS = 2, // high-resolution per-process clock
- SYSTEM_TIME_THREAD = 3 // high-resolution per-thread clock
-};
-
-// return the system-time according to the specified clock
-#ifdef __cplusplus
-nsecs_t systemTime(int clock = SYSTEM_TIME_MONOTONIC);
-#else
-nsecs_t systemTime(int clock);
-#endif // def __cplusplus
-
-/**
- * Returns the number of milliseconds to wait between the reference time and the timeout time.
- * If the timeout is in the past relative to the reference time, returns 0.
- * If the timeout is more than INT_MAX milliseconds in the future relative to the reference time,
- * such as when timeoutTime == LLONG_MAX, returns -1 to indicate an infinite timeout delay.
- * Otherwise, returns the difference between the reference time and timeout time
- * rounded up to the next millisecond.
- */
-int toMillisecondTimeoutDelay(nsecs_t referenceTime, nsecs_t timeoutTime);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-// ------------------------------------------------------------------
-// C++ API
-
-#ifdef __cplusplus
-
-namespace android {
-/*
- * Time the duration of something.
- *
- * Includes some timeval manipulation functions.
- */
-class DurationTimer {
-public:
- DurationTimer() {}
- ~DurationTimer() {}
-
- // Start the timer.
- void start();
- // Stop the timer.
- void stop();
- // Get the duration in microseconds.
- long long durationUsecs() const;
-
- // Subtract two timevals. Returns the difference (ptv1-ptv2) in
- // microseconds.
- static long long subtractTimevals(const struct timeval* ptv1,
- const struct timeval* ptv2);
-
- // Add the specified amount of time to the timeval.
- static void addToTimeval(struct timeval* ptv, long usec);
-
-private:
- struct timeval mStartWhen;
- struct timeval mStopWhen;
-};
-
-}; // android
-#endif // def __cplusplus
-
-#endif // _LIBS_UTILS_TIMERS_H
diff --git a/include/utils/Tokenizer.h b/include/utils/Tokenizer.h
deleted file mode 100644
index c7db5fb..0000000
--- a/include/utils/Tokenizer.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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 _UTILS_TOKENIZER_H
-#define _UTILS_TOKENIZER_H
-
-#include <assert.h>
-#include <utils/Errors.h>
-#include <utils/FileMap.h>
-#include <utils/String8.h>
-
-namespace android {
-
-/**
- * A simple tokenizer for loading and parsing ASCII text files line by line.
- */
-class Tokenizer {
- Tokenizer(const String8& filename, FileMap* fileMap, char* buffer, size_t length);
-
-public:
- ~Tokenizer();
-
- /**
- * Opens a file and maps it into memory.
- *
- * Returns NO_ERROR and a tokenizer for the file, if successful.
- * Otherwise returns an error and sets outTokenizer to NULL.
- */
- static status_t open(const String8& filename, Tokenizer** outTokenizer);
-
- /**
- * Returns true if at the end of the file.
- */
- inline bool isEof() const { return mCurrent == getEnd(); }
-
- /**
- * Returns true if at the end of the line or end of the file.
- */
- inline bool isEol() const { return isEof() || *mCurrent == '\n'; }
-
- /**
- * Gets the name of the file.
- */
- inline String8 getFilename() const { return mFilename; }
-
- /**
- * Gets a 1-based line number index for the current position.
- */
- inline int32_t getLineNumber() const { return mLineNumber; }
-
- /**
- * Formats a location string consisting of the filename and current line number.
- * Returns a string like "MyFile.txt:33".
- */
- String8 getLocation() const;
-
- /**
- * Gets the character at the current position.
- * Returns null at end of file.
- */
- inline char peekChar() const { return isEof() ? '\0' : *mCurrent; }
-
- /**
- * Gets the remainder of the current line as a string, excluding the newline character.
- */
- String8 peekRemainderOfLine() const;
-
- /**
- * Gets the character at the current position and advances past it.
- * Returns null at end of file.
- */
- inline char nextChar() { return isEof() ? '\0' : *(mCurrent++); }
-
- /**
- * Gets the next token on this line stopping at the specified delimiters
- * or the end of the line whichever comes first and advances past it.
- * Also stops at embedded nulls.
- * Returns the token or an empty string if the current character is a delimiter
- * or is at the end of the line.
- */
- String8 nextToken(const char* delimiters);
-
- /**
- * Advances to the next line.
- * Does nothing if already at the end of the file.
- */
- void nextLine();
-
- /**
- * Skips over the specified delimiters in the line.
- * Also skips embedded nulls.
- */
- void skipDelimiters(const char* delimiters);
-
-private:
- Tokenizer(const Tokenizer& other); // not copyable
-
- String8 mFilename;
- FileMap* mFileMap;
- char* mBuffer;
- size_t mLength;
-
- const char* mCurrent;
- int32_t mLineNumber;
-
- inline const char* getEnd() const { return mBuffer + mLength; }
-
-};
-
-} // namespace android
-
-#endif // _UTILS_TOKENIZER_H
diff --git a/include/utils/Trace.h b/include/utils/Trace.h
deleted file mode 100644
index f33ddf6..0000000
--- a/include/utils/Trace.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (C) 2012 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_TRACE_H
-#define ANDROID_TRACE_H
-
-#include <fcntl.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <cutils/compiler.h>
-#include <utils/threads.h>
-
-// The ATRACE_TAG macro can be defined before including this header to trace
-// using one of the tags defined below. It must be defined to one of the
-// following ATRACE_TAG_* macros. The trace tag is used to filter tracing in
-// userland to avoid some of the runtime cost of tracing when it is not desired.
-//
-// Defining ATRACE_TAG to be ATRACE_TAG_ALWAYS will result in the tracing always
-// being enabled - this should ONLY be done for debug code, as userland tracing
-// has a performance cost even when the trace is not being recorded. Defining
-// ATRACE_TAG to be ATRACE_TAG_NEVER or leaving ATRACE_TAG undefined will result
-// in the tracing always being disabled.
-#define ATRACE_TAG_NEVER 0 // The "never" tag is never enabled.
-#define ATRACE_TAG_ALWAYS (1<<0) // The "always" tag is always enabled.
-#define ATRACE_TAG_GRAPHICS (1<<1)
-#define ATRACE_TAG_LAST (1<<1)
-
-#define ATRACE_TAG_INVALID (~((ATRACE_TAG_LAST - 1) | ATRACE_TAG_LAST))
-
-#ifndef ATRACE_TAG
-#define ATRACE_TAG ATRACE_TAG_NEVER
-#elif ATRACE_TAG > ATRACE_TAG_LAST
-#error ATRACE_TAG must be defined to be one of the tags defined in utils/Trace.h
-#endif
-
-// ATRACE_CALL traces the beginning and end of the current function. To trace
-// the correct start and end times this macro should be the first line of the
-// function body.
-#define ATRACE_CALL() android::ScopedTrace ___tracer(ATRACE_TAG, __FUNCTION__)
-
-// ATRACE_INT traces a named integer value. This can be used to track how the
-// value changes over time in a trace.
-#define ATRACE_INT(name, value) android::Tracer::traceCounter(ATRACE_TAG, name, value)
-
-namespace android {
-
-class Tracer {
-
-public:
-
- static inline void traceCounter(uint64_t tag, const char* name,
- int32_t value) {
- if (!android_atomic_acquire_load(&sIsReady)) {
- init();
- }
- int traceFD = sTraceFD;
- if (CC_UNLIKELY(tagEnabled(tag) && traceFD != -1)) {
- char buf[1024];
- snprintf(buf, 1024, "C|%d|%s|%d", getpid(), name, value);
- write(traceFD, buf, strlen(buf));
- }
- }
-
- static inline void traceBegin(uint64_t tag, const char* name) {
- if (CC_UNLIKELY(!android_atomic_acquire_load(&sIsReady))) {
- init();
- }
- int traceFD = sTraceFD;
- if (CC_UNLIKELY(tagEnabled(tag) && (traceFD != -1))) {
- char buf[1024];
- size_t len = snprintf(buf, 1024, "B|%d|%s", getpid(), name);
- write(traceFD, buf, len);
- }
- }
-
- static inline void traceEnd(uint64_t tag) {
- if (CC_UNLIKELY(!android_atomic_acquire_load(&sIsReady))) {
- init();
- }
- int traceFD = sTraceFD;
- if (CC_UNLIKELY(tagEnabled(tag) && (traceFD != -1))) {
- char buf = 'E';
- write(traceFD, &buf, 1);
- }
- }
-
-private:
-
- static inline bool tagEnabled(uint64_t tag) {
- return !(tag & ATRACE_TAG_INVALID) && (tag & sEnabledTags);
- }
-
- // init opens the trace marker file for writing and reads the
- // atrace.tags.enableflags system property. It does this only the first
- // time it is run, using sMutex for synchronization.
- static void init();
-
- // sIsReady is a boolean value indicating whether a call to init() has
- // completed in this process. It is initialized to 0 and set to 1 when the
- // first init() call completes. It is set to 1 even if a failure occurred
- // in init (e.g. the trace marker file couldn't be opened).
- //
- // This should be checked by all tracing functions using an atomic acquire
- // load operation before calling init(). This check avoids the need to lock
- // a mutex each time a trace function gets called.
- static volatile int32_t sIsReady;
-
- // sTraceFD is the file descriptor used to write to the kernel's trace
- // buffer. It is initialized to -1 and set to an open file descriptor in
- // init() while a lock on sMutex is held.
- //
- // This should only be used by a trace function after init() has
- // successfully completed.
- static int sTraceFD;
-
- // sEnabledTags is the set of tag bits for which tracing is currently
- // enabled. It is initialized to 0 and set based on the
- // atrace.tags.enableflags system property in init() while a lock on sMutex
- // is held.
- //
- // This should only be used by a trace function after init() has
- // successfully completed.
- static uint64_t sEnabledTags;
-
- // sMutex is used to protect the execution of init().
- static Mutex sMutex;
-};
-
-class ScopedTrace {
-
-public:
- inline ScopedTrace(uint64_t tag, const char* name) :
- mTag(tag) {
- Tracer::traceBegin(mTag, name);
- }
-
- inline ~ScopedTrace() {
- Tracer::traceEnd(mTag);
- }
-
-private:
-
- uint64_t mTag;
-};
-
-}; // namespace android
-
-#endif // ANDROID_TRACE_H
diff --git a/include/utils/TypeHelpers.h b/include/utils/TypeHelpers.h
deleted file mode 100644
index 1f2c2d5..0000000
--- a/include/utils/TypeHelpers.h
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * Copyright (C) 2005 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_TYPE_HELPERS_H
-#define ANDROID_TYPE_HELPERS_H
-
-#include <new>
-#include <stdint.h>
-#include <string.h>
-#include <sys/types.h>
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-/*
- * Types traits
- */
-
-template <typename T> struct trait_trivial_ctor { enum { value = false }; };
-template <typename T> struct trait_trivial_dtor { enum { value = false }; };
-template <typename T> struct trait_trivial_copy { enum { value = false }; };
-template <typename T> struct trait_trivial_move { enum { value = false }; };
-template <typename T> struct trait_pointer { enum { value = false }; };
-template <typename T> struct trait_pointer<T*> { enum { value = true }; };
-
-template <typename TYPE>
-struct traits {
- enum {
- // whether this type is a pointer
- is_pointer = trait_pointer<TYPE>::value,
- // whether this type's constructor is a no-op
- has_trivial_ctor = is_pointer || trait_trivial_ctor<TYPE>::value,
- // whether this type's destructor is a no-op
- has_trivial_dtor = is_pointer || trait_trivial_dtor<TYPE>::value,
- // whether this type type can be copy-constructed with memcpy
- has_trivial_copy = is_pointer || trait_trivial_copy<TYPE>::value,
- // whether this type can be moved with memmove
- has_trivial_move = is_pointer || trait_trivial_move<TYPE>::value
- };
-};
-
-template <typename T, typename U>
-struct aggregate_traits {
- enum {
- is_pointer = false,
- has_trivial_ctor =
- traits<T>::has_trivial_ctor && traits<U>::has_trivial_ctor,
- has_trivial_dtor =
- traits<T>::has_trivial_dtor && traits<U>::has_trivial_dtor,
- has_trivial_copy =
- traits<T>::has_trivial_copy && traits<U>::has_trivial_copy,
- has_trivial_move =
- traits<T>::has_trivial_move && traits<U>::has_trivial_move
- };
-};
-
-#define ANDROID_BASIC_TYPES_TRAITS( T ) \
- template<> struct trait_trivial_ctor< T > { enum { value = true }; }; \
- template<> struct trait_trivial_dtor< T > { enum { value = true }; }; \
- template<> struct trait_trivial_copy< T > { enum { value = true }; }; \
- template<> struct trait_trivial_move< T > { enum { value = true }; };
-
-// ---------------------------------------------------------------------------
-
-/*
- * basic types traits
- */
-
-ANDROID_BASIC_TYPES_TRAITS( void )
-ANDROID_BASIC_TYPES_TRAITS( bool )
-ANDROID_BASIC_TYPES_TRAITS( char )
-ANDROID_BASIC_TYPES_TRAITS( unsigned char )
-ANDROID_BASIC_TYPES_TRAITS( short )
-ANDROID_BASIC_TYPES_TRAITS( unsigned short )
-ANDROID_BASIC_TYPES_TRAITS( int )
-ANDROID_BASIC_TYPES_TRAITS( unsigned int )
-ANDROID_BASIC_TYPES_TRAITS( long )
-ANDROID_BASIC_TYPES_TRAITS( unsigned long )
-ANDROID_BASIC_TYPES_TRAITS( long long )
-ANDROID_BASIC_TYPES_TRAITS( unsigned long long )
-ANDROID_BASIC_TYPES_TRAITS( float )
-ANDROID_BASIC_TYPES_TRAITS( double )
-
-// ---------------------------------------------------------------------------
-
-
-/*
- * compare and order types
- */
-
-template<typename TYPE> inline
-int strictly_order_type(const TYPE& lhs, const TYPE& rhs) {
- return (lhs < rhs) ? 1 : 0;
-}
-
-template<typename TYPE> inline
-int compare_type(const TYPE& lhs, const TYPE& rhs) {
- return strictly_order_type(rhs, lhs) - strictly_order_type(lhs, rhs);
-}
-
-/*
- * create, destroy, copy and move types...
- */
-
-template<typename TYPE> inline
-void construct_type(TYPE* p, size_t n) {
- if (!traits<TYPE>::has_trivial_ctor) {
- while (n--) {
- new(p++) TYPE;
- }
- }
-}
-
-template<typename TYPE> inline
-void destroy_type(TYPE* p, size_t n) {
- if (!traits<TYPE>::has_trivial_dtor) {
- while (n--) {
- p->~TYPE();
- p++;
- }
- }
-}
-
-template<typename TYPE> inline
-void copy_type(TYPE* d, const TYPE* s, size_t n) {
- if (!traits<TYPE>::has_trivial_copy) {
- while (n--) {
- new(d) TYPE(*s);
- d++, s++;
- }
- } else {
- memcpy(d,s,n*sizeof(TYPE));
- }
-}
-
-template<typename TYPE> inline
-void splat_type(TYPE* where, const TYPE* what, size_t n) {
- if (!traits<TYPE>::has_trivial_copy) {
- while (n--) {
- new(where) TYPE(*what);
- where++;
- }
- } else {
- while (n--) {
- *where++ = *what;
- }
- }
-}
-
-template<typename TYPE> inline
-void move_forward_type(TYPE* d, const TYPE* s, size_t n = 1) {
- if ((traits<TYPE>::has_trivial_dtor && traits<TYPE>::has_trivial_copy)
- || traits<TYPE>::has_trivial_move)
- {
- memmove(d,s,n*sizeof(TYPE));
- } else {
- d += n;
- s += n;
- while (n--) {
- --d, --s;
- if (!traits<TYPE>::has_trivial_copy) {
- new(d) TYPE(*s);
- } else {
- *d = *s;
- }
- if (!traits<TYPE>::has_trivial_dtor) {
- s->~TYPE();
- }
- }
- }
-}
-
-template<typename TYPE> inline
-void move_backward_type(TYPE* d, const TYPE* s, size_t n = 1) {
- if ((traits<TYPE>::has_trivial_dtor && traits<TYPE>::has_trivial_copy)
- || traits<TYPE>::has_trivial_move)
- {
- memmove(d,s,n*sizeof(TYPE));
- } else {
- while (n--) {
- if (!traits<TYPE>::has_trivial_copy) {
- new(d) TYPE(*s);
- } else {
- *d = *s;
- }
- if (!traits<TYPE>::has_trivial_dtor) {
- s->~TYPE();
- }
- d++, s++;
- }
- }
-}
-
-// ---------------------------------------------------------------------------
-
-/*
- * a key/value pair
- */
-
-template <typename KEY, typename VALUE>
-struct key_value_pair_t {
- typedef KEY key_t;
- typedef VALUE value_t;
-
- KEY key;
- VALUE value;
- key_value_pair_t() { }
- key_value_pair_t(const key_value_pair_t& o) : key(o.key), value(o.value) { }
- key_value_pair_t(const KEY& k, const VALUE& v) : key(k), value(v) { }
- key_value_pair_t(const KEY& k) : key(k) { }
- inline bool operator < (const key_value_pair_t& o) const {
- return strictly_order_type(key, o.key);
- }
- inline const KEY& getKey() const {
- return key;
- }
- inline const VALUE& getValue() const {
- return value;
- }
-};
-
-template <typename K, typename V>
-struct trait_trivial_ctor< key_value_pair_t<K, V> >
-{ enum { value = aggregate_traits<K,V>::has_trivial_ctor }; };
-template <typename K, typename V>
-struct trait_trivial_dtor< key_value_pair_t<K, V> >
-{ enum { value = aggregate_traits<K,V>::has_trivial_dtor }; };
-template <typename K, typename V>
-struct trait_trivial_copy< key_value_pair_t<K, V> >
-{ enum { value = aggregate_traits<K,V>::has_trivial_copy }; };
-template <typename K, typename V>
-struct trait_trivial_move< key_value_pair_t<K, V> >
-{ enum { value = aggregate_traits<K,V>::has_trivial_move }; };
-
-// ---------------------------------------------------------------------------
-
-/*
- * Hash codes.
- */
-typedef uint32_t hash_t;
-
-template <typename TKey>
-hash_t hash_type(const TKey& key);
-
-/* Built-in hash code specializations.
- * Assumes pointers are 32bit. */
-#define ANDROID_INT32_HASH(T) \
- template <> inline hash_t hash_type(const T& value) { return hash_t(value); }
-#define ANDROID_INT64_HASH(T) \
- template <> inline hash_t hash_type(const T& value) { \
- return hash_t((value >> 32) ^ value); }
-#define ANDROID_REINTERPRET_HASH(T, R) \
- template <> inline hash_t hash_type(const T& value) { \
- return hash_type(*reinterpret_cast<const R*>(&value)); }
-
-ANDROID_INT32_HASH(bool)
-ANDROID_INT32_HASH(int8_t)
-ANDROID_INT32_HASH(uint8_t)
-ANDROID_INT32_HASH(int16_t)
-ANDROID_INT32_HASH(uint16_t)
-ANDROID_INT32_HASH(int32_t)
-ANDROID_INT32_HASH(uint32_t)
-ANDROID_INT64_HASH(int64_t)
-ANDROID_INT64_HASH(uint64_t)
-ANDROID_REINTERPRET_HASH(float, uint32_t)
-ANDROID_REINTERPRET_HASH(double, uint64_t)
-
-template <typename T> inline hash_t hash_type(const T*& value) {
- return hash_type(uintptr_t(value));
-}
-
-}; // namespace android
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_TYPE_HELPERS_H
diff --git a/include/utils/Unicode.h b/include/utils/Unicode.h
deleted file mode 100644
index 9273533..0000000
--- a/include/utils/Unicode.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 2005 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 <sys/types.h>
-#include <stdint.h>
-
-extern "C" {
-
-typedef uint32_t char32_t;
-typedef uint16_t char16_t;
-
-// Standard string functions on char16_t strings.
-int strcmp16(const char16_t *, const char16_t *);
-int strncmp16(const char16_t *s1, const char16_t *s2, size_t n);
-size_t strlen16(const char16_t *);
-size_t strnlen16(const char16_t *, size_t);
-char16_t *strcpy16(char16_t *, const char16_t *);
-char16_t *strncpy16(char16_t *, const char16_t *, size_t);
-
-// Version of comparison that supports embedded nulls.
-// This is different than strncmp() because we don't stop
-// at a nul character and consider the strings to be different
-// if the lengths are different (thus we need to supply the
-// lengths of both strings). This can also be used when
-// your string is not nul-terminated as it will have the
-// equivalent result as strcmp16 (unlike strncmp16).
-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);
-
-// Standard string functions on char32_t strings.
-size_t strlen32(const char32_t *);
-size_t strnlen32(const char32_t *, size_t);
-
-/**
- * Measure the length of a UTF-32 string in UTF-8. If the string is invalid
- * such as containing a surrogate character, -1 will be returned.
- */
-ssize_t utf32_to_utf8_length(const char32_t *src, size_t src_len);
-
-/**
- * Stores a UTF-8 string converted from "src" in "dst", if "dst_length" is not
- * large enough to store the string, the part of the "src" string is stored
- * into "dst" as much as possible. See the examples for more detail.
- * Returns the size actually used for storing the string.
- * dst" is not null-terminated when dst_len is fully used (like strncpy).
- *
- * Example 1
- * "src" == \u3042\u3044 (\xE3\x81\x82\xE3\x81\x84)
- * "src_len" == 2
- * "dst_len" >= 7
- * ->
- * Returned value == 6
- * "dst" becomes \xE3\x81\x82\xE3\x81\x84\0
- * (note that "dst" is null-terminated)
- *
- * Example 2
- * "src" == \u3042\u3044 (\xE3\x81\x82\xE3\x81\x84)
- * "src_len" == 2
- * "dst_len" == 5
- * ->
- * Returned value == 3
- * "dst" becomes \xE3\x81\x82\0
- * (note that "dst" is null-terminated, but \u3044 is not stored in "dst"
- * since "dst" does not have enough size to store the character)
- *
- * Example 3
- * "src" == \u3042\u3044 (\xE3\x81\x82\xE3\x81\x84)
- * "src_len" == 2
- * "dst_len" == 6
- * ->
- * Returned value == 6
- * "dst" becomes \xE3\x81\x82\xE3\x81\x84
- * (note that "dst" is NOT null-terminated, like strncpy)
- */
-void utf32_to_utf8(const char32_t* src, size_t src_len, char* dst);
-
-/**
- * Returns the unicode value at "index".
- * Returns -1 when the index is invalid (equals to or more than "src_len").
- * If returned value is positive, it is able to be converted to char32_t, which
- * is unsigned. Then, if "next_index" is not NULL, the next index to be used is
- * stored in "next_index". "next_index" can be NULL.
- */
-int32_t utf32_from_utf8_at(const char *src, size_t src_len, size_t index, size_t *next_index);
-
-
-/**
- * Returns the UTF-8 length of UTF-16 string "src".
- */
-ssize_t utf16_to_utf8_length(const char16_t *src, size_t src_len);
-
-/**
- * Converts a UTF-16 string to UTF-8. The destination buffer must be large
- * enough to fit the UTF-16 as measured by utf16_to_utf8_length with an added
- * NULL terminator.
- */
-void utf16_to_utf8(const char16_t* src, size_t src_len, char* dst);
-
-/**
- * Returns the length of "src" when "src" is valid UTF-8 string.
- * Returns 0 if src is NULL or 0-length string. Returns -1 when the source
- * is an invalid string.
- *
- * This function should be used to determine whether "src" is valid UTF-8
- * characters with valid unicode codepoints. "src" must be null-terminated.
- *
- * If you are going to use other utf8_to_... functions defined in this header
- * with string which may not be valid UTF-8 with valid codepoint (form 0 to
- * 0x10FFFF), you should use this function before calling others, since the
- * other functions do not check whether the string is valid UTF-8 or not.
- *
- * If you do not care whether "src" is valid UTF-8 or not, you should use
- * strlen() as usual, which should be much faster.
- */
-ssize_t utf8_length(const char *src);
-
-/**
- * Measure the length of a UTF-32 string.
- */
-size_t utf8_to_utf32_length(const char *src, size_t src_len);
-
-/**
- * Stores a UTF-32 string converted from "src" in "dst". "dst" must be large
- * enough to store the entire converted string as measured by
- * utf8_to_utf32_length plus space for a NULL terminator.
- */
-void utf8_to_utf32(const char* src, size_t src_len, char32_t* dst);
-
-/**
- * Returns the UTF-16 length of UTF-8 string "src".
- */
-ssize_t utf8_to_utf16_length(const uint8_t* src, size_t srcLen);
-
-/**
- * Convert UTF-8 to UTF-16 including surrogate pairs.
- * Returns a pointer to the end of the string (where a null terminator might go
- * if you wanted to add one).
- */
-char16_t* utf8_to_utf16_no_null_terminator(const uint8_t* src, size_t srcLen, char16_t* dst);
-
-/**
- * Convert UTF-8 to UTF-16 including surrogate pairs. The destination buffer
- * must be large enough to hold the result as measured by utf8_to_utf16_length
- * plus an added NULL terminator.
- */
-void utf8_to_utf16(const uint8_t* src, size_t srcLen, char16_t* dst);
-
-}
-
-#endif
diff --git a/include/utils/Vector.h b/include/utils/Vector.h
deleted file mode 100644
index 5b5296b..0000000
--- a/include/utils/Vector.h
+++ /dev/null
@@ -1,421 +0,0 @@
-/*
- * Copyright (C) 2005 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_VECTOR_H
-#define ANDROID_VECTOR_H
-
-#include <new>
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Log.h>
-#include <utils/VectorImpl.h>
-#include <utils/TypeHelpers.h>
-
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-template <typename TYPE>
-class SortedVector;
-
-/*!
- * The main templated vector class ensuring type safety
- * while making use of VectorImpl.
- * This is the class users want to use.
- */
-
-template <class TYPE>
-class Vector : private VectorImpl
-{
-public:
- typedef TYPE value_type;
-
- /*!
- * Constructors and destructors
- */
-
- Vector();
- Vector(const Vector<TYPE>& rhs);
- explicit Vector(const SortedVector<TYPE>& rhs);
- virtual ~Vector();
-
- /*! copy operator */
- const Vector<TYPE>& operator = (const Vector<TYPE>& rhs) const;
- Vector<TYPE>& operator = (const Vector<TYPE>& rhs);
-
- const Vector<TYPE>& operator = (const SortedVector<TYPE>& rhs) const;
- Vector<TYPE>& operator = (const SortedVector<TYPE>& rhs);
-
- /*
- * empty the vector
- */
-
- inline void clear() { VectorImpl::clear(); }
-
- /*!
- * vector stats
- */
-
- //! returns number of items in the vector
- inline size_t size() const { return VectorImpl::size(); }
- //! returns wether or not the vector is empty
- inline bool isEmpty() const { return VectorImpl::isEmpty(); }
- //! returns how many items can be stored without reallocating the backing store
- inline size_t capacity() const { return VectorImpl::capacity(); }
- //! setst the capacity. capacity can never be reduced less than size()
- inline ssize_t setCapacity(size_t size) { return VectorImpl::setCapacity(size); }
-
- /*!
- * C-style array access
- */
-
- //! read-only C-style access
- inline const TYPE* array() const;
- //! read-write C-style access
- TYPE* editArray();
-
- /*!
- * accessors
- */
-
- //! read-only access to an item at a given index
- inline const TYPE& operator [] (size_t index) const;
- //! alternate name for operator []
- inline const TYPE& itemAt(size_t index) const;
- //! stack-usage of the vector. returns the top of the stack (last element)
- const TYPE& top() const;
- //! same as operator [], but allows to access the vector backward (from the end) with a negative index
- const TYPE& mirrorItemAt(ssize_t index) const;
-
- /*!
- * modifing the array
- */
-
- //! copy-on write support, grants write access to an item
- TYPE& editItemAt(size_t index);
- //! grants right acces to the top of the stack (last element)
- TYPE& editTop();
-
- /*!
- * append/insert another vector
- */
-
- //! insert another vector at a given index
- ssize_t insertVectorAt(const Vector<TYPE>& vector, size_t index);
-
- //! append another vector at the end of this one
- ssize_t appendVector(const Vector<TYPE>& vector);
-
-
- //! insert an array at a given index
- ssize_t insertArrayAt(const TYPE* array, size_t index, size_t length);
-
- //! append an array at the end of this vector
- ssize_t appendArray(const TYPE* array, size_t length);
-
- /*!
- * add/insert/replace items
- */
-
- //! insert one or several items initialized with their default constructor
- inline ssize_t insertAt(size_t index, size_t numItems = 1);
- //! insert one or several items initialized from a prototype item
- ssize_t insertAt(const TYPE& prototype_item, size_t index, size_t numItems = 1);
- //! pop the top of the stack (removes the last element). No-op if the stack's empty
- inline void pop();
- //! pushes an item initialized with its default constructor
- inline void push();
- //! pushes an item on the top of the stack
- void push(const TYPE& item);
- //! same as push() but returns the index the item was added at (or an error)
- inline ssize_t add();
- //! same as push() but returns the index the item was added at (or an error)
- ssize_t add(const TYPE& item);
- //! replace an item with a new one initialized with its default constructor
- inline ssize_t replaceAt(size_t index);
- //! replace an item with a new one
- ssize_t replaceAt(const TYPE& item, size_t index);
-
- /*!
- * remove items
- */
-
- //! remove several items
- inline ssize_t removeItemsAt(size_t index, size_t count = 1);
- //! remove one item
- inline ssize_t removeAt(size_t index) { return removeItemsAt(index); }
-
- /*!
- * sort (stable) the array
- */
-
- typedef int (*compar_t)(const TYPE* lhs, const TYPE* rhs);
- typedef int (*compar_r_t)(const TYPE* lhs, const TYPE* rhs, void* state);
-
- inline status_t sort(compar_t cmp);
- inline status_t sort(compar_r_t cmp, void* state);
-
- // for debugging only
- inline size_t getItemSize() const { return itemSize(); }
-
-
- /*
- * these inlines add some level of compatibility with STL. eventually
- * we should probably turn things around.
- */
- typedef TYPE* iterator;
- typedef TYPE const* const_iterator;
-
- inline iterator begin() { return editArray(); }
- inline iterator end() { return editArray() + size(); }
- inline const_iterator begin() const { return array(); }
- inline const_iterator end() const { return array() + size(); }
- inline void reserve(size_t n) { setCapacity(n); }
- inline bool empty() const{ return isEmpty(); }
- inline void push_back(const TYPE& item) { insertAt(item, size(), 1); }
- inline void push_front(const TYPE& item) { insertAt(item, 0, 1); }
- inline iterator erase(iterator pos) {
- return begin() + removeItemsAt(pos-array());
- }
-
-protected:
- virtual void do_construct(void* storage, size_t num) const;
- virtual void do_destroy(void* storage, size_t num) const;
- virtual void do_copy(void* dest, const void* from, size_t num) const;
- virtual void do_splat(void* dest, const void* item, size_t num) const;
- virtual void do_move_forward(void* dest, const void* from, size_t num) const;
- virtual void do_move_backward(void* dest, const void* from, size_t num) const;
-};
-
-
-// ---------------------------------------------------------------------------
-// No user serviceable parts from here...
-// ---------------------------------------------------------------------------
-
-template<class TYPE> inline
-Vector<TYPE>::Vector()
- : VectorImpl(sizeof(TYPE),
- ((traits<TYPE>::has_trivial_ctor ? HAS_TRIVIAL_CTOR : 0)
- |(traits<TYPE>::has_trivial_dtor ? HAS_TRIVIAL_DTOR : 0)
- |(traits<TYPE>::has_trivial_copy ? HAS_TRIVIAL_COPY : 0))
- )
-{
-}
-
-template<class TYPE> inline
-Vector<TYPE>::Vector(const Vector<TYPE>& rhs)
- : VectorImpl(rhs) {
-}
-
-template<class TYPE> inline
-Vector<TYPE>::Vector(const SortedVector<TYPE>& rhs)
- : VectorImpl(static_cast<const VectorImpl&>(rhs)) {
-}
-
-template<class TYPE> inline
-Vector<TYPE>::~Vector() {
- finish_vector();
-}
-
-template<class TYPE> inline
-Vector<TYPE>& Vector<TYPE>::operator = (const Vector<TYPE>& rhs) {
- VectorImpl::operator = (rhs);
- return *this;
-}
-
-template<class TYPE> inline
-const Vector<TYPE>& Vector<TYPE>::operator = (const Vector<TYPE>& rhs) const {
- VectorImpl::operator = (static_cast<const VectorImpl&>(rhs));
- return *this;
-}
-
-template<class TYPE> inline
-Vector<TYPE>& Vector<TYPE>::operator = (const SortedVector<TYPE>& rhs) {
- VectorImpl::operator = (static_cast<const VectorImpl&>(rhs));
- return *this;
-}
-
-template<class TYPE> inline
-const Vector<TYPE>& Vector<TYPE>::operator = (const SortedVector<TYPE>& rhs) const {
- VectorImpl::operator = (rhs);
- return *this;
-}
-
-template<class TYPE> inline
-const TYPE* Vector<TYPE>::array() const {
- return static_cast<const TYPE *>(arrayImpl());
-}
-
-template<class TYPE> inline
-TYPE* Vector<TYPE>::editArray() {
- return static_cast<TYPE *>(editArrayImpl());
-}
-
-
-template<class TYPE> inline
-const TYPE& Vector<TYPE>::operator[](size_t index) const {
- LOG_FATAL_IF( index>=size(),
- "itemAt: index %d is past size %d", (int)index, (int)size() );
- return *(array() + index);
-}
-
-template<class TYPE> inline
-const TYPE& Vector<TYPE>::itemAt(size_t index) const {
- return operator[](index);
-}
-
-template<class TYPE> inline
-const TYPE& Vector<TYPE>::mirrorItemAt(ssize_t index) const {
- LOG_FATAL_IF( (index>0 ? index : -index)>=size(),
- "mirrorItemAt: index %d is past size %d",
- (int)index, (int)size() );
- return *(array() + ((index<0) ? (size()-index) : index));
-}
-
-template<class TYPE> inline
-const TYPE& Vector<TYPE>::top() const {
- return *(array() + size() - 1);
-}
-
-template<class TYPE> inline
-TYPE& Vector<TYPE>::editItemAt(size_t index) {
- return *( static_cast<TYPE *>(editItemLocation(index)) );
-}
-
-template<class TYPE> inline
-TYPE& Vector<TYPE>::editTop() {
- return *( static_cast<TYPE *>(editItemLocation(size()-1)) );
-}
-
-template<class TYPE> inline
-ssize_t Vector<TYPE>::insertVectorAt(const Vector<TYPE>& vector, size_t index) {
- return VectorImpl::insertVectorAt(reinterpret_cast<const VectorImpl&>(vector), index);
-}
-
-template<class TYPE> inline
-ssize_t Vector<TYPE>::appendVector(const Vector<TYPE>& vector) {
- return VectorImpl::appendVector(reinterpret_cast<const VectorImpl&>(vector));
-}
-
-template<class TYPE> inline
-ssize_t Vector<TYPE>::insertArrayAt(const TYPE* array, size_t index, size_t length) {
- return VectorImpl::insertArrayAt(array, index, length);
-}
-
-template<class TYPE> inline
-ssize_t Vector<TYPE>::appendArray(const TYPE* array, size_t length) {
- return VectorImpl::appendArray(array, length);
-}
-
-template<class TYPE> inline
-ssize_t Vector<TYPE>::insertAt(const TYPE& item, size_t index, size_t numItems) {
- return VectorImpl::insertAt(&item, index, numItems);
-}
-
-template<class TYPE> inline
-void Vector<TYPE>::push(const TYPE& item) {
- return VectorImpl::push(&item);
-}
-
-template<class TYPE> inline
-ssize_t Vector<TYPE>::add(const TYPE& item) {
- return VectorImpl::add(&item);
-}
-
-template<class TYPE> inline
-ssize_t Vector<TYPE>::replaceAt(const TYPE& item, size_t index) {
- return VectorImpl::replaceAt(&item, index);
-}
-
-template<class TYPE> inline
-ssize_t Vector<TYPE>::insertAt(size_t index, size_t numItems) {
- return VectorImpl::insertAt(index, numItems);
-}
-
-template<class TYPE> inline
-void Vector<TYPE>::pop() {
- VectorImpl::pop();
-}
-
-template<class TYPE> inline
-void Vector<TYPE>::push() {
- VectorImpl::push();
-}
-
-template<class TYPE> inline
-ssize_t Vector<TYPE>::add() {
- return VectorImpl::add();
-}
-
-template<class TYPE> inline
-ssize_t Vector<TYPE>::replaceAt(size_t index) {
- return VectorImpl::replaceAt(index);
-}
-
-template<class TYPE> inline
-ssize_t Vector<TYPE>::removeItemsAt(size_t index, size_t count) {
- return VectorImpl::removeItemsAt(index, count);
-}
-
-template<class TYPE> inline
-status_t Vector<TYPE>::sort(Vector<TYPE>::compar_t cmp) {
- return VectorImpl::sort((VectorImpl::compar_t)cmp);
-}
-
-template<class TYPE> inline
-status_t Vector<TYPE>::sort(Vector<TYPE>::compar_r_t cmp, void* state) {
- return VectorImpl::sort((VectorImpl::compar_r_t)cmp, state);
-}
-
-// ---------------------------------------------------------------------------
-
-template<class TYPE>
-void Vector<TYPE>::do_construct(void* storage, size_t num) const {
- construct_type( reinterpret_cast<TYPE*>(storage), num );
-}
-
-template<class TYPE>
-void Vector<TYPE>::do_destroy(void* storage, size_t num) const {
- destroy_type( reinterpret_cast<TYPE*>(storage), num );
-}
-
-template<class TYPE>
-void Vector<TYPE>::do_copy(void* dest, const void* from, size_t num) const {
- copy_type( reinterpret_cast<TYPE*>(dest), reinterpret_cast<const TYPE*>(from), num );
-}
-
-template<class TYPE>
-void Vector<TYPE>::do_splat(void* dest, const void* item, size_t num) const {
- splat_type( reinterpret_cast<TYPE*>(dest), reinterpret_cast<const TYPE*>(item), num );
-}
-
-template<class TYPE>
-void Vector<TYPE>::do_move_forward(void* dest, const void* from, size_t num) const {
- move_forward_type( reinterpret_cast<TYPE*>(dest), reinterpret_cast<const TYPE*>(from), num );
-}
-
-template<class TYPE>
-void Vector<TYPE>::do_move_backward(void* dest, const void* from, size_t num) const {
- move_backward_type( reinterpret_cast<TYPE*>(dest), reinterpret_cast<const TYPE*>(from), num );
-}
-
-}; // namespace android
-
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_VECTOR_H
diff --git a/include/utils/VectorImpl.h b/include/utils/VectorImpl.h
deleted file mode 100644
index c4ec2ff..0000000
--- a/include/utils/VectorImpl.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright (C) 2005 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_VECTOR_IMPL_H
-#define ANDROID_VECTOR_IMPL_H
-
-#include <assert.h>
-#include <stdint.h>
-#include <sys/types.h>
-#include <utils/Errors.h>
-
-// ---------------------------------------------------------------------------
-// No user serviceable parts in here...
-// ---------------------------------------------------------------------------
-
-namespace android {
-
-/*!
- * Implementation of the guts of the vector<> class
- * this ensures backward binary compatibility and
- * reduces code size.
- * For performance reasons, we expose mStorage and mCount
- * so these fields are set in stone.
- *
- */
-
-class VectorImpl
-{
-public:
- enum { // flags passed to the ctor
- HAS_TRIVIAL_CTOR = 0x00000001,
- HAS_TRIVIAL_DTOR = 0x00000002,
- HAS_TRIVIAL_COPY = 0x00000004,
- };
-
- VectorImpl(size_t itemSize, uint32_t flags);
- VectorImpl(const VectorImpl& rhs);
- virtual ~VectorImpl();
-
- /*! must be called from subclasses destructor */
- void finish_vector();
-
- VectorImpl& operator = (const VectorImpl& rhs);
-
- /*! C-style array access */
- inline const void* arrayImpl() const { return mStorage; }
- void* editArrayImpl();
-
- /*! vector stats */
- inline size_t size() const { return mCount; }
- inline bool isEmpty() const { return mCount == 0; }
- size_t capacity() const;
- ssize_t setCapacity(size_t size);
-
- /*! append/insert another vector or array */
- ssize_t insertVectorAt(const VectorImpl& vector, size_t index);
- ssize_t appendVector(const VectorImpl& vector);
- ssize_t insertArrayAt(const void* array, size_t index, size_t length);
- ssize_t appendArray(const void* array, size_t length);
-
- /*! add/insert/replace items */
- ssize_t insertAt(size_t where, size_t numItems = 1);
- ssize_t insertAt(const void* item, size_t where, size_t numItems = 1);
- void pop();
- void push();
- void push(const void* item);
- ssize_t add();
- ssize_t add(const void* item);
- ssize_t replaceAt(size_t index);
- ssize_t replaceAt(const void* item, size_t index);
-
- /*! remove items */
- ssize_t removeItemsAt(size_t index, size_t count = 1);
- void clear();
-
- const void* itemLocation(size_t index) const;
- void* editItemLocation(size_t index);
-
- typedef int (*compar_t)(const void* lhs, const void* rhs);
- typedef int (*compar_r_t)(const void* lhs, const void* rhs, void* state);
- status_t sort(compar_t cmp);
- status_t sort(compar_r_t cmp, void* state);
-
-protected:
- size_t itemSize() const;
- void release_storage();
-
- virtual void do_construct(void* storage, size_t num) const = 0;
- virtual void do_destroy(void* storage, size_t num) const = 0;
- virtual void do_copy(void* dest, const void* from, size_t num) const = 0;
- virtual void do_splat(void* dest, const void* item, size_t num) const = 0;
- virtual void do_move_forward(void* dest, const void* from, size_t num) const = 0;
- virtual void do_move_backward(void* dest, const void* from, size_t num) const = 0;
-
- // take care of FBC...
- virtual void reservedVectorImpl1();
- virtual void reservedVectorImpl2();
- virtual void reservedVectorImpl3();
- virtual void reservedVectorImpl4();
- virtual void reservedVectorImpl5();
- virtual void reservedVectorImpl6();
- virtual void reservedVectorImpl7();
- virtual void reservedVectorImpl8();
-
-private:
- void* _grow(size_t where, size_t amount);
- void _shrink(size_t where, size_t amount);
-
- inline void _do_construct(void* storage, size_t num) const;
- inline void _do_destroy(void* storage, size_t num) const;
- inline void _do_copy(void* dest, const void* from, size_t num) const;
- inline void _do_splat(void* dest, const void* item, size_t num) const;
- inline void _do_move_forward(void* dest, const void* from, size_t num) const;
- inline void _do_move_backward(void* dest, const void* from, size_t num) const;
-
- // These 2 fields are exposed in the inlines below,
- // so they're set in stone.
- void * mStorage; // base address of the vector
- size_t mCount; // number of items
-
- const uint32_t mFlags;
- const size_t mItemSize;
-};
-
-
-
-class SortedVectorImpl : public VectorImpl
-{
-public:
- SortedVectorImpl(size_t itemSize, uint32_t flags);
- SortedVectorImpl(const VectorImpl& rhs);
- virtual ~SortedVectorImpl();
-
- SortedVectorImpl& operator = (const SortedVectorImpl& rhs);
-
- //! finds the index of an item
- ssize_t indexOf(const void* item) const;
-
- //! finds where this item should be inserted
- size_t orderOf(const void* item) const;
-
- //! add an item in the right place (or replaces it if there is one)
- ssize_t add(const void* item);
-
- //! merges a vector into this one
- ssize_t merge(const VectorImpl& vector);
- ssize_t merge(const SortedVectorImpl& vector);
-
- //! removes an item
- ssize_t remove(const void* item);
-
-protected:
- virtual int do_compare(const void* lhs, const void* rhs) const = 0;
-
- // take care of FBC...
- virtual void reservedSortedVectorImpl1();
- virtual void reservedSortedVectorImpl2();
- virtual void reservedSortedVectorImpl3();
- virtual void reservedSortedVectorImpl4();
- virtual void reservedSortedVectorImpl5();
- virtual void reservedSortedVectorImpl6();
- virtual void reservedSortedVectorImpl7();
- virtual void reservedSortedVectorImpl8();
-
-private:
- ssize_t _indexOrderOf(const void* item, size_t* order = 0) const;
-
- // these are made private, because they can't be used on a SortedVector
- // (they don't have an implementation either)
- ssize_t add();
- void pop();
- void push();
- void push(const void* item);
- ssize_t insertVectorAt(const VectorImpl& vector, size_t index);
- ssize_t appendVector(const VectorImpl& vector);
- ssize_t insertArrayAt(const void* array, size_t index, size_t length);
- ssize_t appendArray(const void* array, size_t length);
- ssize_t insertAt(size_t where, size_t numItems = 1);
- ssize_t insertAt(const void* item, size_t where, size_t numItems = 1);
- ssize_t replaceAt(size_t index);
- ssize_t replaceAt(const void* item, size_t index);
-};
-
-}; // namespace android
-
-
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_VECTOR_IMPL_H
diff --git a/include/utils/ashmem.h b/include/utils/ashmem.h
deleted file mode 100644
index 0854775..0000000
--- a/include/utils/ashmem.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* utils/ashmem.h
- **
- ** Copyright 2008 The Android Open Source Project
- **
- ** This file is dual licensed. It may be redistributed and/or modified
- ** under the terms of the Apache 2.0 License OR version 2 of the GNU
- ** General Public License.
- */
-
-#ifndef _UTILS_ASHMEM_H
-#define _UTILS_ASHMEM_H
-
-#include <linux/limits.h>
-#include <linux/ioctl.h>
-
-#define ASHMEM_NAME_LEN 256
-
-#define ASHMEM_NAME_DEF "dev/ashmem"
-
-/* Return values from ASHMEM_PIN: Was the mapping purged while unpinned? */
-#define ASHMEM_NOT_REAPED 0
-#define ASHMEM_WAS_REAPED 1
-
-/* Return values from ASHMEM_UNPIN: Is the mapping now pinned or unpinned? */
-#define ASHMEM_NOW_UNPINNED 0
-#define ASHMEM_NOW_PINNED 1
-
-#define __ASHMEMIOC 0x77
-
-#define ASHMEM_SET_NAME _IOW(__ASHMEMIOC, 1, char[ASHMEM_NAME_LEN])
-#define ASHMEM_GET_NAME _IOR(__ASHMEMIOC, 2, char[ASHMEM_NAME_LEN])
-#define ASHMEM_SET_SIZE _IOW(__ASHMEMIOC, 3, size_t)
-#define ASHMEM_GET_SIZE _IO(__ASHMEMIOC, 4)
-#define ASHMEM_SET_PROT_MASK _IOW(__ASHMEMIOC, 5, unsigned long)
-#define ASHMEM_GET_PROT_MASK _IO(__ASHMEMIOC, 6)
-#define ASHMEM_PIN _IO(__ASHMEMIOC, 7)
-#define ASHMEM_UNPIN _IO(__ASHMEMIOC, 8)
-#define ASHMEM_ISPINNED _IO(__ASHMEMIOC, 9)
-#define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10)
-
-#endif /* _UTILS_ASHMEM_H */
diff --git a/include/utils/misc.h b/include/utils/misc.h
deleted file mode 100644
index 23f2a4c..0000000
--- a/include/utils/misc.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2005 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.
- */
-
-//
-// Handy utility functions and portability code.
-//
-#ifndef _LIBS_UTILS_MISC_H
-#define _LIBS_UTILS_MISC_H
-
-#include <sys/time.h>
-#include <utils/Endian.h>
-
-namespace android {
-
-/* get #of elements in a static array */
-#ifndef NELEM
-# define NELEM(x) ((int) (sizeof(x) / sizeof((x)[0])))
-#endif
-
-/*
- * Make a copy of the string, using "new[]" instead of "malloc". Free the
- * string with delete[].
- *
- * Returns NULL if "str" is NULL.
- */
-char* strdupNew(const char* str);
-
-/*
- * Concatenate an argument vector into a single string. If argc is >= 0
- * it will be used; if it's < 0 then the last element in the arg vector
- * must be NULL.
- *
- * This inserts a space between each argument.
- *
- * This does not automatically add double quotes around arguments with
- * spaces in them. This practice is necessary for Win32, because Win32's
- * CreateProcess call is stupid.
- *
- * The caller should delete[] the returned string.
- */
-char* concatArgv(int argc, const char* const argv[]);
-
-/*
- * Count up the number of arguments in "argv". The count does not include
- * the final NULL entry.
- */
-int countArgv(const char* const argv[]);
-
-/*
- * Some utility functions for working with files. These could be made
- * part of a "File" class.
- */
-typedef enum FileType {
- kFileTypeUnknown = 0,
- kFileTypeNonexistent, // i.e. ENOENT
- kFileTypeRegular,
- kFileTypeDirectory,
- kFileTypeCharDev,
- kFileTypeBlockDev,
- kFileTypeFifo,
- kFileTypeSymlink,
- kFileTypeSocket,
-} FileType;
-/* get the file's type; follows symlinks */
-FileType getFileType(const char* fileName);
-/* get the file's modification date; returns -1 w/errno set on failure */
-time_t getFileModDate(const char* fileName);
-
-/*
- * Round up to the nearest power of 2. Handy for hash tables.
- */
-unsigned int roundUpPower2(unsigned int val);
-
-void strreverse(char* begin, char* end);
-void k_itoa(int value, char* str, int base);
-char* itoa(int val, int base);
-
-}; // namespace android
-
-#endif // _LIBS_UTILS_MISC_H
diff --git a/include/utils/threads.h b/include/utils/threads.h
deleted file mode 100644
index 9de3382..0000000
--- a/include/utils/threads.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2007 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 _LIBS_UTILS_THREADS_H
-#define _LIBS_UTILS_THREADS_H
-
-/*
- * Please, DO NOT USE!
- *
- * This file is here only for legacy reasons. Instead, include directly
- * the headers you need below.
- *
- */
-
-#include <utils/AndroidThreads.h>
-
-#ifdef __cplusplus
-#include <utils/Condition.h>
-#include <utils/Errors.h>
-#include <utils/Mutex.h>
-#include <utils/RWLock.h>
-#include <utils/Thread.h>
-#endif
-
-#endif // _LIBS_UTILS_THREADS_H