diff options
author | 2021-01-20 22:16:03 +0000 | |
---|---|---|
committer | 2021-01-20 22:16:03 +0000 | |
commit | a15095652a64457877b9c3f90709ece1caf006c3 (patch) | |
tree | 36c8d66cdd9f3ed555e277e5feb22f7e8e1fd798 | |
parent | aaa954a6ae4ac042f41155df92aac2138871264a (diff) | |
parent | da4a5ca5b7cd4865c315d41fad30f56db0a1a13e (diff) |
Merge "libbinder_ndk: ScopedAStatus description compat" am: da4a5ca5b7
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1553307
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: I39ca5aa5f98243d1cd584556fc14f5bb19f8b683
-rw-r--r-- | libs/binder/ndk/include_cpp/android/binder_auto_utils.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libs/binder/ndk/include_cpp/android/binder_auto_utils.h b/libs/binder/ndk/include_cpp/android/binder_auto_utils.h index 6b52c0aea1..0ad400bffb 100644 --- a/libs/binder/ndk/include_cpp/android/binder_auto_utils.h +++ b/libs/binder/ndk/include_cpp/android/binder_auto_utils.h @@ -265,7 +265,18 @@ class ScopedAStatus : public impl::ScopedAResource<AStatus*, AStatus_delete, nul AStatus_deleteDescription(cStr); return ret; } - return "(not available)"; + binder_exception_t exception = getExceptionCode(); + std::string desc = std::to_string(exception); + if (exception == EX_SERVICE_SPECIFIC) { + desc += " (" + std::to_string(getServiceSpecificError()) + ")"; + } else if (exception == EX_TRANSACTION_FAILED) { + desc += " (" + std::to_string(getStatus()) + ")"; + } + if (const char* msg = getMessage(); msg != nullptr) { + desc += ": "; + desc += msg; + } + return desc; } /** |