WebEngine is an embedded web UI component offering a modern, secure set of web embedding capabilities as part of Android.
WebEngine is based on the WebLayer project; a high level embedding API to support building a browser.
Note: The WebLayer API is deprecated as of M108, and WebLayer is being merged into the WebEngine project.
Unlike src/content
, which is only concerned with a sandboxed multi-process web platform, WebLayer includes modern browser features and Google integration. It's the reusable version of Chrome, which might share some portions of the UI and also its support for all the modern HTML5 and browser features (e.g. UI for permissions, autofill, safe browsing etc...).
While it's built on top of src/content
, the expectation is that the API will hide the Content API.
WebEngine further abstracts away the full set of capabilities of WebLayer, with a simple API surface focused on the following goals:
Most of these goals can be achieved via moving the browser component to run in a sandbox. While such as a sandbox does not yet exist within Android, WebEngine is still being developed with the aim to eventually create a security boundary between the embedder/host app and the browser. A non-sandboxed mode with the same API surface is being developed for compatibility, and a sandboxed mode with a limited makeshift sandbox is also being developed for testing.
Note: weblayer is still referenced a lot in this directory, all references will eventually be changed to webengine.
Bug tracker: Internals>WebLayer
public
the C++ and Java public API. These are the only files an app should use
shell
sample app
test
test harnesses and test-only helper code
tools
helper scripts
app
internal code which runs at the beginning of each process
browser
internal code which runs in the browser process
common
internal code which runs in the browser and child processes
renderer
internal code which runs in the renderer process
utility
internal code which runs in the utility process
If you haven't done this already, you first need to set up an Android build. Android build instructions.
To run the sample app:
$ autoninja -C out/Default run_webengine_shell_local $ out/Default/bin/run_webengine_shell_local
To run the sample app with a browsing sandbox (limited capabilities):
$ autoninja -C out/Default run_webengine_shell $ out/Default/bin/run_webengine_shell
To run instrumentation tests:
$ autoninja -C out/Default webengine_support_instrumentation_test_apk $ out/Default/bin/run_webengine_support_instrumentation_test_apk
The scripts will build and install all necessary APKs.
Command line flags can be set via the build/android/adb_system_webengine_command_line script.
Force enabling metrics reporting:
$ build/android/adb_system_webengine_command_line --force-enable-metrics-reporting