Update AImageDecoder_getAlphaFlags return value
Bug: 135133301
Test: I2ea58bede5cf49a7947c96e7e6e37f967632ad6b
BAD_PARAMETER is a more sensible value than -1. The other return will
not be reached, but the code is clearer.
Change-Id: I4bee8f238f61a6c6cd13b5458f201f34d34315d9
diff --git a/native/graphics/jni/imagedecoder.cpp b/native/graphics/jni/imagedecoder.cpp
index 2ef203d..a13cc02 100644
--- a/native/graphics/jni/imagedecoder.cpp
+++ b/native/graphics/jni/imagedecoder.cpp
@@ -225,13 +225,12 @@
int AImageDecoderHeaderInfo_getAlphaFlags(const AImageDecoderHeaderInfo* info) {
if (!info) {
- // FIXME: Better invalid?
- return -1;
+ return ANDROID_IMAGE_DECODER_BAD_PARAMETER;
}
switch (toDecoder(info)->mCodec->getInfo().alphaType()) {
case kUnknown_SkAlphaType:
LOG_ALWAYS_FATAL("Invalid alpha type");
- return -1;
+ return ANDROID_IMAGE_DECODER_INTERNAL_ERROR;
case kUnpremul_SkAlphaType:
// fall through. premul is the default.
case kPremul_SkAlphaType: