facebook/fresco

targetSdk 29 (scoped storage) support?

Open

#2,455 opened on Jan 10, 2020

View on GitHub
 (16 comments) (2 reactions) (1 assignee)Java (17,072 stars) (3,750 forks)batch import
enhancementgood first issuehelp wanted

Description

Description

Fresco failed to load images from EXTERNAL_CONTENT_URI e.g. content://media/external/images/media/8039, FileNotFoundException was seen from the logs

Reproduction

Loading images with EXTERNAL_CONTENT_URI content://media/external/images/media/8039

Solution

I found that inside com.facebook.imagepipeline.producers.LocalContentUriFetchProducer, given the above content uri, it will fall to the call getCameraImage and which in turn getting the absolute file path of the image. However, due to scoped storage in targetSdk 29, that wouldn't be allowed. Probably getting input stream like

ParcelFileDescriptor pfd = mContentResolver.openFileDescriptor(contentUri, "r");
FileInputStream fis = FileInputStream(pfd.getFileDescriptor());

Additional Information

  • Fresco version: 2.0.0
  • Platform version: Android 10

Contributor guide