Fix null annotations in AImageDecoder
Bug: 160984428
Test: I27033454b2b8b683db727190b834b970c9732d8e
Make AImageDecoder_delete _Nullable. This matches
AImageDecoderFrameInfo_delete. It also makes sense because it just calls
"delete", and even if it didn't, it does conceptually the same thing, so
it should be safe to pass null.
Fix annotation for AImageDecoder_create*. Although the pointer must not
be null, the pointer it points to can, both as input and as output. This
change doesn't seem to affect my local build system (it doesn't warn if
I pass a pointer to a pointer which points to null without this change),
this is more accurate.
Change-Id: I0bf4e160b21169b81a377378bb65cbfd2ef809b2
diff --git a/include/android/imagedecoder.h b/include/android/imagedecoder.h
index c439e51..b5f3b10 100644
--- a/include/android/imagedecoder.h
+++ b/include/android/imagedecoder.h
@@ -196,7 +196,7 @@
* supported.
*/
int AImageDecoder_createFromAAsset(struct AAsset* _Nonnull asset,
- AImageDecoder* _Nonnull * _Nonnull outDecoder)
+ AImageDecoder* _Nullable * _Nonnull outDecoder)
__INTRODUCED_IN(30);
/**
@@ -227,7 +227,7 @@
* - {@link ANDROID_IMAGE_DECODER_UNSUPPORTED_FORMAT}: The format is not
* supported.
*/
-int AImageDecoder_createFromFd(int fd, AImageDecoder* _Nonnull * _Nonnull outDecoder)
+int AImageDecoder_createFromFd(int fd, AImageDecoder* _Nullable * _Nonnull outDecoder)
__INTRODUCED_IN(30);
/**
@@ -258,7 +258,7 @@
* supported.
*/
int AImageDecoder_createFromBuffer(const void* _Nonnull buffer, size_t length,
- AImageDecoder* _Nonnull * _Nonnull outDecoder)
+ AImageDecoder* _Nullable * _Nonnull outDecoder)
__INTRODUCED_IN(30);
/**
@@ -266,7 +266,7 @@
*
* Available since API level 30.
*/
-void AImageDecoder_delete(AImageDecoder* _Nonnull decoder) __INTRODUCED_IN(30);
+void AImageDecoder_delete(AImageDecoder* _Nullable decoder) __INTRODUCED_IN(30);
/**
* Choose the desired output format.