History log of /frameworks/base/core/java/android/webkit/WebViewZygote.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
e062404371586043f823183d583985f42ba03118 13-Mar-2018 Torne (Richard Coles) <torne@google.com> Start the webview_zygote at boot, but in the background.

This reverts "Delay starting the webview_zygote until first use." but
instead wraps the start in a background task, to avoid blocking the
system server startup waiting for the zygote to be ready.

Bug: 73743583
Bug: 63749735
Bug: 74079433
Test: Verify webview_zygote already running after boot
Change-Id: Iacf968cc2d2857a92c6bacf4012dc88f098c6013
/frameworks/base/core/java/android/webkit/WebViewZygote.java
ffc4dd720d3487209afd639a577b2962784291a3 28-Feb-2018 Robert Sesek <rsesek@google.com> Merge "Delay starting the webview_zygote until first use." am: 6d9d717ab7 am: 99440a0ab8
am: 92697692b3

Change-Id: I4f810427f083d9b7874df7d90fc00a33967d9323
b21dbc220fb0ef6d316886ae40e9e3a6acf205c4 26-Feb-2018 Robert Sesek <rsesek@google.com> Delay starting the webview_zygote until first use.

During boot, WebViewZygote.setMultiprocessEnabled() is called by the
WebView initialization logic. Starting the WebViewZygote here causes a
slowdown in the system_server boot process, so delay launching the
zygote until it is needed.

Previously the webview_zygote was launched by init, and merely
connecting to it in the boot process didn't have significant overhead.

Bug: 73743583
Bug: 63749735
Test: Boot a device, verify that webview_zygote process is not running.
Test: Launch "Third-party licenses" activity from Settings, and it
renders correctly via the WebView.

Change-Id: I1352a5df95e4a793ac64862c439ba2573ddd2d18
/frameworks/base/core/java/android/webkit/WebViewZygote.java
f4f647e2e049cdb42cb7285dbaf41664682bdb44 21-Feb-2018 Torne (Richard Coles) <torne@google.com> Preload with RELRO sharing in the WebView zygote.

Now that the WebView zygote is a child of the system zygote it has the
smae address space layout and can use the existing WebView native
library RELRO file.

Preload the native library using the RELRO file in the zygote, to share
this data with applications which are using WebView. This can save up to
1-2MB of dirty memory, replacing it with clean pages that are shared
with more processes and thus have a smaller impact on PSS.

Bug: 63749735
Test: CtsWebkitTests
Change-Id: I7ce670f5fcddae9e98631e21329840ef3ad52f9a
/frameworks/base/core/java/android/webkit/WebViewZygote.java
f9bd606fbadb9a8595b0074aebf35f35d166aba8 21-Feb-2018 Robert Sesek <rsesek@google.com> Merge "Reparent the webview_zygote to be a child of the main app_process zygote." am: 1c81aa6375 am: 486190f87b
am: 0dd7cf0bb3

Change-Id: I9468ec63053f35814ec45b18572966d8adc93f3e
602d1323ed1e8937fc6f1602ab95c2cfdb0499d4 18-Jan-2018 Robert Sesek <rsesek@google.com> Reparent the webview_zygote to be a child of the main app_process zygote.

This uses the new ZygoteProcess.startChildZygote() method to launch the
webview_zygote, rather than having init start it. This will share more
memory between the app_process and the webview_zygote, reducing the
overall system footprint.

Bug: 63749735
Test: m
Test: Launch "Third-party licenses" activity from Settings, and it
renders correctly via the WebView.
Change-Id: I3e39cd8adb9c099c92ee34640428916d90cb2b8f
/frameworks/base/core/java/android/webkit/WebViewZygote.java
5bc14af5fa7f62dabcd882cb894160ef4ddcbf87 19-Sep-2017 Torne (Richard Coles) <torne@google.com> Consider shared libs when precreating WebView classloader.

The change to handling of the deprecated Apache HTTP library means that
the WebView implementation package might have a non-empty shared library
list. Make sure to fetch shared libraries when querying WebView
implementations, and take them into account when constructing both the
actual classpath to be used to precreate the classloader, and when
deciding what the cache key for the precreated classloader should be.

