This folder holds WebView code that is run under WebView‘s own UID and not within an embedding app, such as global services and developer UI. Because these processes aren’t associated with any particular WebView-embedding app, ContextUtils.getApplicationContext()
will return a Context associated with the WebView provider package itself.
These processes:
ContextUtils.getApplicationContext()
will return a Context associated with the WebView provider package)The :webview_apk
process is typically for user-facing content (ex. Activities). This is the process where developer UI code runs, but it's also the process where the LicenseContentProvider runs.
This process initializes the native library, as the LicenseContentProvider loads license information over JNI/C++.
The :webview_service
process runs in the background and contains non-user-facing components (ex. Services). This is notably used by variations (Finch) to fetch seeds over the network, crash uploading, and Developer UI (to transfer information between the UI and embedded WebViews).
This process does not load the native library (Java-only, no JNI/C++), as we aim to keep this process as light as possible to minimize the impact to the system.
Note: this process may be long-lived. DeveloperUiService may run as a “foreground service,” in which case the system will prioritize this process over most others when the system is low on memory.
We need to take several precautions to make sure our components don't interfere with each other:
android:process=":webview_apk"
.android:process=":webview_service"
to ensure these run in the lightweight service process.android:process
, although this may declare either process depending on what it needs.android:taskAffinity
including the WebView package name, otherwise Activities from different WebView channels will trample each other.