summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/android/configuration.h16
-rw-r--r--include/binder/IPCThreadState.h2
-rw-r--r--include/binder/Parcel.h18
-rw-r--r--include/ui/Region.h34
-rw-r--r--include/utils/SharedBuffer.h27
5 files changed, 59 insertions, 38 deletions
diff --git a/include/android/configuration.h b/include/android/configuration.h
index 06cd3da..0f5c14a 100644
--- a/include/android/configuration.h
+++ b/include/android/configuration.h
@@ -93,6 +93,10 @@ enum {
ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY = 0x0000,
+ ACONFIGURATION_LAYOUTDIR_ANY = 0x00,
+ ACONFIGURATION_LAYOUTDIR_LTR = 0x01,
+ ACONFIGURATION_LAYOUTDIR_RTL = 0x02,
+
ACONFIGURATION_MCC = 0x0001,
ACONFIGURATION_MNC = 0x0002,
ACONFIGURATION_LOCALE = 0x0004,
@@ -107,6 +111,7 @@ enum {
ACONFIGURATION_SCREEN_LAYOUT = 0x0800,
ACONFIGURATION_UI_MODE = 0x1000,
ACONFIGURATION_SMALLEST_SCREEN_SIZE = 0x2000,
+ ACONFIGURATION_LAYOUTDIR = 0x4000,
};
/**
@@ -331,6 +336,17 @@ int32_t AConfiguration_getSmallestScreenWidthDp(AConfiguration* config);
void AConfiguration_setSmallestScreenWidthDp(AConfiguration* config, int32_t value);
/**
+ * Return the configuration's layout direction, or
+ * ACONFIGURATION_LAYOUTDIR_ANY if not set.
+ */
+int32_t AConfiguration_getLayoutDirection(AConfiguration* config);
+
+/**
+ * Set the configuration's layout direction.
+ */
+void AConfiguration_setLayoutDirection(AConfiguration* config, int32_t value);
+
+/**
* Perform a diff between two configurations. Returns a bit mask of
* ACONFIGURATION_* constants, each bit set meaning that configuration element
* is different between them.
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/Parcel.h b/include/binder/Parcel.h
index 877b17c..3ff95d2 100644
--- a/include/binder/Parcel.h
+++ b/include/binder/Parcel.h
@@ -285,9 +285,12 @@ status_t Parcel::write(const LightFlattenable<T>& val) {
return err;
}
}
- void* buffer = writeInplace(size);
- return buffer == NULL ? NO_MEMORY :
- val.flatten(buffer);
+ if (size) {
+ void* buffer = writeInplace(size);
+ return buffer == NULL ? NO_MEMORY :
+ val.flatten(buffer);
+ }
+ return NO_ERROR;
}
template<typename T>
@@ -303,9 +306,12 @@ status_t Parcel::read(LightFlattenable<T>& val) const {
}
size = s;
}
- void const* buffer = readInplace(size);
- return buffer == NULL ? NO_MEMORY :
- val.unflatten(buffer, size);
+ if (size) {
+ void const* buffer = readInplace(size);
+ return buffer == NULL ? NO_MEMORY :
+ val.unflatten(buffer, size);
+ }
+ return NO_ERROR;
}
// ---------------------------------------------------------------------------
diff --git a/include/ui/Region.h b/include/ui/Region.h
index f0819af..0049fde 100644
--- a/include/ui/Region.h
+++ b/include/ui/Region.h
@@ -28,6 +28,7 @@
namespace android {
// ---------------------------------------------------------------------------
+class SharedBuffer;
class String8;
// ---------------------------------------------------------------------------
@@ -41,10 +42,10 @@ public:
Region& operator = (const Region& rhs);
- inline bool isEmpty() const { return mBounds.isEmpty(); }
- inline bool isRect() const { return mStorage.isEmpty(); }
+ inline bool isEmpty() const { return getBounds().isEmpty(); }
+ inline bool isRect() const { return mStorage.size() == 1; }
- inline Rect getBounds() const { return mBounds; }
+ inline Rect getBounds() const { return mStorage[mStorage.size() - 1]; }
inline Rect bounds() const { return getBounds(); }
// the region becomes its bounds
@@ -106,17 +107,23 @@ public:
/* various ways to access the rectangle list */
+
+ // STL-like iterators
typedef Rect const* const_iterator;
-
- const_iterator begin() const;
- const_iterator end() const;
+ 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;
+ // returns an array of rect which has the same life-time has this
+ // Region object.
+ Rect const* getArray(size_t* count) const;
+
+ // returns a SharedBuffer as well as the number of rects.
+ // ownership is transfered to the caller.
+ // the caller must call SharedBuffer::release() to free the memory.
+ SharedBuffer const* getSharedBuffer(size_t* count) const;
+ /* no user serviceable parts here... */
// add a rectangle to the internal list. This rectangle must
// be sorted in Y and X and must not make the region invalid.
@@ -156,8 +163,11 @@ private:
static bool validate(const Region& reg, const char* name);
- Rect mBounds;
- Vector<Rect> mStorage;
+ // mStorage is a (manually) sorted array of Rects describing the region
+ // with an extra Rect as the last element which is set to the
+ // bounds of the region. However, if the region is
+ // a simple Rect then mStorage contains only that rect.
+ Vector<Rect> mStorage;
};
diff --git a/include/utils/SharedBuffer.h b/include/utils/SharedBuffer.h
index 24508b0..b670953 100644
--- a/include/utils/SharedBuffer.h
+++ b/include/utils/SharedBuffer.h
@@ -44,9 +44,6 @@ public:
* 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;
@@ -94,9 +91,10 @@ public:
private:
inline SharedBuffer() { }
inline ~SharedBuffer() { }
- inline SharedBuffer(const SharedBuffer&);
+ SharedBuffer(const SharedBuffer&);
+ SharedBuffer& operator = (const SharedBuffer&);
- // 16 bytes. must be sized to preserve correct alingment.
+ // 16 bytes. must be sized to preserve correct alignment.
mutable int32_t mRefs;
size_t mSize;
uint32_t mReserved[2];
@@ -104,10 +102,6 @@ private:
// ---------------------------------------------------------------------------
-const SharedBuffer* SharedBuffer::sharedBuffer(const void* data) {
- return data ? reinterpret_cast<const SharedBuffer *>(data)-1 : 0;
-}
-
const void* SharedBuffer::data() const {
return this + 1;
}
@@ -120,19 +114,16 @@ size_t SharedBuffer::size() const {
return mSize;
}
-SharedBuffer* SharedBuffer::bufferFromData(void* data)
-{
- return ((SharedBuffer*)data)-1;
+SharedBuffer* SharedBuffer::bufferFromData(void* data) {
+ return data ? static_cast<SharedBuffer *>(data)-1 : 0;
}
-const SharedBuffer* SharedBuffer::bufferFromData(const void* data)
-{
- return ((const SharedBuffer*)data)-1;
+const SharedBuffer* SharedBuffer::bufferFromData(const void* data) {
+ return data ? static_cast<const SharedBuffer *>(data)-1 : 0;
}
-size_t SharedBuffer::sizeFromData(const void* data)
-{
- return (((const SharedBuffer*)data)-1)->mSize;
+size_t SharedBuffer::sizeFromData(const void* data) {
+ return data ? bufferFromData(data)->mSize : 0;
}
bool SharedBuffer::onlyOwner() const {