Commit aea155f4 authored by Torne (Richard Coles)'s avatar Torne (Richard Coles) Committed by Commit Bot

webview: grant URI permission in LicenseActivity.

Android 11 package visibility rules mean that HTMLViewer cannot access
LicenseContentProvider by default, even though the content provider does
not require a permission, because that would reveal the existence of the
package to it.

To fix this, explicitly grant URI access permission in the intent used
to invoke HTMLViewer - while actual permission is not necessary, this
also implicitly grants HTMLViewer the right to "see" the WebView
package.

Note that in most circumstances this was already working without this
change: when an app uses WebView, the platform grants the app
visibility of the current WebView implementation package as a side
effect (so that it can load the code), so as long as the
LicenseActivity belonged to the current WebView there wasn't an issue.
This change is only required for the case where you launch the
LicenseActivity for a *different* WebView implementation.

Change-Id: I7bab033c05d386039c55799328fe0163bc4906ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2404364
Commit-Queue: Richard Coles <torne@chromium.org>
Auto-Submit: Richard Coles <torne@chromium.org>
Reviewed-by: default avatarNate Fischer <ntfschr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805917}
parent 8d5f2eb6
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
<provider # DIFF-ANCHOR: a5e78e63 <provider # DIFF-ANCHOR: a5e78e63
android:authorities="$PACKAGE.LicenseContentProvider" android:authorities="$PACKAGE.LicenseContentProvider"
android:exported="true" android:exported="true"
android:grantUriPermissions="true"
android:name="org.chromium.android_webview.nonembedded.LicenseContentProvider" android:name="org.chromium.android_webview.nonembedded.LicenseContentProvider"
android:process=":webview_apk"> android:process=":webview_apk">
</provider> # DIFF-ANCHOR: a5e78e63 </provider> # DIFF-ANCHOR: a5e78e63
......
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
<provider # DIFF-ANCHOR: a5e78e63 <provider # DIFF-ANCHOR: a5e78e63
android:authorities="$PACKAGE.LicenseContentProvider" android:authorities="$PACKAGE.LicenseContentProvider"
android:exported="true" android:exported="true"
android:grantUriPermissions="true"
android:name="org.chromium.android_webview.nonembedded.LicenseContentProvider" android:name="org.chromium.android_webview.nonembedded.LicenseContentProvider"
android:process=":webview_apk"> android:process=":webview_apk">
</provider> # DIFF-ANCHOR: a5e78e63 </provider> # DIFF-ANCHOR: a5e78e63
......
...@@ -75,6 +75,7 @@ ...@@ -75,6 +75,7 @@
<provider android:name="org.chromium.android_webview.nonembedded.LicenseContentProvider" <provider android:name="org.chromium.android_webview.nonembedded.LicenseContentProvider"
android:exported="true" android:exported="true"
android:authorities="{{ manifest_package }}.LicenseContentProvider" android:authorities="{{ manifest_package }}.LicenseContentProvider"
android:grantUriPermissions="true"
android:process=":webview_apk" /> {# Explicit process required for monochrome compatibility. #} android:process=":webview_apk" /> {# Explicit process required for monochrome compatibility. #}
<!-- Disabled by default, enabled at runtime by Developer UI. --> <!-- Disabled by default, enabled at runtime by Developer UI. -->
<provider android:name="org.chromium.android_webview.services.DeveloperModeContentProvider" <provider android:name="org.chromium.android_webview.services.DeveloperModeContentProvider"
......
...@@ -32,6 +32,7 @@ public class LicenseActivity extends Activity { ...@@ -32,6 +32,7 @@ public class LicenseActivity extends Activity {
String.format("content://%s.%s", packageName, LICENSES_URI_SUFFIX); String.format("content://%s.%s", packageName, LICENSES_URI_SUFFIX);
intent.setDataAndType(Uri.parse(licenseUri), LICENSES_CONTENT_TYPE); intent.setDataAndType(Uri.parse(licenseUri), LICENSES_CONTENT_TYPE);
intent.addCategory(Intent.CATEGORY_DEFAULT); intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
// Resources are accessed via getIdentifier because resource ids in the standalone system // Resources are accessed via getIdentifier because resource ids in the standalone system
// webview apk have incorrect package_ids. In order to access a resource by identifier, you // webview apk have incorrect package_ids. In order to access a resource by identifier, you
// must first add it to //android_webview/aapt2.config. see https://crbug.com/894208 // must first add it to //android_webview/aapt2.config. see https://crbug.com/894208
......
...@@ -825,6 +825,7 @@ ...@@ -825,6 +825,7 @@
<provider # DIFF-ANCHOR: a5e78e63 <provider # DIFF-ANCHOR: a5e78e63
android:authorities="$PACKAGE.LicenseContentProvider" android:authorities="$PACKAGE.LicenseContentProvider"
android:exported="true" android:exported="true"
android:grantUriPermissions="true"
android:name="org.chromium.android_webview.nonembedded.LicenseContentProvider" android:name="org.chromium.android_webview.nonembedded.LicenseContentProvider"
android:process=":webview_apk"> android:process=":webview_apk">
</provider> # DIFF-ANCHOR: a5e78e63 </provider> # DIFF-ANCHOR: a5e78e63
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment