diff options
Diffstat (limited to 'libs/binder/ndk/include_ndk/android/binder_status.h')
-rw-r--r-- | libs/binder/ndk/include_ndk/android/binder_status.h | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/libs/binder/ndk/include_ndk/android/binder_status.h b/libs/binder/ndk/include_ndk/android/binder_status.h index ab9a144c53..6f1fdfcd20 100644 --- a/libs/binder/ndk/include_ndk/android/binder_status.h +++ b/libs/binder/ndk/include_ndk/android/binder_status.h @@ -26,12 +26,22 @@ #pragma once #include <errno.h> +#include <stdbool.h> #include <stdint.h> #include <sys/cdefs.h> __BEGIN_DECLS -#if __ANDROID_API__ >= 29 +#ifndef __ANDROID_API__ +#error Android builds must be compiled against a specific API. If this is an \ + android platform host build, you must use libbinder_ndk_host_user. +#endif + +/** + * 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 +72,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,11 +184,12 @@ __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. * - * \param a low-level error to associate with this status object. + * \param status a low-level error to associate with this status object. * * \return a newly constructed status object that the caller owns. */ @@ -274,7 +289,6 @@ void AStatus_deleteDescription(const char* description) __INTRODUCED_IN(30); */ void AStatus_delete(AStatus* status) __INTRODUCED_IN(29); -#endif //__ANDROID_API__ >= 29 __END_DECLS /** @} */ |