public int getOrientation(Context context, Uri uri) {
            int orientation = -1;
            InputStream is = null;
            try {
                is = context.getContentResolver().openInputStream(uri);
                orientation = new ImageHeaderParser(is).getOrientation();
            } catch (IOException e) {
                if (Log.isLoggable(TAG, Log.DEBUG)) {
                    Log.d(TAG, "Failed to open uri: " + uri, e);
                }
            } finally {
                if (is != null) {
                    try {
                        is.close();
                    } catch (IOException e) {
                        // Ignored.
                    }
                }
            }
            return orientation;
        }
A DataFetcher that retrieves an {@link InputStream} for a local Uri that may or may not be for a resource
in the media store. If the local Uri is for a resource in the media store and the size requested is less than or
equal to the media store thumbnail size, preferentially attempts to fetch data for the pre-generated media store
thumbs using {@link MediaStore.Images.Thumbnails} and
{@link MediaStore.Video.Thumbnails}.
core/src/main/java/com/bumptech/glide/load/data/MediaStoreThumbFetcher.java