Change-Id: I5e1409358d935e1c9f325db434bc6d4ef8ead759
Merged-In: I5e1409358d935e1c9f325db434bc6d4ef8ead759
Fixes: 65574359
Test: launch anything that uses WebView
(cherry picked from commit 4fd8aa51e4de5a7c93841571e30ff10077d1b125)
/frameworks/base/core/java/android/webkit/WebViewZygote.java
4fd8aa51e4de5a7c93841571e30ff10077d1b125 19-Sep-2017 Torne (Richard Coles) <torne@google.com> Consider shared libs when precreating WebView classloader.

The change to handling of the deprecated Apache HTTP library means that
the WebView implementation package might have a non-empty shared library
list. Make sure to fetch shared libraries when querying WebView
implementations, and take them into account when constructing both the
actual classpath to be used to precreate the classloader, and when
deciding what the cache key for the precreated classloader should be.

Change-Id: I5e1409358d935e1c9f325db434bc6d4ef8ead759
Fixes: 65574359
Test: launch anything that uses WebView
/frameworks/base/core/java/android/webkit/WebViewZygote.java
0a6140d2173052b4fa753c9ea61f92814cbced6e 05-Sep-2017 Nate Fischer <ntfschr@google.com> WebView: wrap Java literals with {@code}

Docs change only.

This wraps some Java literals (true, false, null) with {@code} blocks,
as per Android API guidelines.

This also addresses other presubmit errors:

* fix lines that have become too long
* fix broken import order and unused imports

Bug: 65213517
Test: make docs (and manually verify things look better)
Change-Id: Idc7fe28d40bea7bd1edcad539b75fa9c689b8d46
/frameworks/base/core/java/android/webkit/WebViewZygote.java
f0c52b5e9c498c31a963232a008ca43836ebc32a 27-Apr-2017 Gustav Sennton <gsennton@google.com> Add a time-out for connecting to SystemServer, and WebView, zygotes.

We wait for both the system server and the WebView zygotes, using
infinite loops.
This CL adds a time-out to both these loops.

Bug: 37654329
Test: Boot device, disable Chrome, enable Chrome, then start a WebView
app.

Change-Id: I74397de3caf2b02ee403195aeb3beb2320a2240d
/frameworks/base/core/java/android/webkit/WebViewZygote.java
833813cecc357a9d9bda28917a931a9a9539cd37 24-Apr-2017 Gustav Sennton <gsennton@google.com> Explicitly wait for the WebView Zygote.

There is a time-window during which the WebViewZygote service has
started, but can't be connected to. To avoid crashing during this
time-window we add a retry-loop in this CL to explicitly initiate a
connection to the Zygote.

Bug: 36687066
Test: gts-tradefed run gts --module GtsWebViewHostTestCases
Change-Id: Ia58a3342cd4e149621ba6b4aaf926e7b53c06d8f
/frameworks/base/core/java/android/webkit/WebViewZygote.java
0452670374ebb2a22d2dc44c030f7b43173800c0 13-Jan-2017 Torne (Richard Coles) <torne@google.com> Support loading a stub WebView using a donor package.

Support loading a WebView package which specifies the name of a "donor"
that provides missing files. This allows a preinstalled stub WebView to
function by loading its code and assets from the preinstalled Monochrome
implementation, as long as the versions are close enough that the
manifest contents are compatible, which should be fine since
preinstalled versions will match.

To do this, we replace the stub's code paths in AppplicationInfo with
the donor's, so that all Java and native code and resources are loaded
from the donor APK at runtime instead of from the (mostly empty) stub.

To get the ClassLoader with the modified path cached as if it was the
regular path, we introduce a new "cacheKey" parameter in
ApplicationLoaders.

Bug: 21643067
Test: build "new" stub WebView upstream in chromium and test loading
Change-Id: I08cc9122b1c9def3e1206974f3e0e8973cca3419
/frameworks/base/core/java/android/webkit/WebViewZygote.java
f05f99b9106ab6dffcf71735f0f7c269ad23282e 22-Mar-2017 Gustav Sennton <gsennton@google.com> Post WebView Zygote connection code to a background thread.

Currently, the act of waiting for the WebView Zygote to start running,
and then connecting to it is run in a blocking way from
WebViewZygote.onWebViewProviderChanged(). This causes us to block large
parts of WebViewUpdateService for a long time whenever we change WebView
provider.
This CL moves the blocking code onto a background thread to unblock
WebViewUpdateService.

