@Override
        public @Nullable CloseableImage decode(
            EncodedImage encodedImage,
            int length,
            QualityInfo qualityInfo,
            ImageDecodeOptions options) {
          ImageFormat imageFormat = encodedImage.getImageFormat();
          ColorSpace colorSpace = null;
          if (mEnableEncodedImageColorSpaceUsage.get()) {
            colorSpace =
                options.colorSpace == null ? encodedImage.getColorSpace() : options.colorSpace;
          } else {
            colorSpace = options.colorSpace;
          }
          if (imageFormat == DefaultImageFormats.JPEG) {
            return decodeJpeg(encodedImage, length, qualityInfo, options, colorSpace);
          } else if (imageFormat == DefaultImageFormats.GIF) {
            return decodeGif(encodedImage, length, qualityInfo, options);
          } else if (imageFormat == DefaultImageFormats.WEBP_ANIMATED) {
            return decodeAnimatedWebp(encodedImage, length, qualityInfo, options);
          } else if (imageFormat == DefaultImageFormats.BINARY_XML) {
            return decodeXml(encodedImage, length, qualityInfo, options);
          } else if (imageFormat == ImageFormat.UNKNOWN) {
            throw new DecodeException("unknown image format", encodedImage);
          }
          return decodeStaticImage(encodedImage, options);
        }
Decodes images.

<p>ImageDecoder implements image type recognition and passes decode requests to specialized
methods implemented by subclasses.

<p>On dalvik, it produces 'pinned' purgeable bitmaps.

<p>Pinned purgeables behave as specified in {@link
android.graphics.BitmapFactory.Options#inPurgeable} with one modification. The bitmap is 'pinned'
so is never purged.

<p>For API 21 and higher, this class produces standard Bitmaps, as purgeability is not supported
on the most recent versions of Android.
imagepipeline/src/main/java/com/facebook/imagepipeline/decoder/DefaultImageDecoder.java