HEIF: Re-decode the image when changing color type

Bug: 135133301
Test: I902de3410c45a21cf27b48a02cdc5d514b7ada60

AImageDecoder allows decoding an image multiple times, using different
settings (e.g. color type) each time, using the same underlying SkCodec.
After finishing decoding the image, HeifDecoderImpl discards its
MediaMetadataRetriever in order to clean up resources. Hang onto the
input data, so that if a client attempts to decode again, the Impl can
recreate its MediaMetadataRetriever to perform a second decode.

If the client is using the same output color, no new
MediaMetadataRetriever is needed, since it can continue to use the
original video frame output.

When called from Java, the HeifDecoderImpl will be quickly discarded
anyway, so holding on to the input data until that discard should not be
a problem.

Change-Id: I2ca01a006215c1e6f6472c5e6a4df4e2155a3b11
diff --git a/media/libheif/HeifDecoderImpl.h b/media/libheif/HeifDecoderImpl.h
index 69c74a7..2b9c710 100644
--- a/media/libheif/HeifDecoderImpl.h
+++ b/media/libheif/HeifDecoderImpl.h
@@ -81,6 +81,7 @@
 
     bool decodeAsync();
     bool getScanlineInner(uint8_t* dst);
+    bool reinit(HeifFrameInfo* frameInfo);
 };
 
 } // namespace android