Abstract ZygoteInit.maybePreload call for webview.

Make ZygoteConnection call ZygoteInit.maybePreload via an overridable
method on itself, so that the WebView zygote's subclass of
ZygoteConnection can override it to do nothing; the WebView zygote
doesn't want to do this preloading and can't due to permissions.

Test: enable multiprocess webview, test webview apps work
Bug: 32735001
Change-Id: Ia6ac7d35172ba69ff861fe5a44b09ac52b0afbf0
This commit is contained in:
Torne (Richard Coles)
2017-01-05 16:11:06 +00:00
parent 3897ad6e84
commit bb65893a24
2 changed files with 10 additions and 1 deletions

View File

@@ -53,6 +53,11 @@ class WebViewZygoteInit {
super(socket, abiList);
}
@Override
protected void maybePreload() {
// Do nothing, we don't need to call ZygoteInit.maybePreload() for the WebView zygote.
}
@Override
protected boolean handlePreloadPackage(String packagePath, String libsPath) {
// Ask ApplicationLoaders to create and cache a classloader for the WebView APK so that

View File

@@ -171,7 +171,7 @@ class ZygoteConnection {
return handleAbiListQuery();
}
ZygoteInit.maybePreload();
maybePreload();
if (parsedArgs.preloadPackage != null) {
return handlePreloadPackage(parsedArgs.preloadPackage,
@@ -279,6 +279,10 @@ class ZygoteConnection {
}
}
protected void maybePreload() {
ZygoteInit.maybePreload();
}
protected boolean handlePreloadPackage(String packagePath, String libsPath) {
throw new RuntimeException("Zyogte does not support package preloading");
}