summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/webkit/WebViewFactory.java27
-rw-r--r--core/java/com/android/internal/os/WebViewZygoteInit.java5
2 files changed, 25 insertions, 7 deletions
diff --git a/core/java/android/webkit/WebViewFactory.java b/core/java/android/webkit/WebViewFactory.java
index eb0c44c3a07d..d7a49e46a236 100644
--- a/core/java/android/webkit/WebViewFactory.java
+++ b/core/java/android/webkit/WebViewFactory.java
@@ -59,8 +59,8 @@ public final class WebViewFactory {
// visible for WebViewZygoteInit to look up the class by reflection and call preloadInZygote.
/** @hide */
- public static final String CHROMIUM_WEBVIEW_FACTORY =
- "com.android.webview.chromium.WebViewChromiumFactoryProvider";
+ private static final String CHROMIUM_WEBVIEW_FACTORY =
+ "com.android.webview.chromium.WebViewChromiumFactoryProviderForO";
private static final String CHROMIUM_WEBVIEW_FACTORY_METHOD = "create";
@@ -143,6 +143,23 @@ public final class WebViewFactory {
}
/**
+ * @hide
+ */
+ public static Class<WebViewFactoryProvider> getWebViewProviderClass( ClassLoader clazzLoader)
+ throws ClassNotFoundException{
+ try {
+ return (Class<WebViewFactoryProvider>) Class.forName(CHROMIUM_WEBVIEW_FACTORY,
+ true, clazzLoader);
+ } catch (ClassNotFoundException e) {
+ // TODO: This loads the provider which is not built for O, should be removed
+ // before the release.
+ return (Class<WebViewFactoryProvider>) Class.forName(
+ "com.android.webview.chromium.WebViewChromiumFactoryProvider",
+ true, clazzLoader);
+ }
+ }
+
+ /**
* Load the native library for the given package name iff that package
* name is the same as the one providing the webview.
*/
@@ -366,9 +383,9 @@ public final class WebViewFactory {
Trace.traceBegin(Trace.TRACE_TAG_WEBVIEW, "Class.forName()");
try {
- return (Class<WebViewFactoryProvider>) Class.forName(CHROMIUM_WEBVIEW_FACTORY,
- true, clazzLoader);
- } finally {
+ return getWebViewProviderClass(clazzLoader);
+ }
+ finally {
Trace.traceEnd(Trace.TRACE_TAG_WEBVIEW);
}
} catch (ClassNotFoundException e) {
diff --git a/core/java/com/android/internal/os/WebViewZygoteInit.java b/core/java/com/android/internal/os/WebViewZygoteInit.java
index 12d699d2ae15..d82a211446d3 100644
--- a/core/java/com/android/internal/os/WebViewZygoteInit.java
+++ b/core/java/com/android/internal/os/WebViewZygoteInit.java
@@ -24,6 +24,7 @@ import android.system.Os;
import android.text.TextUtils;
import android.util.Log;
import android.webkit.WebViewFactory;
+import android.webkit.WebViewFactoryProvider;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
@@ -74,8 +75,8 @@ class WebViewZygoteInit {
// call preloadInZygote() on it to give it the opportunity to preload the native library
// and perform any other initialisation work that should be shared among the children.
try {
- Class providerClass = Class.forName(WebViewFactory.CHROMIUM_WEBVIEW_FACTORY, true,
- loader);
+ Class<WebViewFactoryProvider> providerClass =
+ WebViewFactory.getWebViewProviderClass(loader);
Object result = providerClass.getMethod("preloadInZygote").invoke(null);
if (!((Boolean)result).booleanValue()) {
Log.e(TAG, "preloadInZygote returned false");