Do not depend on several producers for determining the legacy image origin
@@ -16,7 +16,6 @@ import com.facebook.common.references.CloseableReference;
import com.facebook.datasource.DataSource;
import com.facebook.datasource.DataSubscriber;
import com.facebook.drawee.backends.pipeline.info.ImageOrigin;
-import com.facebook.drawee.backends.pipeline.info.ImageOriginUtils;
import com.facebook.drawee.components.DeferredReleaser;
import com.facebook.drawee.drawable.ScaleTypeDrawable;
import com.facebook.drawee.drawable.ScalingUtils;
@@ -73,7 +72,39 @@ public class FrescoDrawable2Impl extends FrescoDrawable2
@Override
public void onUltimateProducerReached(
String requestId, String producerName, boolean successful) {
- mImageOrigin = ImageOriginUtils.mapProducerNameToImageOrigin(producerName);
+ mImageOrigin = mapProducerNameToImageOrigin(producerName);
+ }
+
+ private @ImageOrigin int mapProducerNameToImageOrigin(final String producerName) {
+ switch (producerName) {
+ case "BitmapMemoryCacheGetProducer":
+ case "BitmapMemoryCacheProducer":
+ case "PostprocessedBitmapMemoryCacheProducer":
+ return ImageOrigin.MEMORY_BITMAP;
+
+ case "EncodedMemoryCacheProducer":
+ return ImageOrigin.MEMORY_ENCODED;
+
+ case "DiskCacheProducer":
+ case "PartialDiskCacheProducer":
+ return ImageOrigin.DISK;
+
+ case "NetworkFetchProducer":
+ return ImageOrigin.NETWORK;
+
+ case "DataFetchProducer":
+ case "LocalAssetFetchProducer":
+ case "LocalContentUriFetchProducer":
+ case "LocalContentUriThumbnailFetchProducer":
+ case "LocalFileFetchProducer":
+ case "LocalResourceFetchProducer":
+ case "VideoThumbnailProducer":
+ case "QualifiedResourceFetchProducer":
+ return ImageOrigin.LOCAL;
+
+ default:
+ return ImageOrigin.UNKNOWN;
+ }
}
};
