AutofillManager Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The AutofillManager
class provides ways for apps and custom views to
integrate with the Autofill Framework lifecycle.
[Android.Runtime.Register("android/view/autofill/AutofillManager", ApiSince=26, DoNotGenerateAcw=true)]
public sealed class AutofillManager : Java.Lang.Object
[<Android.Runtime.Register("android/view/autofill/AutofillManager", ApiSince=26, DoNotGenerateAcw=true)>]
type AutofillManager = class
inherit Object
- Inheritance
- Attributes
Remarks
The AutofillManager
class provides ways for apps and custom views to integrate with the Autofill Framework lifecycle.
To learn about using Autofill in your app, read the Autofill Framework guides.
<h3 id="autofill-lifecycle">Autofill lifecycle</h3>
The autofill lifecycle starts with the creation of an autofill context associated with an activity context. The autofill context is created when one of the following methods is called for the first time in an activity context, and the current user has an enabled autofill service:
<ul> <li>#notifyViewEntered(View)
<li>#notifyViewEntered(View, int, Rect)
<li>#requestAutofill(View)
</ul>
Typically, the context is automatically created when the first view of the activity is focused because View.onFocusChanged()
indirectly calls #notifyViewEntered(View)
. App developers can call #requestAutofill(View)
to explicitly create it (for example, a custom view developer could offer a contextual menu action in a text-field view to let users manually request autofill).
After the context is created, the Android System creates a android.view.ViewStructure
that represents the view hierarchy by calling View#dispatchProvideAutofillStructure(android.view.ViewStructure, int)
in the root views of all application windows. By default, dispatchProvideAutofillStructure()
results in subsequent calls to View#onProvideAutofillStructure(android.view.ViewStructure, int)
and View#onProvideAutofillVirtualStructure(android.view.ViewStructure, int)
for each view in the hierarchy.
The resulting android.view.ViewStructure
is then passed to the autofill service, which parses it looking for views that can be autofilled. If the service finds such views, it returns a data structure to the Android System containing the following optional info:
<ul> <li>Datasets used to autofill subsets of views in the activity. <li>Id of views that the service can save their values for future autofilling. </ul>
When the service returns datasets, the Android System displays an autofill dataset picker UI associated with the view, when the view is focused on and is part of a dataset. The application can be notified when the UI is shown by registering an AutofillCallback
through #registerCallback(AutofillCallback)
. When the user selects a dataset from the UI, all views present in the dataset are autofilled, through calls to View#autofill(AutofillValue)
or View#autofill(SparseArray)
.
When the service returns ids of savable views, the Android System keeps track of changes made to these views, so they can be used to determine if the autofill save UI is shown later.
The context is then finished when one of the following occurs:
<ul> <li>#commit()
is called or all savable views are gone. <li>#cancel()
is called. </ul>
Finally, after the autofill context is commited (i.e., not cancelled), the Android System shows an autofill save UI if the value of savable views have changed. If the user selects the option to Save, the current value of the views is then sent to the autofill service.
<h3 id="additional-notes">Additional notes</h3>
It is safe to call AutofillManager
methods from any thread.
Java documentation for android.view.autofill.AutofillManager
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Fields
ExtraAssistStructure |
Intent extra: The assist structure which captures the filled screen. |
ExtraAuthenticationResult |
Intent extra: The result of an authentication operation. |
ExtraAuthenticationResultEphemeralDataset |
Intent extra: The optional boolean extra field provided by the
|
ExtraClientState |
Intent extra: The optional extras provided by the
|
ExtraInlineSuggestionsRequest |
Intent extra: the |
Properties
AutofillServiceComponentName |
Returns the component name of the |
AvailableFieldClassificationAlgorithms |
Gets the name of all algorithms currently available for field classification. |
Class |
Returns the runtime class of this |
DefaultFieldClassificationAlgorithm |
Gets the name of the default algorithm used for field classification. |
Handle |
The handle to the underlying Android instance. (Inherited from Object) |
HasEnabledAutofillServices |
Returns |
IsAutofillSupported |
Returns |
IsEnabled |
Checks whether autofill is enabled for the current user. |
IsFieldClassificationEnabled |
Checks if field classification is enabled. |
JniIdentityHashCode | (Inherited from Object) |
JniPeerMembers | |
NextAutofillId |
Gets the next unique autofill ID for the activity context. |
PeerReference | (Inherited from Object) |
ThresholdClass |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
ThresholdType |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
UserData |
Gets the user data used for
field classification. -or- Sets the |
UserDataId |
Gets the id of the |
Methods
Cancel() |
Called to indicate the current autofill context should be cancelled. |
Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
Commit() |
Called to indicate the current autofill context should be commited. |
DisableAutofillServices() |
If the app calling this API has enabled autofill services they will be disabled. |
Dispose() | (Inherited from Object) |
Dispose(Boolean) | (Inherited from Object) |
Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
JavaFinalize() |
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |
Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |
NotifyAll() |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |
NotifyValueChanged(View, Int32, AutofillValue) |
Called to indicate the value of an autofillable virtual view has changed. |
NotifyValueChanged(View) |
Called to indicate the value of an autofillable |
NotifyViewClicked(View, Int32) |
Called to indicate a virtual view has been clicked. |
NotifyViewClicked(View) |
Called to indicate a |
NotifyViewEntered(View, Int32, Rect) |
Called when a virtual view that supports autofill is entered. |
NotifyViewEntered(View) |
Called when a |
NotifyViewExited(View, Int32) |
Called when a virtual view that supports autofill is exited. |
NotifyViewExited(View) |
Called when a |
NotifyViewVisibilityChanged(View, Boolean) |
Called when a |
NotifyViewVisibilityChanged(View, Int32, Boolean) |
Called when a virtual view's visibility changed. |
NotifyVirtualViewsReady(View, SparseArray) |
Called when the virtual views are ready to the user for autofill. |
RegisterCallback(AutofillManager+AutofillCallback) |
Registers a |
RequestAutofill(View, Int32, Rect) |
Explicitly requests a new autofill context for virtual views. |
RequestAutofill(View) |
Explicitly requests a new autofill context. |
SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
ShowAutofillDialog(View, Int32) |
If autofill suggestions for a
dialog-style UI are available for virtual |
ShowAutofillDialog(View) |
If autofill suggestions for a
dialog-style UI are available for |
ToArray<T>() | (Inherited from Object) |
ToString() |
Returns a string representation of the object. (Inherited from Object) |
UnregisterCallback(AutofillManager+AutofillCallback) |
Unregisters a |
UnregisterFromRuntime() | (Inherited from Object) |
Wait() |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>. (Inherited from Object) |
Wait(Int64, Int32) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Wait(Int64) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Explicit Interface Implementations
IJavaPeerable.Disposed() | (Inherited from Object) |
IJavaPeerable.DisposeUnlessReferenced() | (Inherited from Object) |
IJavaPeerable.Finalized() | (Inherited from Object) |
IJavaPeerable.JniManagedPeerState | (Inherited from Object) |
IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from Object) |
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from Object) |
IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from Object) |
Extension Methods
JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
JavaCast<TResult>(IJavaObject) | |
GetJniTypeName(IJavaPeerable) |