You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Camera capture intents lack explicit URI grant flags (lint MissingExplicitUriGrant, AGP 9.5.0) #7017
Is your feature request related to a problem? Please describe.
Android Gradle Plugin 9.5.0 (c8a8297) added the lint check MissingExplicitUriGrant. On master it reports three new warnings, which is the whole increase from 14 to 17 lint warnings:
Lint message: "This intent attaches a URI but is missing FLAG_GRANT_READ_URI_PERMISSION and FLAG_GRANT_WRITE_URI_PERMISSION; the receiving app will not be granted access to the URI on Android 18 and higher."
From Android 18, the system no longer grants URI permissions automatically for send and media capture intents (ACTION_SEND, ACTION_IMAGE_CAPTURE, …) that carry a URI. Without the flags, the camera app can't write the photo or video into the file we hand it, so taking a photo or video from the chat and taking an avatar picture break. See https://goo.gle/implicit-uri-grants.
Describe the solution you'd like
Add addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION) to the three intents, test photo and video capture from the chat and the avatar camera capture, and lower the lint baseline in scripts/analysis/lint-results.txt by 3.
Describe alternatives you've considered
Suppressing MissingExplicitUriGrant or keeping the raised baseline only hides a real behaviour change on Android 18.
Additional context
The lint baseline was raised from 14 to 17 in #7015 so CI passes in the meantime.
Activity