Skip to content

fix(android): explicitly grant URI permissions for image capture intent#8526

Open
alexgerardojacinto wants to merge 1 commit into
mainfrom
fix/RMET-5241-implicit-uri-grants
Open

fix(android): explicitly grant URI permissions for image capture intent#8526
alexgerardojacinto wants to merge 1 commit into
mainfrom
fix/RMET-5241-implicit-uri-grants

Conversation

@alexgerardojacinto

@alexgerardojacinto alexgerardojacinto commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Android 18 removes automatic URI permission grants for ACTION_SEND, ACTION_SEND_MULTIPLE, and ACTION_IMAGE_CAPTURE intents (apps must now explicitly request them). BridgeWebChromeClient.showImageCapturePicker() launches the camera with a FileProvider content:// URI in EXTRA_OUTPUT but never explicitly granted read/write access to it, so on Android 18+ the camera app would silently fail to write the captured photo back into that URI.

  • Add FLAG_GRANT_WRITE_URI_PERMISSION and FLAG_GRANT_READ_URI_PERMISSION to the ACTION_IMAGE_CAPTURE intent.

Part of RMET-5241.

Test plan

  • Manual: triggered a web <input type="file" accept="image/*" capture> photo capture flow via a minimal Capacitor test app and confirmed the captured photo loads back into the WebView.
  • Verified on Android 7 (API 25) and Android 17 — no regressions, capture works identically to pre-fix behavior on both.

Android 18 removes automatic URI permission grants for ACTION_IMAGE_CAPTURE
intents. Explicitly add FLAG_GRANT_READ_URI_PERMISSION and
FLAG_GRANT_WRITE_URI_PERMISSION so the camera app can access the
FileProvider output URI.

RMET-5241

@OS-pedrogustavobilro OS-pedrogustavobilro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants