Skip to content

Commit

Permalink
WebView: Permit file reads for PlatformServiceBridge reflection
Browse files Browse the repository at this point in the history
BUG=771783

Change-Id: Iba58f2ebf19d3deb04cda8e6a4d73c7bfbab1efe
Reviewed-on: https://chromium-review.googlesource.com/701371
Reviewed-by: Richard Coles <torne@chromium.org>
Commit-Queue: Paul Miller <paulmiller@chromium.org>
Cr-Commit-Position: refs/heads/master@{#506820}
  • Loading branch information
Paul Miller authored and Commit Bot committed Oct 5, 2017
1 parent 1098538 commit 194754d
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

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;
Expand All @@ -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;
Expand Down

0 comments on commit 194754d

Please sign in to comment.