Add AVIF special case to ThumbnailUtils

Similar to HEIC, AVIF files can also have smaller thumbnail images
along with the main image in the container. So try to fetch that
first instead of decoding the main image when creating a thumbnail.

Test: ThumbnailUtils test still pass (with the new AVIF test).
Bug: 141654151
Change-Id: I74afffe0e180edd425154daad30e07fcb0781ee6
This commit is contained in:
Vignesh Venkatasubramanian
2020-11-10 13:44:33 -08:00
parent aa42b854e7
commit b32a2f1c41

View File

@@ -272,7 +272,8 @@ public class ThumbnailUtils {
if (mimeType.equals("image/heif")
|| mimeType.equals("image/heif-sequence")
|| mimeType.equals("image/heic")
|| mimeType.equals("image/heic-sequence")) {
|| mimeType.equals("image/heic-sequence")
|| mimeType.equals("image/avif")) {
try (MediaMetadataRetriever retriever = new MediaMetadataRetriever()) {
retriever.setDataSource(file.getAbsolutePath());
bitmap = retriever.getThumbnailImageAtIndex(-1,