From 9b9fb394e3f40b90fff0c24bfbf225da91c8b8c8 Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Thu, 3 Dec 2020 16:55:36 -0500 Subject: Add AImageDecoder_resultToString Bug: 160984428 Test: I118eaa99cd65b70dbfb2c8a7731c714564911a34 This allows clients to print a readable string when there is an error (e.g. "ANDROID_IMAGE_DECODER_BAD_PARAMETER" instead of "-5"). Change-Id: I24400979e1ce12d5c8b48bba456b07fdfda49662 --- include/android/imagedecoder.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'include/android/imagedecoder.h') diff --git a/include/android/imagedecoder.h b/include/android/imagedecoder.h index 27be9c84b1..c439e5142a 100644 --- a/include/android/imagedecoder.h +++ b/include/android/imagedecoder.h @@ -65,7 +65,8 @@ struct AAsset; * Many functions will return this to indicate success * ({@link ANDROID_IMAGE_DECODER_SUCCESS}) or the reason for the failure. On * failure, any out-parameters should be considered uninitialized, except where - * specified. + * specified. Use {@link AImageDecoder_resultToString} for a readable + * version of the result code. */ enum { /** @@ -124,6 +125,24 @@ enum { ANDROID_IMAGE_DECODER_INVALID_STATE = -11, }; +#if __ANDROID_API__ >= 31 + +/** + * Return a constant string value representing the error code. + * + * Introduced in API 31. + * + * Pass the return value from an {@link AImageDecoder} method (e.g. + * {@link AImageDecoder_decodeImage}) for a text string representing the error + * code. + * + * Errors: + * - Returns null for a value out of range. + */ +const char* _Nullable AImageDecoder_resultToString(int)__INTRODUCED_IN(31); + +#endif // __ANDROID_API__ >= 31 + struct AImageDecoder; /** -- cgit v1.2.3-59-g8ed1b