• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..16-Feb-2021-

java/H16-Feb-2021-5,6403,947

BUILD.gnH A D16-Feb-20218.8 KiB212195

OWNERSH A D16-Feb-202160 43

README.mdH A D16-Feb-20212.9 KiB6349

webview_apk_application.ccH A D16-Feb-2021597 1910

README.md

1# //android\_webview/nonembedded/
2
3This folder holds WebView code that is run under WebView's own UID and _not_
4within an embedding app, such as global services and developer UI. Because these
5processes aren't associated with any particular WebView-embedding app,
6`ContextUtils.getApplicationContext()` will return a Context associated with the
7WebView provider package itself.
8
9These processes:
10
11- Support commandline flags on debuggable devices
12- Do not support UMA or Finch (we only maintain these for the embedded use case)
13- Do not support talking to the Network Service (that runs in the browser
14  process) or renderer services (those run in the context of the embedding app)
15- Do not support using WebView instances in their UI
16- Are not associated with any particular WebView-embedding app on the system
17- May freely access the WebView provider's data directory, cache directory, etc.
18  (`ContextUtils.getApplicationContext()` will return a Context associated with
19  the WebView provider package)
20
21## UI process
22
23The `:webview_apk` process is typically for user-facing content (ex.
24Activities). This is the process where developer UI code runs, but it's also the
25process where the LicenseContentProvider runs.
26
27This process initializes the native library, as the LicenseContentProvider loads
28license information over JNI/C++.
29
30## Service process
31
32The `:webview_service` process runs in the background and contains
33non-user-facing components (ex. Services). This is notably used by
34variations (Finch) to fetch seeds over the network, crash uploading, and
35Developer UI (to transfer information between the UI and embedded WebViews).
36
37This process does **not** load the native library (Java-only, no JNI/C++), as we
38aim to keep this process as light as possible to minimize the impact to the
39system.
40
41**Note:** this process may be long-lived. DeveloperUiService may run as a
42"foreground service," in which case the system will prioritize this process over
43most others when the system is low on memory.
44
45## Monochrome compatibility
46
47Because Monochrome declares both Chrome's and WebView's
48[components](https://developer.android.com/guide/components/fundamentals#Components),
49we need to take several precautions to make sure these don't interfere with each
50other:
51
52- Activities need to be marked with `android:process=":webview_apk"` to ensure
53  process isolation from Chrome's browser process.
54- Services need to be marked with `android:process=":webview_service"` to ensure
55  the service runs in a separate process from both the UI code and Chrome's
56  code.
57- ContentProviders also need an explicit `android:process`, although this may
58  declare either process depending on what it needs.
59- Activities also need an explicit `android:taskAffinity`, otherwise using the
60  WebView Activity will replace the current Chrome session from the task stack
61  (or vice versa). The taskAffinity should include the WebView package name,
62  otherwise Activities from different WebView channels will trample each other.
63