private @Nullable EncodedImage getCameraImage(Uri uri, @Nullable ResizeOptions resizeOptions)
      throws IOException {
    if (resizeOptions == null) {
      return null;
    }
    @Nullable Cursor cursor = mContentResolver.query(uri, PROJECTION, null, null, null);
    if (cursor == null) {
      return null;
    }
    try {
      if (cursor.moveToFirst()) {
        final int imageIdColumnIndex = cursor.getColumnIndex(MediaStore.Images.Media._ID);
        final EncodedImage thumbnail =
            this.getThumbnail(resizeOptions, cursor.getLong(imageIdColumnIndex));
        if (thumbnail != null) {
          final int imageDataColumnIndex =
              cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA);
          if (imageDataColumnIndex >= 0) {
            final String pathname = cursor.getString(imageDataColumnIndex);
            thumbnail.setRotationAngle(getRotationAngle(pathname));
          }
          return thumbnail;
        }
      }
    } finally {
      cursor.close();
    }
    return null;
  }
Wrapper around File operations to enable mocking in tests.
imagepipeline/src/main/java/com/facebook/imagepipeline/producers/LocalContentUriThumbnailFetchProducer.java