Merge "Revert "Use a ExifInterface ctor with a file descriptor as a parameter""

This commit is contained in:
Ray Essick
2023-06-19 15:42:31 +00:00
committed by Gerrit Code Review

View File

@@ -49,7 +49,6 @@ import com.android.internal.util.ArrayUtils;
import libcore.io.IoUtils; import libcore.io.IoUtils;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Comparator; import java.util.Comparator;
@@ -256,8 +255,7 @@ public class ThumbnailUtils {
// get orientation // get orientation
if (MediaFile.isExifMimeType(mimeType)) { if (MediaFile.isExifMimeType(mimeType)) {
try (FileInputStream is = new FileInputStream(file)) { exif = new ExifInterface(file);
exif = new ExifInterface(is.getFD());
switch (exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 0)) { switch (exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 0)) {
case ExifInterface.ORIENTATION_ROTATE_90: case ExifInterface.ORIENTATION_ROTATE_90:
orientation = 90; orientation = 90;
@@ -270,7 +268,6 @@ public class ThumbnailUtils {
break; break;
} }
} }
}
if (mimeType.equals("image/heif") if (mimeType.equals("image/heif")
|| mimeType.equals("image/heif-sequence") || mimeType.equals("image/heif-sequence")