facebook/fresco

targetSdk 29 (scoped storage) support?

Open

#2,455 建立於 2020年1月10日

在 GitHub 查看
 (16 留言) (2 反應) (1 負責人)Java (17,072 star) (3,750 fork)batch import
enhancementgood first issuehelp wanted

描述

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

貢獻者指南

targetSdk 29 (scoped storage) support? · facebook/fresco#2455 | Good First Issue