diff options
author | 2021-01-20 21:36:51 +0000 | |
---|---|---|
committer | 2021-01-20 21:36:51 +0000 | |
commit | da4a5ca5b7cd4865c315d41fad30f56db0a1a13e (patch) | |
tree | ec30b918038850c7ecdb89a1d603384b48d86b26 | |
parent | aaf1ba472a6e1d08251d9eddfbe90fbbbdd1372b (diff) | |
parent | 0c75f9c8f3c8696685acadf50039553be71b0674 (diff) |
Merge "libbinder_ndk: ScopedAStatus description compat"
-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; } /** |