summaryrefslogtreecommitdiff
path: root/libs/binder/Parcel.cpp
diff options
context:
space:
mode:
author Christopher Wiley <wiley@google.com> 2015-11-23 18:23:09 +0000
committer android-build-merger <android-build-merger@google.com> 2015-11-23 18:23:09 +0000
commitcf6d7d1925531b4a327294757fb8595387c170e7 (patch)
tree880aa579f179d05bf31948f0eddc7f76e55d7c95 /libs/binder/Parcel.cpp
parent14b02baadaa7143c5e059ab0e58c48c1a39de14b (diff)
parent6c31acd969ffc754e514885fa7f4d0c25403f580 (diff)
Merge "libbinder: Add support for C++ Parcelable" am: 49b5443a49
am: 6c31acd969 * commit '6c31acd969ffc754e514885fa7f4d0c25403f580': 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 59c85fe7a9..a101d90f6f 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -957,6 +957,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))
@@ -1567,6 +1575,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;