Merge "Use a ExifInterface ctor with a file descriptor as a parameter" am: f715c61542 am: d514714e14
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2485757 Change-Id: I2a7f259bbf366719ebdd9423b61f0fd64791e65a Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -49,6 +49,7 @@ 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;
|
||||||
@@ -255,17 +256,19 @@ public class ThumbnailUtils {
|
|||||||
|
|
||||||
// get orientation
|
// get orientation
|
||||||
if (MediaFile.isExifMimeType(mimeType)) {
|
if (MediaFile.isExifMimeType(mimeType)) {
|
||||||
exif = new ExifInterface(file);
|
try (FileInputStream is = new FileInputStream(file)) {
|
||||||
switch (exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 0)) {
|
exif = new ExifInterface(is.getFD());
|
||||||
case ExifInterface.ORIENTATION_ROTATE_90:
|
switch (exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 0)) {
|
||||||
orientation = 90;
|
case ExifInterface.ORIENTATION_ROTATE_90:
|
||||||
break;
|
orientation = 90;
|
||||||
case ExifInterface.ORIENTATION_ROTATE_180:
|
break;
|
||||||
orientation = 180;
|
case ExifInterface.ORIENTATION_ROTATE_180:
|
||||||
break;
|
orientation = 180;
|
||||||
case ExifInterface.ORIENTATION_ROTATE_270:
|
break;
|
||||||
orientation = 270;
|
case ExifInterface.ORIENTATION_ROTATE_270:
|
||||||
break;
|
orientation = 270;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user