private static BitmapFactory.Options getDecodeOptionsForStream(
      EncodedImage encodedImage, Bitmap.Config bitmapConfig, boolean skipDecoding) {
    final BitmapFactory.Options options = new BitmapFactory.Options();
    // Sample size should ONLY be different than 1 when downsampling is enabled in the pipeline
    options.inSampleSize = encodedImage.getSampleSize();
    options.inJustDecodeBounds = true;
    options.inDither = true;
    boolean isHardwareBitmap =
        Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && bitmapConfig == Bitmap.Config.HARDWARE;
    if (!isHardwareBitmap) {
      options.inPreferredConfig = bitmapConfig;
    }
    options.inMutable = true;
    if (!skipDecoding) {
      // fill outWidth and outHeight
      BitmapFactory.decodeStream(encodedImage.getInputStream(), null, options);
      if (options.outWidth == -1 || options.outHeight == -1) {
        throw new IllegalArgumentException();
      }
    }
    if (isHardwareBitmap) {
      options.inPreferredConfig = bitmapConfig;
    }
    options.inJustDecodeBounds = false;
    return options;
  }
Options returned by this method are configured with mDecodeBuffer which is GuardedBy("this")
imagepipeline/src/main/java/com/facebook/imagepipeline/platform/DefaultDecoder.java