Cherry pick Load the WebView Java code from an APK. DO NOT MERGE
Use the WebView APK to load the Java code via createPackageContext. Original Bug: 16329371 Original Change-Id: I1292edab639d85c2027dc8ebb52def8c36d41cde Bug: 16723226 Change-Id: I8e692a5e12706f91a8af0a8b385bac336ce60913
This commit is contained in:
committed by
Ben Murdoch
parent
732af43eb1
commit
6c778cebc7
@@ -16,6 +16,9 @@
|
||||
|
||||
package android.webkit;
|
||||
|
||||
import android.app.AppGlobals;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Process;
|
||||
import android.os.RemoteException;
|
||||
@@ -100,9 +103,14 @@ public final class WebViewFactory {
|
||||
|
||||
private static Class<WebViewFactoryProvider> getFactoryClass() throws ClassNotFoundException {
|
||||
try {
|
||||
return (Class<WebViewFactoryProvider>) Class.forName(CHROMIUM_WEBVIEW_FACTORY);
|
||||
} catch (ClassNotFoundException e) {
|
||||
Log.e(LOGTAG, "Chromium WebView does not exist");
|
||||
Context webViewContext = AppGlobals.getInitialApplication().createPackageContext(
|
||||
getWebViewPackageName(),
|
||||
Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY);
|
||||
ClassLoader clazzLoader = webViewContext.getClassLoader();
|
||||
return (Class<WebViewFactoryProvider>) Class.forName(CHROMIUM_WEBVIEW_FACTORY, true,
|
||||
clazzLoader);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.e(LOGTAG, "Chromium WebView package does not exist");
|
||||
return (Class<WebViewFactoryProvider>) Class.forName(NULL_WEBVIEW_FACTORY);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user