Closed Bug 1977304 Opened 24 days ago Closed 15 days ago

Don't use local path file on Android 11+

Categories

(GeckoView :: General, defect, P1)

All
Android
defect

Tracking

(firefox142 fixed, firefox143 fixed)

RESOLVED FIXED
143 Branch
Tracking Status
firefox142 --- fixed
firefox143 --- fixed

People

(Reporter: m_kato, Assigned: m_kato)

References

Details

(Keywords: webcompat:platform-bug, Whiteboard: [fxdroid])

Attachments

(2 files)

https://developer.android.com/reference/android/provider/MediaStore.MediaColumns.html#DATA

From Android 11 onwards, this column is read-only for apps that target R and higher. On those devices, when creating or updating a uri, this column's value is not accepted. Instead, to update the filesystem location of a file, use the values of the DISPLAY_NAME and RELATIVE_PATH columns.

Though direct file operations are supported, ContentResolver.openFileDescriptor(Uri, String) API is recommended for better performance.

Blocks: 1974919
Whiteboard: [fxdroid]

From Android 11, the local path from file may not be accessible. So if
11 or later, we should always use the content URI when using folder picker.

After we use input stream for content:// uri, we should close immediately to
release object soon.

Status: NEW → RESOLVED
Closed: 15 days ago
Resolution: --- → FIXED
Target Milestone: --- → 143 Branch

Comment on attachment 9500840 [details]
Bug 1977304 - Part 1. Don't use local path file on Android 11+. r=#geckoview-reviewers

Beta/Release Uplift Approval Request

  • User impact if declined/Reason for urgency: When using Android 11 or later, user cannot upload files using folder picker on www.dropbox.com.
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Low. This code only runs on Android 11 or later.

If Android 11, we use Android API to read file instead of reading local file by file path. Android 11 or later doesn't allow to access local file directly under user data folders.

  • String changes made/needed: No
  • Is Android affected?: Yes
Attachment #9500840 - Flags: approval-mozilla-beta?
Attachment #9500841 - Flags: approval-mozilla-beta?

Comment on attachment 9500840 [details]
Bug 1977304 - Part 1. Don't use local path file on Android 11+. r=#geckoview-reviewers

Approved for 142.0b5

Attachment #9500840 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9500841 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: