summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/binder/Binder.h3
-rw-r--r--include/binder/BpBinder.h4
-rw-r--r--include/binder/IBinder.h6
-rw-r--r--include/binder/IInterface.h24
-rw-r--r--include/binder/IMemory.h8
-rw-r--r--include/binder/MemoryDealer.h9
-rw-r--r--include/binder/Parcel.h5
-rw-r--r--include/media/AudioRecord.h19
-rw-r--r--include/media/IAudioFlinger.h2
-rw-r--r--include/media/mediarecorder.h4
-rw-r--r--include/ui/Point.h21
-rw-r--r--include/ui/Rect.h53
-rw-r--r--include/utils/TextOutput.h4
-rw-r--r--include/utils/Timers.h10
-rw-r--r--include/utils/threads.h10
15 files changed, 106 insertions, 76 deletions
diff --git a/include/binder/Binder.h b/include/binder/Binder.h
index c9b71fd48604..47b2bb9b2cff 100644
--- a/include/binder/Binder.h
+++ b/include/binder/Binder.h
@@ -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/binder/BpBinder.h b/include/binder/BpBinder.h
index 067637eaeac4..7ef93aa39041 100644
--- a/include/binder/BpBinder.h
+++ b/include/binder/BpBinder.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/binder/IBinder.h b/include/binder/IBinder.h
index 737033090f4e..884b5c123739 100644
--- a/include/binder/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/binder/IInterface.h b/include/binder/IInterface.h
index 3b1e33bda123..273d92231fe2 100644
--- a/include/binder/IInterface.h
+++ b/include/binder/IInterface.h
@@ -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/binder/IMemory.h b/include/binder/IMemory.h
index 182792cf0685..ae042cba5592 100644
--- a/include/binder/IMemory.h
+++ b/include/binder/IMemory.h
@@ -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/binder/MemoryDealer.h b/include/binder/MemoryDealer.h
index 2080ea64d1e1..6628f751b61d 100644
--- a/include/binder/MemoryDealer.h
+++ b/include/binder/MemoryDealer.h
@@ -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/binder/Parcel.h b/include/binder/Parcel.h
index af1490a02973..58c2d9ad76da 100644
--- a/include/binder/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/media/AudioRecord.h b/include/media/AudioRecord.h
index e962db6e0ce4..106807e5217e 100644
--- a/include/media/AudioRecord.h
+++ b/include/media/AudioRecord.h
@@ -39,10 +39,15 @@ class AudioRecord
{
public:
- enum stream_type {
+ // input sources values must always be defined in the range
+ // [AudioRecord::DEFAULT_INPUT, AudioRecord::NUM_INPUT_SOURCES[
+ enum input_source {
DEFAULT_INPUT =-1,
MIC_INPUT = 0,
- NUM_STREAM_TYPES
+ VOICE_UPLINK_INPUT = 1,
+ VOICE_DOWNLINK_INPUT = 2,
+ VOICE_CALL_INPUT = 3,
+ NUM_INPUT_SOURCES
};
static const int DEFAULT_SAMPLE_RATE = 8000;
@@ -118,7 +123,7 @@ public:
*
* Parameters:
*
- * streamType: Select the audio input to record to (e.g. AudioRecord::MIC_INPUT).
+ * inputSource: Select the audio input to record to (e.g. AudioRecord::MIC_INPUT).
* sampleRate: Track sampling rate in Hz.
* format: PCM sample format (e.g AudioSystem::PCM_16_BIT for signed
* 16 bits per sample).
@@ -140,7 +145,7 @@ public:
RECORD_IIR_ENABLE = AudioSystem::TX_IIR_ENABLE
};
- AudioRecord(int streamType,
+ AudioRecord(int inputSource,
uint32_t sampleRate = 0,
int format = 0,
int channelCount = 0,
@@ -165,7 +170,7 @@ public:
* - NO_INIT: audio server or audio hardware not initialized
* - PERMISSION_DENIED: recording is not allowed for the requesting process
* */
- status_t set(int streamType = 0,
+ status_t set(int inputSource = 0,
uint32_t sampleRate = 0,
int format = 0,
int channelCount = 0,
@@ -197,6 +202,7 @@ public:
int channelCount() const;
uint32_t frameCount() const;
int frameSize() const;
+ int inputSource() const;
/* After it's created the track is not active. Call start() to
@@ -323,7 +329,8 @@ private:
audio_track_cblk_t* mCblk;
uint8_t mFormat;
uint8_t mChannelCount;
- uint8_t mReserved[2];
+ uint8_t mInputSource;
+ uint8_t mReserved;
status_t mStatus;
uint32_t mLatency;
diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h
index 031335e1bf51..bac3d29f2d42 100644
--- a/include/media/IAudioFlinger.h
+++ b/include/media/IAudioFlinger.h
@@ -54,7 +54,7 @@ public:
virtual sp<IAudioRecord> openRecord(
pid_t pid,
- int streamType,
+ int inputSource,
uint32_t sampleRate,
int format,
int channelCount,
diff --git a/include/media/mediarecorder.h b/include/media/mediarecorder.h
index b9ea0c66e301..aebe1918ca66 100644
--- a/include/media/mediarecorder.h
+++ b/include/media/mediarecorder.h
@@ -35,6 +35,10 @@ typedef void (*media_completion_f)(status_t status, void *cookie);
enum audio_source {
AUDIO_SOURCE_DEFAULT = 0,
AUDIO_SOURCE_MIC = 1,
+ AUDIO_SOURCE_VOICE_UPLINK = 2,
+ AUDIO_SOURCE_VOICE_DOWNLINK = 3,
+ AUDIO_SOURCE_VOICE_CALL = 4,
+ AUDIO_SOURCE_MAX = AUDIO_SOURCE_VOICE_CALL
};
enum video_source {
diff --git a/include/ui/Point.h b/include/ui/Point.h
index dbbad1ecc208..1653120a6d13 100644
--- a/include/ui/Point.h
+++ b/include/ui/Point.h
@@ -31,12 +31,9 @@ public:
// because we want the compiler generated versions
// Default constructor doesn't initialize the Point
- inline Point()
- {
+ inline Point() {
}
-
- inline Point(int _x, int _y) : x(_x), y(_y)
- {
+ inline Point(int x, int y) : x(x), y(y) {
}
inline bool operator == (const Point& rhs) const {
@@ -57,8 +54,8 @@ public:
}
inline Point& operator - () {
- x=-x;
- y=-y;
+ x = -x;
+ y = -y;
return *this;
}
@@ -73,11 +70,13 @@ public:
return *this;
}
- Point operator + (const Point& rhs) const {
- return Point(x+rhs.x, y+rhs.y);
+ const Point operator + (const Point& rhs) const {
+ const Point result(x+rhs.x, y+rhs.y);
+ return result;
}
- Point operator - (const Point& rhs) const {
- return Point(x-rhs.x, y-rhs.y);
+ const Point operator - (const Point& rhs) const {
+ const Point result(x-rhs.x, y-rhs.y);
+ return result;
}
};
diff --git a/include/ui/Rect.h b/include/ui/Rect.h
index 902324d51198..da7294476246 100644
--- a/include/ui/Rect.h
+++ b/include/ui/Rect.h
@@ -30,36 +30,23 @@ public:
int right;
int bottom;
- typedef int value_type;
-
// we don't provide copy-ctor and operator= on purpose
// because we want the compiler generated versions
- inline Rect()
- {
+ inline Rect() {
}
-
inline Rect(int w, int h)
- : left(0), top(0), right(w), bottom(h)
- {
+ : left(0), top(0), right(w), bottom(h) {
}
-
inline Rect(int l, int t, int r, int b)
- : left(l), top(t), right(r), bottom(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)
- {
+ : 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);
@@ -84,29 +71,29 @@ public:
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
- inline Point leftTop() const {
+ Point leftTop() const {
return Point(left, top);
}
- inline Point rightBottom() const {
+ Point rightBottom() const {
return Point(right, bottom);
}
- inline Point rightTop() const {
+ Point rightTop() const {
return Point(right, top);
}
- inline Point leftBottom() const {
+ Point leftBottom() const {
return Point(left, bottom);
}
-
- inline void setLeftTop(const Point& p) {
- left = p.x;
- top = p.y;
- }
-
- inline void setRightBottom(const Point& p) {
- right = p.x;
- bottom = p.y;
- }
// comparisons
inline bool operator == (const Rect& rhs) const {
@@ -140,8 +127,8 @@ public:
Rect& operator -= (const Point& rhs) {
return offsetBy(-rhs.x, -rhs.y);
}
- Rect operator + (const Point& rhs) const;
- Rect operator - (const Point& rhs) const;
+ const Rect operator + (const Point& rhs) const;
+ const Rect operator - (const Point& rhs) const;
void translate(int dx, int dy) { // legacy, don't use.
offsetBy(dx, dy);
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/Timers.h b/include/utils/Timers.h
index 96103995bb4b..577325f5c48d 100644
--- a/include/utils/Timers.h
+++ b/include/utils/Timers.h
@@ -108,15 +108,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/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.