Bug: 35025131
Test: Ensure changing WebView provider from the WebView Implementation
Developer Setting is quick/responsive.
Test: Turn off WebView multi-process and ensure the WebView Zygote
Service is NOT started.
Test: Turn on WebView multi-process and ensure the WebView Zygote
Service is started.

Change-Id: I0b378a471491d40cbf027568ca317d6c080da4b2
/frameworks/base/core/java/android/webkit/WebViewZygote.java
638d81009918eae44eec3261e235b78eae44331d 23-Feb-2017 Dimitry Ivanov <dimitry@google.com> Add isBundled argument to LoadedApk.makePaths call

There is a disconnect between the way webview created
classloader and the way makePaths decides if paths are
intended for bundled app.

This change moves decision making out of makePaths method
which allows WebViewZygote to pass correct argument and
have makePath omit java.library.path for libPaths

Bug: http://b/35426785
Test: manual
Change-Id: Iab5a18c0091d0193dafa750498eb00f378411ba0
/frameworks/base/core/java/android/webkit/WebViewZygote.java
89cc5205b3b54b85c584583760d07af7049e6e28 16-Dec-2016 Robert Sesek <rsesek@google.com> Synchronize access to WebViewZygote.

The onWebViewProviderChanged callback can be entered from a binder thread,
rather than the system_server main thread. This could lead to races when
managing the webview_zygote.

Test: m
Test: Turn on Multiprocess WebView, install a new WebView provider, then
instantiate a new WebView. The new WebView should load (note that
this is racy so may require multiple attempts to test).

Bug: 21643067
Change-Id: I28512906c38e073d4e3d39a2f2b30dcbb50c85ff
/frameworks/base/core/java/android/webkit/WebViewZygote.java
c5f86647b19d5cac4d9874ef84954fcf7a6d5fa9 04-Nov-2016 Robert Sesek <rsesek@google.com> Add new hostingType for startProcessLocked() that selects using the WebViewZygote.

Test: m
Test: angler boots
Test: Turn on Multiprocess WebView in Developer Options and launch the WebView
Shell. The sandboxed_service parent process is the webview_zygote.

Bug: 21643067
Change-Id: I9dab548853372fd91f6bbe204cc8686ef2e94448
/frameworks/base/core/java/android/webkit/WebViewZygote.java
3b6ca99b1069e8f303727a00c1da7acabe017fd8 10-Oct-2016 Torne (Richard Coles) <torne@google.com> Precreate the classloader for the WebView.

We want to create the classloader for the WebView in advance in the
zygote so that it can preload Java and native code for its children, but
the zygote can't talk to the package manager (so doesn't have a
PackageInfo for the APK) and also doesn't have an ActivityThread, so
constructing a LoadedApk is difficult.

Instead, we use the fact that ApplicationLoaders contains a
process-global cache of classloaders for APKs, and prepopulate a cache
entry without constructing a LoadedApk. This requires making
ApplicationLoaders public. To calculate the correct library paths from
the information the zygote has, we reuse the logic in LoadedApk (which
is already public, and just needs a small change to allow a null
ActivityThread when checking for instrumentation).

The other parameters for classloader creation (target SDK, bundled app,
etc) are hardcoded to usable values for the WebView's case. WebView
never needs to use any system libraries that aren't public so claiming
it's not bundled is fine even when that isn't actually true, and WebView
will always target the current platform API level.

Once the classloader is created, look up the factory class and call
preloadInZygote on it to give it a chance to preload the native library
and do other shared initialisation.

Bug: 21643067
Test: enable multiprocess WebView, examine librank output to see sharing
Change-Id: I696ead637e3f7382bcc58cfaf61eac5921862015
/frameworks/base/core/java/android/webkit/WebViewZygote.java
ded209843616a98e6f97db0d1784f6d630cbd5e9 15-Aug-2016 Robert Sesek <rsesek@google.com> Create the WebViewZygote and implement WebViewZygoteInit.

This adds a new init-spawned daemon, webview_zygote, that starts a JVM and
acts as a zygote process for WebView isolated_app services.

Test: m
Test: angler boots
Test: Turn on Settings>Developer>Multiprocess Webview. webview_zygote32 or
webview_zygote64 start (requires dependent CLs).

Bug: 21643067
Change-Id: Ida98bd04b4d77736b672b03af651c4eb97ce88c1
/frameworks/base/core/java/android/webkit/WebViewZygote.java