Android Autofill is a component that provides functionality to use alternative Autofill providers, such as the Android Autofill framework.
It is used exclusively by the //android_webview
embedder (and some deprecated uses inside of Weblayer).
The below diagram shows the main classes involved in //android_autofill
.
┌───────────────────────┐ ┌──────────────────────────┐ │ │ │ │ │AwContents │ │AwContents.java │ │ │ │ │ └───┬─────────▲─────────┘ └───┬──────────────────────┘ │ │ │ │owns 1 │raw ref │ ┌──────────────────────┐ ┌───▼─────────┴─────────┐ │ │ContentAutofillDriver │ │ │ │ │(1 per RFH, │ │WebContents │ │ │ see c/autofill) │ │ │ │ └───┬──────────────────┘ └───┬───────────────────┘ │ │ │ │ │owns │owns │owns ┌───▼──────────────────┐ ┌───▼───────────────────┐ ┌──▼──────────────────────┐ ┌────────────────────────────┐ │ │ │AutofillProviderAndroid├─events──────►│ │ │AutofillManagerWrapper.java │ │AndroidAutofillManager├─events───►│implements │ │AutofillProvider.java │owns─►(wraps Android's │ │ │ │AutofillProvider │◄─ask-to-fill─┤ │ │ AutofillManager) │ └──────────────────────┘ └───┬───────────────────┘ └──┬──────────────────────┘ └────────────────────────────┘ │ │ │ │owns at most 1 │ ┌──▼──────────────────────┐ │ │ │ │ │AutofillRequest.java │ │ │ │ │ └──┬──────────────────────┘ │ │ │owns at most 1 │owns 1 ┌───▼───────────────────┐ ┌──▼──────────────────────┐ │FormDataAndroid │ │ │ │(wraps a FormData) ◄──updates─────►FormDataAndroid.java │ │ │ & references│ │ └───┬───────────────────┘ └──┬──────────────────────┘ │ │ │owns 0 to N │owns 0 to N ┌───▼───────────────────┐ ┌──▼──────────────────────┐ │ │ │ │ │FormFieldDataAndroid ◄──updates─────►FormFieldDataAndroid.java│ │ │ & references│ │ └───────────────────────┘ └─────────────────────────┘
To edit the diagram, copy-paste it to asciiflow.com.
AndroidAutofillManager
:RenderFrameHost
, i.e. potentially multiple instances per WebContents
.AutofillManager
to receive information for various OnX()
events.OnX()
implementations to the AutofillProvider
of the WebContents
(if one exists).AutofillProvider
and forward them to ContentAutofillDriver
.AutofillProviderAndroid
:WebContents
.AutofillProvider
(and is currently the only class to do).FormDataAndroid
, the one related to the current autofill sessionOnAskForValuesToFill
is called. The purpose of an Autofill session is to keep Android's AutofillManager informed about the state of the currently focused form such as its field structure, its field positions, the currently focused field, etc. Autofill sessions are tied to a form in a frame and are represented by AutofillRequests.java
on the Java side.FormDataAndroid
object it owns to keep it in sync with changes on the page.OnX()
methods to its AutofillProvider.java
sibling.FormDataAndroid
:FormData
object and creates a copy of it, which continues to be updated by its parent AutofillProviderAndroid
.FormFieldDataAndroid
objects that represent the form field elements in the form.FormData
and propagate updates to and from its sibling class FormDataAndroid.java
.FormFieldDataAndroid
:FormFieldData
and propagate updates to and from its sibling class FormFieldDataAndroid.java
.AutofillProvider.java
:WebContents
, i.e. AwContents
.AutofillRequest.java
, one AutofillManagerWrapper.java
and multiple helper classes (e.g. for metrics collection).AutofillManagerWrapper.java
, and various metrics/helper classes.AutofillRequest.java
when a new Autofill session is started and forwards updates to it.AutofillRequest.java
to fill virtual view structures for use in Android Autofill.AutofillRequest.java
: Responsibilities:FormDataAndroid.java
and FormFieldDataAndroid.java
: Pure data classes and siblings to the C++ classes of the same name.