summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Wiley <wiley@google.com>2016-05-06 18:05:35 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-05-06 18:05:35 +0000
commit8d9818db1af53e065442fb5fcc44f69dfd31aec0 (patch)
treed353eefc00deaf8021be193222ba05238116d01a
parentcaff47a0c495734d344515dafb193ac8a3d6a498 (diff)
parent1651ced6a84b3ba5b62917e88b981e6bac3e7e3f (diff)
downloadnative-android-wear-n-preview-3.tar.gz
Merge "libbinder: Use char* message with binder::Status"android-wear-n-preview-3android-wear-n-preview-1android-n-preview-3
-rw-r--r--include/binder/Status.h7
-rw-r--r--libs/binder/Status.cpp10
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);