summaryrefslogtreecommitdiff
path: root/libs/binder/Parcel.cpp
diff options
context:
space:
mode:
author Christopher Wiley <wiley@google.com> 2015-11-23 18:14:26 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2015-11-23 18:14:26 +0000
commit49b5443a49d737d13c8d05dfd9b827b2c4198edc (patch)
tree9ecfcd51e5fadbceccd4fa5cefe3cc6fa21d6fe3 /libs/binder/Parcel.cpp
parente1aa1c7e136e7372c17b8db7a6d8b307ba4cd571 (diff)
parent97f048d19e51da4ea6ff98d8a9daf38f2577f182 (diff)
Merge "libbinder: Add support for C++ Parcelable"
Diffstat (limited to 'libs/binder/Parcel.cpp')
-rw-r--r--libs/binder/Parcel.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index a5f7d89bd8..03348da773 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -931,6 +931,14 @@ status_t Parcel::writeWeakBinder(const wp<IBinder>& val)
return flatten_binder(ProcessState::self(), val, this);
}
+status_t Parcel::writeParcelable(const Parcelable& parcelable) {
+ status_t status = writeInt32(1); // parcelable is not null.
+ if (status != OK) {
+ return status;
+ }
+ return parcelable.writeToParcel(this);
+}
+
status_t Parcel::writeNativeHandle(const native_handle* handle)
{
if (!handle || handle->version != sizeof(native_handle))
@@ -1543,6 +1551,18 @@ wp<IBinder> Parcel::readWeakBinder() const
return val;
}
+status_t Parcel::readParcelable(Parcelable* parcelable) const {
+ int32_t have_parcelable = 0;
+ status_t status = readInt32(&have_parcelable);
+ if (status != OK) {
+ return status;
+ }
+ if (!have_parcelable) {
+ return UNEXPECTED_NULL;
+ }
+ return parcelable->readFromParcel(this);
+}
+
int32_t Parcel::readExceptionCode() const
{
binder::Status status;