Commit 194754db authored by Paul Miller's avatar Paul Miller Committed by Commit Bot

WebView: Permit file reads for PlatformServiceBridge reflection

BUG=771783

Change-Id: Iba58f2ebf19d3deb04cda8e6a4d73c7bfbab1efe
Reviewed-on: https://chromium-review.googlesource.com/701371Reviewed-by: default avatarRichard Coles <torne@chromium.org>
Commit-Queue: Paul Miller <paulmiller@chromium.org>
Cr-Commit-Position: refs/heads/master@{#506820}
parent 1098538e
......@@ -6,6 +6,7 @@ package org.chromium.android_webview;
import org.chromium.base.Callback;
import org.chromium.base.Log;
import org.chromium.base.StrictModeContext;
import org.chromium.base.ThreadUtils;
import java.lang.reflect.InvocationTargetException;
......@@ -24,12 +25,14 @@ public class PlatformServiceBridge {
protected PlatformServiceBridge() {}
@SuppressWarnings("unused")
public static PlatformServiceBridge getInstance() {
synchronized (sInstanceLock) {
if (sInstance != null) return sInstance;
// Try to get a specialized service bridge.
try {
// Try to get a specialized service bridge. Starting with Android O, failed reflection
// may cause file reads. The reflection will go away soon: https://crbug.com/682070
try (StrictModeContext unused = StrictModeContext.allowDiskReads()) {
Class<?> cls = Class.forName(PLATFORM_SERVICE_BRIDGE);
sInstance = (PlatformServiceBridge) cls.getDeclaredConstructor().newInstance();
return sInstance;
......
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