diff options
author | Christopher Wiley <wiley@google.com> | 2016-05-06 09:19:44 -0700 |
---|---|---|
committer | Christopher Wiley <wiley@google.com> | 2016-05-06 09:25:42 -0700 |
commit | 1651ced6a84b3ba5b62917e88b981e6bac3e7e3f (patch) | |
tree | b2714a7bff3f4d7b13b30389b0f4db2ea396e9b9 | |
parent | 8a414ededd8b48a07de5faac03cc473ce5a42735 (diff) | |
download | native-1651ced6a84b3ba5b62917e88b981e6bac3e7e3f.tar.gz |
libbinder: Use char* message with binder::Status
Bug: None
Change-Id: Idcb8345cda2bf18960c1c437b7a6de4ec17b59fe
-rw-r--r-- | include/binder/Status.h | 7 | ||||
-rw-r--r-- | libs/binder/Status.cpp | 10 |
2 files changed, 17 insertions, 0 deletions
diff --git a/include/binder/Status.h b/include/binder/Status.h index 7253af8fd3..dd61616f24 100644 --- a/include/binder/Status.h +++ b/include/binder/Status.h @@ -72,6 +72,7 @@ public: // A more readable alias for the default constructor. static Status ok(); + // Authors should explicitly pick whether their integer is: // - an exception code (EX_* above) // - service specific error code @@ -84,9 +85,15 @@ public: static Status fromExceptionCode(int32_t exceptionCode); static Status fromExceptionCode(int32_t exceptionCode, const String8& message); + static Status fromExceptionCode(int32_t exceptionCode, + const char* message); + static Status fromServiceSpecificError(int32_t serviceSpecificErrorCode); static Status fromServiceSpecificError(int32_t serviceSpecificErrorCode, const String8& message); + static Status fromServiceSpecificError(int32_t serviceSpecificErrorCode, + const char* message); + static Status fromStatusT(status_t status); Status() = default; diff --git a/libs/binder/Status.cpp b/libs/binder/Status.cpp index 5ae6db2f58..8466863865 100644 --- a/libs/binder/Status.cpp +++ b/libs/binder/Status.cpp @@ -32,6 +32,11 @@ Status Status::fromExceptionCode(int32_t exceptionCode, return Status(exceptionCode, OK, message); } +Status Status::fromExceptionCode(int32_t exceptionCode, + const char* message) { + return fromExceptionCode(exceptionCode, String8(message)); +} + Status Status::fromServiceSpecificError(int32_t serviceSpecificErrorCode) { return Status(EX_SERVICE_SPECIFIC, serviceSpecificErrorCode); } @@ -41,6 +46,11 @@ Status Status::fromServiceSpecificError(int32_t serviceSpecificErrorCode, return Status(EX_SERVICE_SPECIFIC, serviceSpecificErrorCode, message); } +Status Status::fromServiceSpecificError(int32_t serviceSpecificErrorCode, + const char* message) { + return fromServiceSpecificError(serviceSpecificErrorCode, String8(message)); +} + Status Status::fromStatusT(status_t status) { Status ret; ret.setFromStatusT(status); |