static RotateBitmapResult rotateBitmapByExif(Bitmap bitmap, Context context, Uri uri) {
    ExifInterface ei = null;
    try {
      InputStream is = context.getContentResolver().openInputStream(uri);
      if (is != null) {
        ei = new ExifInterface(is);
        is.close();
      }
    } catch (Exception ignored) {
    }
    return ei != null ? rotateBitmapByExif(bitmap, ei) : new RotateBitmapResult(bitmap, 0);
  }
Rotate the given image by reading the Exif value of the image (uri).<br>
If no rotation is required the image will not be rotated.<br>
New bitmap is created and the old one is recycled.
core/src/main/java/com/theartofdev/edmodo/cropper/BitmapUtils.java