-
Notifications
You must be signed in to change notification settings - Fork 433
Handle Android media content URIs and gate READ_MEDIA permissions #4130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // The document picker grants temporary permissions for content URIs. Requesting | ||
| // READ_EXTERNAL_STORAGE again would surface a redundant prompt on Android 13+, so we only | ||
| // ask for classic file paths that require the legacy permission. | ||
| if(!isContentUri && !uri.startsWith(FileSystemStorage.getInstance().getAppHomePath())) { | ||
| if(!PermissionsHelper.checkForPermission(isVideo ? DevicePermission.PERMISSION_READ_VIDEO : DevicePermission.PERMISSION_READ_AUDIO, "This is required to play media")){ | ||
| return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skipping READ_MEDIA runtime prompt for MediaStore content URIs
The new logic avoids requesting any runtime permission whenever the URI scheme is content://. That works for document-picker grants, but it also suppresses the previous PermissionsHelper.checkForPermission() call for MediaStore URIs such as content://media/external/..., which still require READ_MEDIA_*/READ_EXTERNAL_STORAGE when no temporary grant was provided. Before this change createMedia() asked for the permission and playback succeeded; now it returns an error once MediaPlayer.create() hits a SecurityException. Apps that pass a MediaStore URI without having asked for the permission themselves will silently regress.
Useful? React with 👍 / 👎.
✅ Continuous Quality ReportTest & Coverage
Static Analysis
Generated automatically by the PR CI workflow. |

Summary
Testing
Codex Task