diff options
Diffstat (limited to 'include')
52 files changed, 147 insertions, 382 deletions
diff --git a/include/android_runtime/AndroidRuntime.h b/include/android_runtime/AndroidRuntime.h index 78bef91e8595..99ab2f0b733e 100644 --- a/include/android_runtime/AndroidRuntime.h +++ b/include/android_runtime/AndroidRuntime.h @@ -20,7 +20,7 @@ #define _RUNTIME_ANDROID_RUNTIME_H #include <utils/Errors.h> -#include <utils/IBinder.h> +#include <binder/IBinder.h> #include <utils/String8.h> #include <utils/String16.h> #include <utils/Vector.h> @@ -98,6 +98,7 @@ public: private: static int startReg(JNIEnv* env); + int startVm(JavaVM** pJavaVM, JNIEnv** pEnv); Vector<JavaVMOption> mOptions; diff --git a/include/utils/Binder.h b/include/binder/Binder.h index b5b8d98513d6..47b2bb9b2cff 100644 --- a/include/utils/Binder.h +++ b/include/binder/Binder.h @@ -17,7 +17,7 @@ #ifndef ANDROID_BINDER_H #define ANDROID_BINDER_H -#include <utils/IBinder.h> +#include <binder/IBinder.h> // --------------------------------------------------------------------------- namespace android { @@ -27,7 +27,7 @@ class BBinder : public IBinder public: BBinder(); - virtual String16 getInterfaceDescriptor() const; + virtual const String16& getInterfaceDescriptor() const; virtual bool isBinderAlive() const; virtual status_t pingBinder(); virtual status_t dump(int fd, const Vector<String16>& args); @@ -71,6 +71,7 @@ private: Extras* mExtras; void* mReserved0; + static String16 sEmptyDescriptor; }; // --------------------------------------------------------------------------- diff --git a/include/utils/BpBinder.h b/include/binder/BpBinder.h index 7b96e296f2ec..7ef93aa39041 100644 --- a/include/utils/BpBinder.h +++ b/include/binder/BpBinder.h @@ -17,7 +17,7 @@ #ifndef ANDROID_BPBINDER_H #define ANDROID_BPBINDER_H -#include <utils/IBinder.h> +#include <binder/IBinder.h> #include <utils/KeyedVector.h> #include <utils/threads.h> @@ -31,7 +31,7 @@ public: inline int32_t handle() const { return mHandle; } - virtual String16 getInterfaceDescriptor() const; + virtual const String16& getInterfaceDescriptor() const; virtual bool isBinderAlive() const; virtual status_t pingBinder(); virtual status_t dump(int fd, const Vector<String16>& args); @@ -106,6 +106,7 @@ private: }; void reportOneDeath(const Obituary& obit); + bool isDescriptorCached() const; mutable Mutex mLock; volatile int32_t mAlive; @@ -113,6 +114,7 @@ private: Vector<Obituary>* mObituaries; ObjectManager mObjects; Parcel* mConstantData; + mutable String16 mDescriptorCache; }; }; // namespace android diff --git a/include/utils/IBinder.h b/include/binder/IBinder.h index 737033090f4e..884b5c123739 100644 --- a/include/utils/IBinder.h +++ b/include/binder/IBinder.h @@ -56,7 +56,7 @@ public: FLAG_ONEWAY = 0x00000001 }; - inline IBinder() { } + IBinder(); /** * Check if this IBinder implements the interface named by @@ -69,7 +69,7 @@ public: * Return the canonical name of the interface provided by this IBinder * object. */ - virtual String16 getInterfaceDescriptor() const = 0; + virtual const String16& getInterfaceDescriptor() const = 0; virtual bool isBinderAlive() const = 0; virtual status_t pingBinder() = 0; @@ -147,7 +147,7 @@ public: virtual BpBinder* remoteBinder(); protected: - inline virtual ~IBinder() { } + virtual ~IBinder(); private: }; diff --git a/include/utils/IInterface.h b/include/binder/IInterface.h index 959722a4d8af..273d92231fe2 100644 --- a/include/utils/IInterface.h +++ b/include/binder/IInterface.h @@ -18,7 +18,7 @@ #ifndef ANDROID_IINTERFACE_H #define ANDROID_IINTERFACE_H -#include <utils/Binder.h> +#include <binder/Binder.h> namespace android { @@ -27,10 +27,12 @@ namespace android { class IInterface : public virtual RefBase { public: + IInterface(); sp<IBinder> asBinder(); sp<const IBinder> asBinder() const; - + protected: + virtual ~IInterface(); virtual IBinder* onAsBinder() = 0; }; @@ -49,7 +51,7 @@ class BnInterface : public INTERFACE, public BBinder { public: virtual sp<IInterface> queryLocalInterface(const String16& _descriptor); - virtual String16 getInterfaceDescriptor() const; + virtual const String16& getInterfaceDescriptor() const; protected: virtual IBinder* onAsBinder(); @@ -72,11 +74,14 @@ protected: #define DECLARE_META_INTERFACE(INTERFACE) \ static const String16 descriptor; \ static sp<I##INTERFACE> asInterface(const sp<IBinder>& obj); \ - virtual String16 getInterfaceDescriptor() const; \ + virtual const String16& getInterfaceDescriptor() const; \ + I##INTERFACE(); \ + virtual ~I##INTERFACE(); \ + #define IMPLEMENT_META_INTERFACE(INTERFACE, NAME) \ const String16 I##INTERFACE::descriptor(NAME); \ - String16 I##INTERFACE::getInterfaceDescriptor() const { \ + const String16& I##INTERFACE::getInterfaceDescriptor() const { \ return I##INTERFACE::descriptor; \ } \ sp<I##INTERFACE> I##INTERFACE::asInterface(const sp<IBinder>& obj) \ @@ -92,9 +97,16 @@ protected: } \ 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-servicable parts after this... +// No user-serviceable parts after this... template<typename INTERFACE> inline sp<IInterface> BnInterface<INTERFACE>::queryLocalInterface( @@ -105,7 +117,7 @@ inline sp<IInterface> BnInterface<INTERFACE>::queryLocalInterface( } template<typename INTERFACE> -inline String16 BnInterface<INTERFACE>::getInterfaceDescriptor() const +inline const String16& BnInterface<INTERFACE>::getInterfaceDescriptor() const { return INTERFACE::getInterfaceDescriptor(); } diff --git a/include/utils/IMemory.h b/include/binder/IMemory.h index 35a3fd7da203..ae042cba5592 100644 --- a/include/utils/IMemory.h +++ b/include/binder/IMemory.h @@ -23,7 +23,7 @@ #include <utils/RefBase.h> #include <utils/Errors.h> -#include <utils/IInterface.h> +#include <binder/IInterface.h> namespace android { @@ -59,6 +59,10 @@ public: const Parcel& data, Parcel* reply, uint32_t flags = 0); + + BnMemoryHeap(); +protected: + virtual ~BnMemoryHeap(); }; // ---------------------------------------------------------------------------- @@ -85,6 +89,10 @@ public: const Parcel& data, Parcel* reply, uint32_t flags = 0); + + BnMemory(); +protected: + virtual ~BnMemory(); }; // ---------------------------------------------------------------------------- diff --git a/include/utils/IPCThreadState.h b/include/binder/IPCThreadState.h index 0490fd3ec206..78306b2b90e0 100644 --- a/include/utils/IPCThreadState.h +++ b/include/binder/IPCThreadState.h @@ -18,8 +18,8 @@ #define ANDROID_IPC_THREAD_STATE_H #include <utils/Errors.h> -#include <utils/Parcel.h> -#include <utils/ProcessState.h> +#include <binder/Parcel.h> +#include <binder/ProcessState.h> #include <utils/Vector.h> #ifdef HAVE_WIN32_PROC diff --git a/include/utils/IPermissionController.h b/include/binder/IPermissionController.h index cb1dd345d764..f9d371bd1582 100644 --- a/include/utils/IPermissionController.h +++ b/include/binder/IPermissionController.h @@ -18,7 +18,7 @@ #ifndef ANDROID_IPERMISSION_CONTROLLER_H #define ANDROID_IPERMISSION_CONTROLLER_H -#include <utils/IInterface.h> +#include <binder/IInterface.h> namespace android { diff --git a/include/utils/IServiceManager.h b/include/binder/IServiceManager.h index e3d99fe7effd..ea149ddaabea 100644 --- a/include/utils/IServiceManager.h +++ b/include/binder/IServiceManager.h @@ -18,8 +18,8 @@ #ifndef ANDROID_ISERVICE_MANAGER_H #define ANDROID_ISERVICE_MANAGER_H -#include <utils/IInterface.h> -#include <utils/IPermissionController.h> +#include <binder/IInterface.h> +#include <binder/IPermissionController.h> #include <utils/Vector.h> #include <utils/String16.h> diff --git a/include/utils/MemoryBase.h b/include/binder/MemoryBase.h index eb5a9d275a10..463e26d9772f 100644 --- a/include/utils/MemoryBase.h +++ b/include/binder/MemoryBase.h @@ -20,7 +20,7 @@ #include <stdlib.h> #include <stdint.h> -#include <utils/IMemory.h> +#include <binder/IMemory.h> namespace android { diff --git a/include/utils/MemoryDealer.h b/include/binder/MemoryDealer.h index 454b6270e4bd..d05755606bd6 100644 --- a/include/utils/MemoryDealer.h +++ b/include/binder/MemoryDealer.h @@ -21,9 +21,9 @@ #include <stdint.h> #include <sys/types.h> -#include <utils/IMemory.h> +#include <binder/IMemory.h> #include <utils/threads.h> -#include <utils/MemoryHeapBase.h> +#include <binder/MemoryHeapBase.h> namespace android { // ---------------------------------------------------------------------------- @@ -39,6 +39,10 @@ class HeapInterface : public virtual BnMemoryHeap public: // all values must be page-aligned virtual sp<IMemory> mapMemory(size_t offset, size_t size) = 0; + + HeapInterface(); +protected: + virtual ~HeapInterface(); }; // ---------------------------------------------------------------------------- @@ -61,6 +65,10 @@ public: virtual void dump(const char* what, uint32_t flags = 0) const = 0; virtual void dump(String8& res, const char* what, uint32_t flags = 0) const = 0; + + AllocatorInterface(); +protected: + virtual ~AllocatorInterface(); }; // ---------------------------------------------------------------------------- @@ -71,6 +79,7 @@ public: class SharedHeap : public HeapInterface, public MemoryHeapBase { public: + SharedHeap(); SharedHeap(size_t size, uint32_t flags = 0, char const * name = NULL); virtual ~SharedHeap(); virtual sp<IMemory> mapMemory(size_t offset, size_t size); diff --git a/include/utils/MemoryHeapBase.h b/include/binder/MemoryHeapBase.h index 574acf4f9ff8..83c72835e240 100644 --- a/include/utils/MemoryHeapBase.h +++ b/include/binder/MemoryHeapBase.h @@ -20,7 +20,7 @@ #include <stdlib.h> #include <stdint.h> -#include <utils/IMemory.h> +#include <binder/IMemory.h> namespace android { diff --git a/include/utils/MemoryHeapPmem.h b/include/binder/MemoryHeapPmem.h index 60335adaef74..dbf26ff1ffc6 100644 --- a/include/utils/MemoryHeapPmem.h +++ b/include/binder/MemoryHeapPmem.h @@ -20,9 +20,9 @@ #include <stdlib.h> #include <stdint.h> -#include <utils/MemoryDealer.h> -#include <utils/MemoryHeapBase.h> -#include <utils/IMemory.h> +#include <binder/MemoryDealer.h> +#include <binder/MemoryHeapBase.h> +#include <binder/IMemory.h> #include <utils/SortedVector.h> namespace android { diff --git a/include/utils/Parcel.h b/include/binder/Parcel.h index af1490a02973..58c2d9ad76da 100644 --- a/include/utils/Parcel.h +++ b/include/binder/Parcel.h @@ -57,7 +57,8 @@ public: status_t writeInterfaceToken(const String16& interface); bool enforceInterface(const String16& interface) const; - + bool checkInterface(IBinder*) const; + void freeData(); const size_t* objects() const; @@ -147,7 +148,7 @@ public: release_func relFunc, void* relCookie); void print(TextOutput& to, uint32_t flags = 0) const; - + private: Parcel(const Parcel& o); Parcel& operator=(const Parcel& o); diff --git a/include/utils/ProcessState.h b/include/binder/ProcessState.h index 39584f42c7f4..feeb3c389126 100644 --- a/include/utils/ProcessState.h +++ b/include/binder/ProcessState.h @@ -17,7 +17,7 @@ #ifndef ANDROID_PROCESS_STATE_H #define ANDROID_PROCESS_STATE_H -#include <utils/IBinder.h> +#include <binder/IBinder.h> #include <utils/KeyedVector.h> #include <utils/String8.h> #include <utils/String16.h> diff --git a/include/media/AudioRecord.h b/include/media/AudioRecord.h index 3694803cecae..106807e5217e 100644 --- a/include/media/AudioRecord.h +++ b/include/media/AudioRecord.h @@ -26,8 +26,8 @@ #include <utils/RefBase.h> #include <utils/Errors.h> -#include <utils/IInterface.h> -#include <utils/IMemory.h> +#include <binder/IInterface.h> +#include <binder/IMemory.h> #include <utils/threads.h> diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h index ba0467c1603c..0955819a2c3d 100644 --- a/include/media/AudioTrack.h +++ b/include/media/AudioTrack.h @@ -26,8 +26,8 @@ #include <utils/RefBase.h> #include <utils/Errors.h> -#include <utils/IInterface.h> -#include <utils/IMemory.h> +#include <binder/IInterface.h> +#include <binder/IMemory.h> #include <utils/threads.h> diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h index 3e59d856085d..bac3d29f2d42 100644 --- a/include/media/IAudioFlinger.h +++ b/include/media/IAudioFlinger.h @@ -23,7 +23,7 @@ #include <utils/RefBase.h> #include <utils/Errors.h> -#include <utils/IInterface.h> +#include <binder/IInterface.h> #include <media/IAudioTrack.h> #include <media/IAudioRecord.h> #include <media/IAudioFlingerClient.h> diff --git a/include/media/IAudioFlingerClient.h b/include/media/IAudioFlingerClient.h index c3deb0b4e8f2..383ec0c7a519 100644 --- a/include/media/IAudioFlingerClient.h +++ b/include/media/IAudioFlingerClient.h @@ -19,7 +19,7 @@ #include <utils/RefBase.h> -#include <utils/IInterface.h> +#include <binder/IInterface.h> namespace android { diff --git a/include/media/IAudioRecord.h b/include/media/IAudioRecord.h index 9d45d2d9ac25..46735def2f52 100644 --- a/include/media/IAudioRecord.h +++ b/include/media/IAudioRecord.h @@ -22,8 +22,8 @@ #include <utils/RefBase.h> #include <utils/Errors.h> -#include <utils/IInterface.h> -#include <utils/IMemory.h> +#include <binder/IInterface.h> +#include <binder/IMemory.h> namespace android { diff --git a/include/media/IAudioTrack.h b/include/media/IAudioTrack.h index 12f2111110e4..de6426af0069 100644 --- a/include/media/IAudioTrack.h +++ b/include/media/IAudioTrack.h @@ -22,8 +22,8 @@ #include <utils/RefBase.h> #include <utils/Errors.h> -#include <utils/IInterface.h> -#include <utils/IMemory.h> +#include <binder/IInterface.h> +#include <binder/IMemory.h> namespace android { diff --git a/include/media/IMediaMetadataRetriever.h b/include/media/IMediaMetadataRetriever.h index c677e83ff749..9baba8e8fdbd 100644 --- a/include/media/IMediaMetadataRetriever.h +++ b/include/media/IMediaMetadataRetriever.h @@ -19,9 +19,9 @@ #define ANDROID_IMEDIAMETADATARETRIEVER_H #include <utils/RefBase.h> -#include <utils/IInterface.h> -#include <utils/Parcel.h> -#include <utils/IMemory.h> +#include <binder/IInterface.h> +#include <binder/Parcel.h> +#include <binder/IMemory.h> namespace android { diff --git a/include/media/IMediaPlayer.h b/include/media/IMediaPlayer.h index a683e74d3883..2c4bc2aea915 100644 --- a/include/media/IMediaPlayer.h +++ b/include/media/IMediaPlayer.h @@ -18,8 +18,8 @@ #define ANDROID_IMEDIAPLAYER_H #include <utils/RefBase.h> -#include <utils/IInterface.h> -#include <utils/Parcel.h> +#include <binder/IInterface.h> +#include <binder/Parcel.h> namespace android { diff --git a/include/media/IMediaPlayerClient.h b/include/media/IMediaPlayerClient.h index 5d3281103fd7..eee6c9762f08 100644 --- a/include/media/IMediaPlayerClient.h +++ b/include/media/IMediaPlayerClient.h @@ -18,8 +18,8 @@ #define ANDROID_IMEDIAPLAYERCLIENT_H #include <utils/RefBase.h> -#include <utils/IInterface.h> -#include <utils/Parcel.h> +#include <binder/IInterface.h> +#include <binder/Parcel.h> namespace android { diff --git a/include/media/IMediaPlayerService.h b/include/media/IMediaPlayerService.h index 8125cc96dfc8..469098cc10ab 100644 --- a/include/media/IMediaPlayerService.h +++ b/include/media/IMediaPlayerService.h @@ -18,8 +18,8 @@ #define ANDROID_IMEDIAPLAYERSERVICE_H #include <utils/RefBase.h> -#include <utils/IInterface.h> -#include <utils/Parcel.h> +#include <binder/IInterface.h> +#include <binder/Parcel.h> #include <media/IMediaPlayerClient.h> #include <media/IMediaPlayer.h> diff --git a/include/media/IMediaRecorder.h b/include/media/IMediaRecorder.h index 64d3a40a3097..24ac82b23771 100644 --- a/include/media/IMediaRecorder.h +++ b/include/media/IMediaRecorder.h @@ -18,7 +18,7 @@ #ifndef ANDROID_IMEDIARECORDER_H #define ANDROID_IMEDIARECORDER_H -#include <utils/IInterface.h> +#include <binder/IInterface.h> namespace android { diff --git a/include/media/mediametadataretriever.h b/include/media/mediametadataretriever.h index f2719d33ba99..3db8a0f76a2b 100644 --- a/include/media/mediametadataretriever.h +++ b/include/media/mediametadataretriever.h @@ -20,7 +20,7 @@ #include <utils/Errors.h> // for status_t #include <utils/threads.h> -#include <utils/IMemory.h> +#include <binder/IMemory.h> #include <media/IMediaMetadataRetriever.h> namespace android { diff --git a/include/media/mediaplayer.h b/include/media/mediaplayer.h index 255a67b0d84a..704a8cb40454 100644 --- a/include/media/mediaplayer.h +++ b/include/media/mediaplayer.h @@ -17,7 +17,7 @@ #ifndef ANDROID_MEDIAPLAYER_H #define ANDROID_MEDIAPLAYER_H -#include <utils/IMemory.h> +#include <binder/IMemory.h> #include <ui/Surface.h> #include <media/IMediaPlayerClient.h> #include <media/IMediaPlayer.h> diff --git a/include/media/mediarecorder.h b/include/media/mediarecorder.h index aebe1918ca66..755552115642 100644 --- a/include/media/mediarecorder.h +++ b/include/media/mediarecorder.h @@ -18,7 +18,10 @@ #ifndef ANDROID_MEDIARECORDER_H #define ANDROID_MEDIARECORDER_H -#include <utils.h> +#include <utils/Log.h> +#include <utils/threads.h> +#include <utils/List.h> +#include <utils/Errors.h> #include <media/IMediaPlayerClient.h> namespace android { diff --git a/include/media/mediascanner.h b/include/media/mediascanner.h index fbef1dbde6c2..77495666f538 100644 --- a/include/media/mediascanner.h +++ b/include/media/mediascanner.h @@ -17,7 +17,10 @@ #ifndef MEDIASCANNER_H #define MEDIASCANNER_H -#include <utils.h> +#include <utils/Log.h> +#include <utils/threads.h> +#include <utils/List.h> +#include <utils/Errors.h> #include <pthread.h> namespace android { diff --git a/include/utils/executablepath.h b/include/private/binder/Static.h index c979432ba2e8..5b0f9fc65269 100644 --- a/include/utils/executablepath.h +++ b/include/private/binder/Static.h @@ -14,15 +14,26 @@ * limitations under the License. */ -#ifndef _UTILS_EXECUTABLEPATH_H -#define _UTILS_EXECUTABLEPATH_H +// All static variables go here, to control initialization and +// destruction order in the library. -#include <limits.h> +#include <utils/threads.h> -// returns the path to this executable -#if __cplusplus -extern "C" -#endif -void executablepath(char s[PATH_MAX]); +#include <binder/IBinder.h> +#include <binder/IMemory.h> +#include <binder/ProcessState.h> +#include <binder/IPermissionController.h> +#include <binder/IServiceManager.h> -#endif // _UTILS_EXECUTABLEPATH_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/utils/binder_module.h b/include/private/binder/binder_module.h index fdf327e1c5d3..fdf327e1c5d3 100644 --- a/include/private/utils/binder_module.h +++ b/include/private/binder/binder_module.h diff --git a/include/private/utils/Static.h b/include/private/utils/Static.h index f1439b75dc81..d95ae0d3ce24 100644 --- a/include/private/utils/Static.h +++ b/include/private/utils/Static.h @@ -20,14 +20,6 @@ #include <utils/threads.h> #include <utils/KeyedVector.h> -#ifndef LIBUTILS_NATIVE -#include <utils/IBinder.h> -#include <utils/IMemory.h> -#include <utils/ProcessState.h> -#include <utils/IPermissionController.h> -#include <utils/IServiceManager.h> -#endif - namespace android { // For TextStream.cpp extern Vector<int32_t> gTextBuffers; @@ -40,19 +32,4 @@ extern void terminate_string8(); extern void initialize_string16(); extern void terminate_string16(); - - -#ifndef LIBUTILS_NATIVE - -// For ProcessState.cpp -extern Mutex gProcessMutex; -extern sp<ProcessState> gProcess; - -// For ServiceManager.cpp -extern Mutex gDefaultServiceManagerLock; -extern sp<IServiceManager> gDefaultServiceManager; -extern sp<IPermissionController> gPermissionController; - -#endif - } // namespace android diff --git a/include/ui/CameraHardwareInterface.h b/include/ui/CameraHardwareInterface.h index 73036f0fa783..2cdcc06abef6 100644 --- a/include/ui/CameraHardwareInterface.h +++ b/include/ui/CameraHardwareInterface.h @@ -17,7 +17,7 @@ #ifndef ANDROID_HARDWARE_CAMERA_HARDWARE_INTERFACE_H #define ANDROID_HARDWARE_CAMERA_HARDWARE_INTERFACE_H -#include <utils/IMemory.h> +#include <binder/IMemory.h> #include <utils/RefBase.h> #include <ui/CameraParameters.h> #include <ui/Overlay.h> diff --git a/include/ui/EventHub.h b/include/ui/EventHub.h index 3848d8c3bdc0..e12c4f13ea0d 100644 --- a/include/ui/EventHub.h +++ b/include/ui/EventHub.h @@ -20,7 +20,10 @@ #include <utils/String8.h> #include <utils/threads.h> -#include <utils.h> +#include <utils/Log.h> +#include <utils/threads.h> +#include <utils/List.h> +#include <utils/Errors.h> #include <linux/input.h> diff --git a/include/ui/ICamera.h b/include/ui/ICamera.h index 241fb632616f..1df791404156 100644 --- a/include/ui/ICamera.h +++ b/include/ui/ICamera.h @@ -18,10 +18,10 @@ #define ANDROID_HARDWARE_ICAMERA_H #include <utils/RefBase.h> -#include <utils/IInterface.h> -#include <utils/Parcel.h> +#include <binder/IInterface.h> +#include <binder/Parcel.h> #include <ui/ISurface.h> -#include <utils/IMemory.h> +#include <binder/IMemory.h> #include <utils/String8.h> #include <ui/Camera.h> diff --git a/include/ui/ICameraClient.h b/include/ui/ICameraClient.h index c4bdd0758575..f38a6aad9078 100644 --- a/include/ui/ICameraClient.h +++ b/include/ui/ICameraClient.h @@ -18,9 +18,9 @@ #define ANDROID_HARDWARE_ICAMERA_APP_H #include <utils/RefBase.h> -#include <utils/IInterface.h> -#include <utils/Parcel.h> -#include <utils/IMemory.h> +#include <binder/IInterface.h> +#include <binder/Parcel.h> +#include <binder/IMemory.h> namespace android { diff --git a/include/ui/ICameraService.h b/include/ui/ICameraService.h index c652c5169a0a..061681aa1f58 100644 --- a/include/ui/ICameraService.h +++ b/include/ui/ICameraService.h @@ -18,8 +18,8 @@ #define ANDROID_HARDWARE_ICAMERASERVICE_H #include <utils/RefBase.h> -#include <utils/IInterface.h> -#include <utils/Parcel.h> +#include <binder/IInterface.h> +#include <binder/Parcel.h> #include <ui/ICameraClient.h> #include <ui/ICamera.h> diff --git a/include/ui/IOverlay.h b/include/ui/IOverlay.h index 699b1b063ff2..af3add10d958 100644 --- a/include/ui/IOverlay.h +++ b/include/ui/IOverlay.h @@ -21,7 +21,7 @@ #include <sys/types.h> #include <utils/Errors.h> -#include <utils/IInterface.h> +#include <binder/IInterface.h> #include <utils/RefBase.h> #include <ui/PixelFormat.h> diff --git a/include/ui/ISurface.h b/include/ui/ISurface.h index 87b320f431b8..136e801e2e94 100644 --- a/include/ui/ISurface.h +++ b/include/ui/ISurface.h @@ -21,7 +21,7 @@ #include <sys/types.h> #include <utils/Errors.h> -#include <utils/IInterface.h> +#include <binder/IInterface.h> #include <utils/RefBase.h> #include <ui/PixelFormat.h> diff --git a/include/ui/ISurfaceComposer.h b/include/ui/ISurfaceComposer.h index 5c64b222bc5d..5b062a87f395 100644 --- a/include/ui/ISurfaceComposer.h +++ b/include/ui/ISurfaceComposer.h @@ -22,7 +22,7 @@ #include <utils/RefBase.h> #include <utils/Errors.h> -#include <utils/IInterface.h> +#include <binder/IInterface.h> #include <ui/PixelFormat.h> #include <ui/ISurfaceFlingerClient.h> diff --git a/include/ui/ISurfaceFlingerClient.h b/include/ui/ISurfaceFlingerClient.h index 5b9361d5d636..b6cbb0b80b68 100644 --- a/include/ui/ISurfaceFlingerClient.h +++ b/include/ui/ISurfaceFlingerClient.h @@ -21,7 +21,7 @@ #include <sys/types.h> #include <utils/Errors.h> -#include <utils/IInterface.h> +#include <binder/IInterface.h> #include <utils/RefBase.h> #include <ui/ISurface.h> diff --git a/include/ui/Overlay.h b/include/ui/Overlay.h index 66514b44ab9f..9ba2f7b6fd1c 100644 --- a/include/ui/Overlay.h +++ b/include/ui/Overlay.h @@ -21,7 +21,7 @@ #include <sys/types.h> #include <utils/Errors.h> -#include <utils/IInterface.h> +#include <binder/IInterface.h> #include <utils/RefBase.h> #include <utils/threads.h> diff --git a/include/ui/Region.h b/include/ui/Region.h index 76896737f293..68cb52ed35ff 100644 --- a/include/ui/Region.h +++ b/include/ui/Region.h @@ -21,7 +21,7 @@ #include <sys/types.h> #include <utils/Vector.h> -#include <utils/Parcel.h> +#include <binder/Parcel.h> #include <ui/Rect.h> diff --git a/include/utils.h b/include/utils.h deleted file mode 100644 index 30648b185150..000000000000 --- a/include/utils.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. - */ - -// -// Handy utility functions and portability code. This file includes all -// of the generally-useful headers in the "utils" directory. -// -#ifndef _LIBS_UTILS_H -#define _LIBS_UTILS_H - -#include <utils/ported.h> -#include <utils/Log.h> -#include <utils/threads.h> -#include <utils/Timers.h> -#include <utils/List.h> -#include <utils/string_array.h> -#include <utils/misc.h> -#include <utils/Errors.h> - -#endif // _LIBS_UTILS_H diff --git a/include/utils/Pipe.h b/include/utils/Pipe.h deleted file mode 100644 index 6404168a28c0..000000000000 --- a/include/utils/Pipe.h +++ /dev/null @@ -1,108 +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. - */ - -// -// FIFO I/O. -// -#ifndef _LIBS_UTILS_PIPE_H -#define _LIBS_UTILS_PIPE_H - -#ifdef HAVE_ANDROID_OS -#error DO NOT USE THIS FILE IN THE DEVICE BUILD -#endif - -namespace android { - -/* - * Simple anonymous unidirectional pipe. - * - * The primary goal is to create an implementation with minimal overhead - * under Linux. Making Windows, Mac OS X, and Linux all work the same way - * is a secondary goal. Part of this goal is to have something that can - * be fed to a select() call, so that the application can sleep in the - * kernel until something interesting happens. - */ -class Pipe { -public: - Pipe(void); - virtual ~Pipe(void); - - /* Create the pipe */ - bool create(void); - - /* Create a read-only pipe, using the supplied handle as read handle */ - bool createReader(unsigned long handle); - /* Create a write-only pipe, using the supplied handle as write handle */ - bool createWriter(unsigned long handle); - - /* Is this object ready to go? */ - bool isCreated(void); - - /* - * Read "count" bytes from the pipe. Returns the amount of data read, - * or 0 if no data available and we're non-blocking. - * Returns -1 on error. - */ - int read(void* buf, int count); - - /* - * Write "count" bytes into the pipe. Returns number of bytes written, - * or 0 if there's no room for more data and we're non-blocking. - * Returns -1 on error. - */ - int write(const void* buf, int count); - - /* Returns "true" if data is available to read */ - bool readReady(void); - - /* Enable or disable non-blocking I/O for reads */ - bool setReadNonBlocking(bool val); - /* Enable or disable non-blocking I/O for writes. Only works on Linux. */ - bool setWriteNonBlocking(bool val); - - /* - * Get the handle. Only useful in some platform-specific situations. - */ - unsigned long getReadHandle(void); - unsigned long getWriteHandle(void); - - /* - * Modify inheritance, i.e. whether or not a child process will get - * copies of the descriptors. Systems with fork+exec allow us to close - * the descriptors before launching the child process, but Win32 - * doesn't allow it. - */ - bool disallowReadInherit(void); - bool disallowWriteInherit(void); - - /* - * Close one side or the other. Useful in the parent after launching - * a child process. - */ - bool closeRead(void); - bool closeWrite(void); - -private: - bool mReadNonBlocking; - bool mWriteNonBlocking; - - unsigned long mReadHandle; - unsigned long mWriteHandle; -}; - -}; // android - -#endif // _LIBS_UTILS_PIPE_H diff --git a/include/utils/TextOutput.h b/include/utils/TextOutput.h index d8d86ba82cd6..de2fbbee1f2f 100644 --- a/include/utils/TextOutput.h +++ b/include/utils/TextOutput.h @@ -28,8 +28,8 @@ namespace android { class TextOutput { public: - TextOutput() { } - virtual ~TextOutput() { } + TextOutput(); + virtual ~TextOutput(); virtual status_t print(const char* txt, size_t len) = 0; virtual void moveIndent(int delta) = 0; diff --git a/include/utils/TimerProbe.h b/include/utils/TimerProbe.h deleted file mode 100644 index f2e32b21a5dd..000000000000 --- a/include/utils/TimerProbe.h +++ /dev/null @@ -1,72 +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_TIMER_PROBE_H -#define ANDROID_TIMER_PROBE_H - -#if 0 && defined(HAVE_POSIX_CLOCKS) -#define ENABLE_TIMER_PROBE 1 -#else -#define ENABLE_TIMER_PROBE 0 -#endif - -#if ENABLE_TIMER_PROBE - -#include <time.h> -#include <sys/time.h> -#include <utils/Vector.h> - -#define TIMER_PROBE(tag) \ - static int _timer_slot_; \ - android::TimerProbe probe(tag, &_timer_slot_) -#define TIMER_PROBE_END() probe.end() -#else -#define TIMER_PROBE(tag) -#define TIMER_PROBE_END() -#endif - -#if ENABLE_TIMER_PROBE -namespace android { - -class TimerProbe { -public: - TimerProbe(const char tag[], int* slot); - void end(); - ~TimerProbe(); -private: - struct Bucket { - int mStart, mReal, mProcess, mThread, mCount; - const char* mTag; - int* mSlotPtr; - int mIndent; - }; - static Vector<Bucket> gBuckets; - static TimerProbe* gExecuteChain; - static int gIndent; - static timespec gRealBase; - TimerProbe* mNext; - static uint32_t ElapsedTime(const timespec& start, const timespec& end); - void print(const timespec& r, const timespec& p, const timespec& t) const; - timespec mRealStart, mPStart, mTStart; - const char* mTag; - int mIndent; - int mBucket; -}; - -}; // namespace android - -#endif -#endif diff --git a/include/utils/Timers.h b/include/utils/Timers.h index 96103995bb4b..9a9e07c60281 100644 --- a/include/utils/Timers.h +++ b/include/utils/Timers.h @@ -88,9 +88,6 @@ nsecs_t systemTime(int clock = SYSTEM_TIME_MONOTONIC); nsecs_t systemTime(int clock); #endif // def __cplusplus -// return the system-time according to the specified clock -int sleepForInterval(long interval, struct timeval* pNextTick); - #ifdef __cplusplus } // extern "C" #endif @@ -108,15 +105,15 @@ namespace android { */ class DurationTimer { public: - DurationTimer(void) {} - ~DurationTimer(void) {} + DurationTimer() {} + ~DurationTimer() {} // Start the timer. - void start(void); + void start(); // Stop the timer. - void stop(void); + void stop(); // Get the duration in microseconds. - long long durationUsecs(void) const; + long long durationUsecs() const; // Subtract two timevals. Returns the difference (ptv1-ptv2) in // microseconds. diff --git a/include/utils/misc.h b/include/utils/misc.h index 62e84b4892d4..23f2a4c7c580 100644 --- a/include/utils/misc.h +++ b/include/utils/misc.h @@ -21,7 +21,7 @@ #define _LIBS_UTILS_MISC_H #include <sys/time.h> -#include "utils/Endian.h" +#include <utils/Endian.h> namespace android { diff --git a/include/utils/ported.h b/include/utils/ported.h deleted file mode 100644 index eb3be01e95cb..000000000000 --- a/include/utils/ported.h +++ /dev/null @@ -1,50 +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. - */ - -// -// Standard functions ported to the current platform. Note these are NOT -// in the "android" namespace. -// -#ifndef _LIBS_UTILS_PORTED_H -#define _LIBS_UTILS_PORTED_H - -#include <sys/time.h> // for timeval - -#ifdef __cplusplus -extern "C" { -#endif - -/* library replacement functions */ -#if defined(NEED_GETTIMEOFDAY) -int gettimeofday(struct timeval* tv, struct timezone* tz); -#endif -#if defined(NEED_USLEEP) -void usleep(unsigned long usec); -#endif -#if defined(NEED_PIPE) -int pipe(int filedes[2]); -#endif -#if defined(NEED_SETENV) -int setenv(const char* name, const char* value, int overwrite); -void unsetenv(const char* name); -char* getenv(const char* name); -#endif - -#ifdef __cplusplus -} -#endif - -#endif // _LIBS_UTILS_PORTED_H diff --git a/include/utils/threads.h b/include/utils/threads.h index b3209156bc3f..e0cb66423305 100644 --- a/include/utils/threads.h +++ b/include/utils/threads.h @@ -199,11 +199,11 @@ public: // constructed and released when Autolock goes out of scope. class Autolock { public: - inline Autolock(Mutex& mutex) : mpMutex(&mutex) { mutex.lock(); } - inline Autolock(Mutex* mutex) : mpMutex(mutex) { mutex->lock(); } - inline ~Autolock() { mpMutex->unlock(); } + inline Autolock(Mutex& mutex) : mLock(mutex) { mLock.lock(); } + inline Autolock(Mutex* mutex) : mLock(*mutex) { mLock.lock(); } + inline ~Autolock() { mLock.unlock(); } private: - Mutex* mpMutex; + Mutex& mLock; }; private: @@ -291,7 +291,7 @@ protected: bool exitPending() const; private: - // Derived class must implemtent threadLoop(). The thread starts its life + // 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. |