Closed Bug 1506649 Opened 2 years ago Closed 2 years ago

Opening files from external storage should be supported too.


(Firefox for Android :: General, enhancement, P1)




Firefox 66
Tracking Status
relnote-firefox --- 66+
firefox66 --- verified


(Reporter: andrei.a.lazar, Assigned: JanH)




(3 files, 1 obsolete file)

Hardware: Unspecified → ARM
Version: unspecified → Trunk
Severity: major → normal
Priority: -- → P3
Priority: P3 → P1
Trying to obtain the real path for a file located on the SD CARD will fail so we are going to
stream the data in a temporary file and make use of that path instead.
Attachment #9030239 - Attachment is obsolete: true
Assignee: andrei.a.lazar → jh+bugzilla
Hardware: ARM → All
Instead, getOriginalFilePathFromUri() will simply *always* return null if it
cannot divine the original file path, and consequently resolveContentUri() will
then always fall back to the temp file method if getOriginalFilePathFromUri()
returns null.
Because getOriginalFilePathFromUri() doesn't use framework methods newer than
Kitkat, instead of a generic @SuppressLint("NewAPI") it would be better to use
@TargetApi(19), so you still get warned if you start using framework methods
more recent than API19.

However because the isKitkat helper variable is only used in one place, in the
end we simply replace it with a direct Build.VERSION.SDK_INT check, so that we
don't have to use any special handling for the linter.
The AOSP ExternalStorageProvider always creates document IDs of the form
"storage device ID" + ':' + "document path", where the storage device ID will
be "primary" for the primary emulated storage and the file system UUID for
everything else.

Assuming that OEMs won't customise this behaviour, the main problem that needs
to be handled is how to turn the file system UUID back into a file system path.
Pushed by
Part 1: Avoid exeception-based control-flow for resolving content://-URIs. r=snorp
Part 2: Better API version linting. r=snorp
Part 3: Guess ExternalStorageProvider file paths for non-primary volumes. r=snorp
Flags: needinfo?(sorina.florean)

Verified as fixed on latest Nightly build (67.0a1) and Beta build (66.0b3).

Flags: needinfo?(sorina.florean)

Release note added for 66: Added support to open files from external storage, such as an SD card.

This bug was only about the built-in Android file explorer - with other file explorer apps or through manually browsing to the file location from within Firefox we have been able to open files on external storages for a long time. So I'm not sure this really warrants a release note, at least with this phrasing?

You need to log in before you can comment on or make changes to this bug.