summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Steven Moreland <smoreland@google.com> 2021-03-22 22:26:32 +0000
committer Steven Moreland <smoreland@google.com> 2021-03-22 23:40:19 +0000
commit503a8d6898c1aab5d8c99937b242d0172a82e20c (patch)
tree4dad99b24bba1dae68fde8d812eae27bf4af8dc9
parenta647f2bc257e4eb59923e097c4e225643ecf38cf (diff)
libbinder_ndk: document preferred error types
The anonymous enums corresponding to binder_status_t and binder_exception_t are undocumented, but currently these show up on the developer site w/ documentation like "Anonymous Enum 19". This is aimed at fixing that and also explaining which to use when. Bug: N/A Test: N/A Change-Id: I20414858beda591fe9f4f224b7de237bed4c97ac
-rw-r--r--libs/binder/ndk/include_ndk/android/binder_status.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/libs/binder/ndk/include_ndk/android/binder_status.h b/libs/binder/ndk/include_ndk/android/binder_status.h
index 05b25e7c40..7b87424e7d 100644
--- a/libs/binder/ndk/include_ndk/android/binder_status.h
+++ b/libs/binder/ndk/include_ndk/android/binder_status.h
@@ -32,6 +32,11 @@
__BEGIN_DECLS
+/**
+ * Low-level status types for use in binder. This is the least preferable way to
+ * return an error for binder services (where binder_exception_t should be used,
+ * particularly EX_SERVICE_SPECIFIC).
+ */
enum {
STATUS_OK = 0,
@@ -62,6 +67,10 @@ enum {
*/
typedef int32_t binder_status_t;
+/**
+ * Top level exceptions types for Android binder errors, mapping to Java
+ * exceptions. Also see Parcel.java.
+ */
enum {
EX_NONE = 0,
EX_SECURITY = -1,
@@ -170,7 +179,8 @@ __attribute__((warn_unused_result)) AStatus* AStatus_fromServiceSpecificErrorWit
/**
* New status with binder_status_t. This is typically for low level failures when a binder_status_t
* is returned by an API on AIBinder or AParcel, and that is to be returned from a method returning
- * an AStatus instance.
+ * an AStatus instance. This is the least preferable way to return errors.
+ * Prefer exceptions (particularly service-specific errors) when possible.
*
* Available since API level 29.
*