@Override
    protected void onNewResultImpl(@Nullable EncodedImage newResult, @Status int status) {
      if (mIsCancelled) {
        return;
      }
      boolean isLast = isLast(status);
      if (newResult == null) {
        if (isLast) {
          getConsumer().onNewResult(null, Consumer.IS_LAST);
        }
        return;
      }
      ImageFormat imageFormat = newResult.getImageFormat();
      TriState shouldTransform =
          shouldTransform(
              mProducerContext.getImageRequest(),
              newResult,
              Preconditions.checkNotNull(
                  mImageTranscoderFactory.createImageTranscoder(imageFormat, mIsResizingEnabled)));
      // ignore the intermediate result if we don't know what to do with it
      if (!isLast && shouldTransform == TriState.UNSET) {
        return;
      }
      // just forward the result if we know that it shouldn't be transformed
      if (shouldTransform != TriState.YES) {
        forwardNewResult(newResult, status, imageFormat);
        return;
      }
      // we know that the result should be transformed, hence schedule it
      if (!mJobScheduler.updateJob(newResult, status)) {
        return;
      }
      if (isLast || mProducerContext.isIntermediateResultExpected()) {
        mJobScheduler.scheduleJob();
      }
    }
Resizes and rotates images according to the EXIF orientation data or a specified rotation angle.

<p>If the image is not supported by the {@link ImageTranscoder}, no transformation is applied.

<p>This can be used even if downsampling is enabled as long as resizing is disabled.
imagepipeline/src/main/java/com/facebook/imagepipeline/producers/ResizeAndRotateProducer.java