summaryrefslogtreecommitdiff
path: root/libs/binder/Status.cpp
diff options
context:
space:
mode:
author Steven Moreland <smoreland@google.com> 2018-10-05 13:43:24 -0700
committer Steven Moreland <smoreland@google.com> 2018-10-08 19:13:28 +0000
commitfb26e720a27e464e388986e665a43f6dfa815144 (patch)
treef8bdc2299312d9187a0cc503221edfe8762c1db7 /libs/binder/Status.cpp
parentcd1ce760e8109eb91ce9d3e91fdaabb866262045 (diff)
libbinder: no 'okay' EX_TRANSACTION_FAILED
When EX_TRANSACTION_FAILED is set, mError will never be okay. Bug: 116618418 Test: atest android.binder.cts Change-Id: If44ba1fa82cce836f4ee4faad117a1e6b24bf8de
Diffstat (limited to 'libs/binder/Status.cpp')
-rw-r--r--libs/binder/Status.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/libs/binder/Status.cpp b/libs/binder/Status.cpp
index e318a7fa09..a3f87557ab 100644
--- a/libs/binder/Status.cpp
+++ b/libs/binder/Status.cpp
@@ -24,11 +24,17 @@ Status Status::ok() {
}
Status Status::fromExceptionCode(int32_t exceptionCode) {
+ if (exceptionCode == EX_TRANSACTION_FAILED) {
+ return Status(exceptionCode, FAILED_TRANSACTION);
+ }
return Status(exceptionCode, OK);
}
Status Status::fromExceptionCode(int32_t exceptionCode,
const String8& message) {
+ if (exceptionCode == EX_TRANSACTION_FAILED) {
+ return Status(exceptionCode, FAILED_TRANSACTION, message);
+ }
return Status(exceptionCode, OK, message);
}
@@ -136,7 +142,7 @@ status_t Status::writeToParcel(Parcel* parcel) const {
// Something really bad has happened, and we're not going to even
// try returning rich error data.
if (mException == EX_TRANSACTION_FAILED) {
- return mErrorCode == OK ? FAILED_TRANSACTION : mErrorCode;
+ return mErrorCode;
}
status_t status = parcel->writeInt32(mException);
@@ -158,7 +164,7 @@ status_t Status::writeToParcel(Parcel* parcel) const {
void Status::setException(int32_t ex, const String8& message) {
mException = ex;
- mErrorCode = NO_ERROR; // an exception, not a transaction failure.
+ mErrorCode = ex == EX_TRANSACTION_FAILED ? FAILED_TRANSACTION : NO_ERROR;
mMessage.setTo(message);
}