summaryrefslogtreecommitdiffstats
path: root/include/binder
diff options
context:
space:
mode:
Diffstat (limited to 'include/binder')
-rw-r--r--include/binder/IPCThreadState.h2
-rw-r--r--include/binder/MemoryHeapBase.h5
-rw-r--r--include/binder/Parcel.h49
-rw-r--r--include/binder/PermissionCache.h1
4 files changed, 54 insertions, 3 deletions
diff --git a/include/binder/IPCThreadState.h b/include/binder/IPCThreadState.h
index 691ba2f..3378d97 100644
--- a/include/binder/IPCThreadState.h
+++ b/include/binder/IPCThreadState.h
@@ -41,7 +41,6 @@ public:
int getCallingPid();
int getCallingUid();
- int getOrigCallingUid();
void setStrictModePolicy(int32_t policy);
int32_t getStrictModePolicy() const;
@@ -117,7 +116,6 @@ private:
status_t mLastError;
pid_t mCallingPid;
uid_t mCallingUid;
- uid_t mOrigCallingUid;
int32_t mStrictModePolicy;
int32_t mLastTransactionBinderFlags;
};
diff --git a/include/binder/MemoryHeapBase.h b/include/binder/MemoryHeapBase.h
index bbbda9c..ea9b66c 100644
--- a/include/binder/MemoryHeapBase.h
+++ b/include/binder/MemoryHeapBase.h
@@ -58,10 +58,13 @@ public:
/* implement IMemoryHeap interface */
virtual int getHeapID() const;
+
+ /* virtual address of the heap. returns MAP_FAILED in case of error */
virtual void* getBase() const;
+
virtual size_t getSize() const;
virtual uint32_t getFlags() const;
- virtual uint32_t getOffset() const;
+ virtual uint32_t getOffset() const;
const char* getDevice() const;
diff --git a/include/binder/Parcel.h b/include/binder/Parcel.h
index 33b2f00..3ff95d2 100644
--- a/include/binder/Parcel.h
+++ b/include/binder/Parcel.h
@@ -22,10 +22,12 @@
#include <utils/RefBase.h>
#include <utils/String16.h>
#include <utils/Vector.h>
+#include <utils/Flattenable.h>
// ---------------------------------------------------------------------------
namespace android {
+template <typename T> class LightFlattenable;
class Flattenable;
class IBinder;
class IPCThreadState;
@@ -102,6 +104,10 @@ public:
status_t writeWeakBinder(const wp<IBinder>& val);
status_t write(const Flattenable& val);
+ template<typename T>
+ status_t write(const LightFlattenable<T>& 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).
@@ -153,6 +159,9 @@ public:
wp<IBinder> readWeakBinder() const;
status_t read(Flattenable& val) const;
+ template<typename T>
+ status_t read(LightFlattenable<T>& 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
@@ -267,6 +276,46 @@ public:
// ---------------------------------------------------------------------------
+template<typename T>
+status_t Parcel::write(const LightFlattenable<T>& val) {
+ size_t size(val.getSize());
+ if (!val.isFixedSize()) {
+ status_t err = writeInt32(size);
+ if (err != NO_ERROR) {
+ return err;
+ }
+ }
+ if (size) {
+ void* buffer = writeInplace(size);
+ return buffer == NULL ? NO_MEMORY :
+ val.flatten(buffer);
+ }
+ return NO_ERROR;
+}
+
+template<typename T>
+status_t Parcel::read(LightFlattenable<T>& val) const {
+ size_t size;
+ if (val.isFixedSize()) {
+ size = val.getSize();
+ } else {
+ int32_t s;
+ status_t err = readInt32(&s);
+ if (err != NO_ERROR) {
+ return err;
+ }
+ size = s;
+ }
+ if (size) {
+ void const* buffer = readInplace(size);
+ return buffer == NULL ? NO_MEMORY :
+ val.unflatten(buffer, size);
+ }
+ return NO_ERROR;
+}
+
+// ---------------------------------------------------------------------------
+
inline TextOutput& operator<<(TextOutput& to, const Parcel& parcel)
{
parcel.print(to);
diff --git a/include/binder/PermissionCache.h b/include/binder/PermissionCache.h
index 1171d48..bcdf0c2 100644
--- a/include/binder/PermissionCache.h
+++ b/include/binder/PermissionCache.h
@@ -22,6 +22,7 @@
#include <utils/String16.h>
#include <utils/Singleton.h>
+#include <utils/SortedVector.h>
namespace android {
// ---------------------------------------------------------------------------