Skip to content

[webview_flutter_android] Expose allowFileAccessFromFileURLs and allowUniversalAccessFromFileURLs - #12330

Open
jackxuechen wants to merge 1 commit into
flutter:mainfrom
jackxuechen:add-android-file-url-access-settings
Open

[webview_flutter_android] Expose allowFileAccessFromFileURLs and allowUniversalAccessFromFileURLs#12330
jackxuechen wants to merge 1 commit into
flutter:mainfrom
jackxuechen:add-android-file-url-access-settings

Conversation

@jackxuechen

Copy link
Copy Markdown

This PR exposes Android WebView file URL access settings through AndroidWebViewController.

The following Android WebSettings APIs are added:

  • setAllowFileAccessFromFileURLs
  • setAllowUniversalAccessFromFileURLs

These settings allow applications loading local web content using file:// URLs to explicitly configure whether local resources and resources from other origins can be accessed.

This is useful for applications embedding local HTML assets that need to load additional local files or communicate with remote web services.

The APIs are only available on Android and do not affect other WebView implementations.

Issues

N/A

This is an API enhancement request to expose existing Android WebSettings functionality.

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2

@google-cla

google-cla Bot commented Jul 31, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request adds support for configuring file URL access permissions (setAllowFileAccessFromFileURLs and setAllowUniversalAccessFromFileURLs) in the Android WebView plugin. This includes updates to Pigeon definitions, generated Kotlin and Dart bindings, the controller implementation, and corresponding unit tests. The review feedback suggests replacing @NotNull with @NonNull in WebSettingsProxyApi.java to maintain consistency with the rest of the codebase.

@jackxuechen
jackxuechen force-pushed the add-android-file-url-access-settings branch from aeb03e5 to a478ace Compare July 31, 2026 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant