diff options
author | 2017-01-17 13:53:04 -0700 | |
---|---|---|
committer | 2017-01-17 13:57:27 -0700 | |
commit | c8dc4f0af9f8847be9cdd2b9cbb5b8a7767982c4 (patch) | |
tree | 0eb808ac9be34ca42ed2936dc271d908122e530c /libs/binder/Status.cpp | |
parent | 36ba03a248e34aa92aaa9667a4fa71c64bea5c23 (diff) |
Add Binder support for Parcelable exceptions.
Follow the new framework changes that support sending EX_PARCELABLE
exception types.
Test: builds, boots
Bug: 33749182
Change-Id: I7a856fa89f23aab4f782c4e5ae2beb8166fa8da4
Diffstat (limited to 'libs/binder/Status.cpp')
-rw-r--r-- | libs/binder/Status.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/libs/binder/Status.cpp b/libs/binder/Status.cpp index 8466863865..006f7f94e9 100644 --- a/libs/binder/Status.cpp +++ b/libs/binder/Status.cpp @@ -104,6 +104,16 @@ status_t Status::readFromParcel(const Parcel& parcel) { if (mException == EX_SERVICE_SPECIFIC) { status = parcel.readInt32(&mErrorCode); + } else if (mException == EX_PARCELABLE) { + // Skip over the blob of Parcelable data + const int32_t header_start = parcel.dataPosition(); + int32_t header_size; + status = parcel.readInt32(&header_size); + if (status != OK) { + setFromStatusT(status); + return status; + } + parcel.setDataPosition(header_start + header_size); } if (status != OK) { setFromStatusT(status); @@ -127,11 +137,12 @@ status_t Status::writeToParcel(Parcel* parcel) const { return status; } status = parcel->writeString16(String16(mMessage)); - if (mException != EX_SERVICE_SPECIFIC) { - // We have no more information to write. - return status; + if (mException == EX_SERVICE_SPECIFIC) { + status = parcel->writeInt32(mErrorCode); + } else if (mException == EX_PARCELABLE) { + // Sending Parcelable blobs currently not supported + status = parcel->writeInt32(0); } - status = parcel->writeInt32(mErrorCode); return status; } |