FillRequest


public final class FillRequest
extends Object implements Parcelable

java.lang.Object
   ↳ android.service.autofill.FillRequest


This class represents a request to an autofill service to interpret the screen and provide information to the system which views are interesting for saving and what are the possible ways to fill the inputs on the screen if applicable.

Summary

Constants

int FLAG_COMPATIBILITY_MODE_REQUEST

Indicates this request was made using compatibility mode.

int FLAG_MANUAL_REQUEST

Indicates autofill was explicitly requested by the user.

int FLAG_SUPPORTS_FILL_DIALOG

Indicates the request supports fill dialog presentation for the fields, the system will send the request when the activity just started.

Inherited constants

Fields

public static final Creator<FillRequest> CREATOR

Public methods

int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

Bundle getClientState()

Gets the latest client state bundle set by the service in a fill response.

IntentSender getDelayedFillIntentSender()

Gets the IntentSender to send a delayed fill response.

List<FillContext> getFillContexts()

Gets the contexts associated with each previous fill request.

int getFlags()

Gets the flags associated with this request.

List<String> getHints()

Sends a list of datatypes for the Autofill Provider.

int getId()

Gets the unique id of this request.

InlineSuggestionsRequest getInlineSuggestionsRequest()

Gets the InlineSuggestionsRequest associated with this request.

String toString()

Returns a string representation of the object.

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

Constants

FLAG_COMPATIBILITY_MODE_REQUEST

Added in API level 29
public static final int FLAG_COMPATIBILITY_MODE_REQUEST

Indicates this request was made using compatibility mode.
Value is either 0 or a combination of FLAG_MANUAL_REQUEST, FLAG_COMPATIBILITY_MODE_REQUEST, android.service.autofill.FillRequest.FLAG_PASSWORD_INPUT_TYPE, android.service.autofill.FillRequest.FLAG_VIEW_NOT_FOCUSED, FLAG_SUPPORTS_FILL_DIALOG, android.service.autofill.FillRequest.FLAG_IME_SHOWING, android.service.autofill.FillRequest.FLAG_RESET_FILL_DIALOG_STATE, android.service.autofill.FillRequest.FLAG_PCC_DETECTION, android.service.autofill.FillRequest.FLAG_SCREEN_HAS_CREDMAN_FIELD, and android.service.autofill.FillRequest.FLAG_VIEW_REQUESTS_CREDMAN_SERVICE

Constant Value: 2 (0x00000002)

FLAG_MANUAL_REQUEST

Added in API level 26
public static final int FLAG_MANUAL_REQUEST

Indicates autofill was explicitly requested by the user.

Users typically make an explicit request to autofill a screen in two situations:

  • The app disabled autofill (using View.setImportantForAutofill(int).
  • The service could not figure out how to autofill a screen (but the user knows the service has data for that app).

This flag is particularly useful for the second case. For example, the service could offer a complex UI where the user can map which screen views belong to each user data, or it could offer a simpler UI where the user picks the data for just the view used to trigger the request (that would be the view whose AssistStructure.ViewNode.isFocused() method returns true).

An explicit autofill request is triggered when the AutofillManager.requestAutofill(View) or AutofillManager.requestAutofill(View, int, android.graphics.Rect) is called. For example, standard TextView views show an AUTOFILL option in the overflow menu that triggers such request.
Value is either 0 or a combination of FLAG_MANUAL_REQUEST, FLAG_COMPATIBILITY_MODE_REQUEST, android.service.autofill.FillRequest.FLAG_PASSWORD_INPUT_TYPE, android.service.autofill.FillRequest.FLAG_VIEW_NOT_FOCUSED, FLAG_SUPPORTS_FILL_DIALOG, android.service.autofill.FillRequest.FLAG_IME_SHOWING, android.service.autofill.FillRequest.FLAG_RESET_FILL_DIALOG_STATE, android.service.autofill.FillRequest.FLAG_PCC_DETECTION, android.service.autofill.FillRequest.FLAG_SCREEN_HAS_CREDMAN_FIELD, and android.service.autofill.FillRequest.FLAG_VIEW_REQUESTS_CREDMAN_SERVICE

Constant Value: 1 (0x00000001)

FLAG_SUPPORTS_FILL_DIALOG

public static final int FLAG_SUPPORTS_FILL_DIALOG

Indicates the request supports fill dialog presentation for the fields, the system will send the request when the activity just started.
Value is either 0 or a combination of FLAG_MANUAL_REQUEST, FLAG_COMPATIBILITY_MODE_REQUEST, android.service.autofill.FillRequest.FLAG_PASSWORD_INPUT_TYPE, android.service.autofill.FillRequest.FLAG_VIEW_NOT_FOCUSED, FLAG_SUPPORTS_FILL_DIALOG, android.service.autofill.FillRequest.FLAG_IME_SHOWING, android.service.autofill.FillRequest.FLAG_RESET_FILL_DIALOG_STATE, android.service.autofill.FillRequest.FLAG_PCC_DETECTION, android.service.autofill.FillRequest.FLAG_SCREEN_HAS_CREDMAN_FIELD, and android.service.autofill.FillRequest.FLAG_VIEW_REQUESTS_CREDMAN_SERVICE

Constant Value: 64 (0x00000040)

Fields

CREATOR

Added in API level 26
public static final Creator<FillRequest> CREATOR

Public methods

describeContents

Added in API level 26
public int describeContents ()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel, int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or CONTENTS_FILE_DESCRIPTOR

getClientState

Added in API level 26
public Bundle getClientState ()

Gets the latest client state bundle set by the service in a fill response.

Note: Prior to Android Build.VERSION_CODES.P, only client state bundles set by FillResponse.Builder.setClientState(Bundle) were considered. On Android Build.VERSION_CODES.P and higher, bundles set in the result of an authenticated request through the AutofillManager.EXTRA_CLIENT_STATE extra are also considered (and take precedence when set).

Returns
Bundle The client state. This value may be null.

getDelayedFillIntentSender

Added in API level 33
public IntentSender getDelayedFillIntentSender ()

Gets the IntentSender to send a delayed fill response.

The autofill service must first indicate that it wants to return a delayed FillResponse by setting FillResponse.FLAG_DELAY_FILL in a successful fill response. Then it can use this IntentSender to send an Intent with extra AutofillService.EXTRA_FILL_RESPONSE with the delayed response.

Note that this may be null if a delayed fill response is not supported for this fill request.

Returns
IntentSender

getFillContexts

Added in API level 26
public List<FillContext> getFillContexts ()

Gets the contexts associated with each previous fill request.

Note: Starting on Android Build.VERSION_CODES.Q, it could also include contexts from requests whose SaveInfo had the SaveInfo.FLAG_DELAY_SAVE flag.

Returns
List<FillContext> This value cannot be null.

getFlags

Added in API level 26
public int getFlags ()

Gets the flags associated with this request.

Returns
int any combination of FLAG_MANUAL_REQUEST, FLAG_SUPPORTS_FILL_DIALOG and FLAG_COMPATIBILITY_MODE_REQUEST. Value is either 0 or a combination of FLAG_MANUAL_REQUEST, FLAG_COMPATIBILITY_MODE_REQUEST, android.service.autofill.FillRequest.FLAG_PASSWORD_INPUT_TYPE, android.service.autofill.FillRequest.FLAG_VIEW_NOT_FOCUSED, FLAG_SUPPORTS_FILL_DIALOG, android.service.autofill.FillRequest.FLAG_IME_SHOWING, android.service.autofill.FillRequest.FLAG_RESET_FILL_DIALOG_STATE, android.service.autofill.FillRequest.FLAG_PCC_DETECTION, android.service.autofill.FillRequest.FLAG_SCREEN_HAS_CREDMAN_FIELD, and android.service.autofill.FillRequest.FLAG_VIEW_REQUESTS_CREDMAN_SERVICE

getHints

Added in API level 34
public List<String> getHints ()

Sends a list of datatypes for the Autofill Provider. If this is populated, Autofill Provider should return data for the autofill hints requested here, even though the Autofill Provider may not have detected these types. The hints would be part of HintConstants: https://developer.android.com/reference/androidx/autofill/HintConstants This is populated if the platform's field detection is enabled.

Returns
List<String> This value cannot be null.

getId

Added in API level 26
public int getId ()

Gets the unique id of this request.

Returns
int

getInlineSuggestionsRequest

Added in API level 30
public InlineSuggestionsRequest getInlineSuggestionsRequest ()

Gets the InlineSuggestionsRequest associated with this request.

Autofill Framework will send a @non-null InlineSuggestionsRequest if currently inline suggestions are supported and can be displayed. If the Autofill service wants to show inline suggestions, they may return Dataset with valid InlinePresentation.

The Autofill Service must set supportsInlineSuggestions in its XML to enable support for inline suggestions.

Returns
InlineSuggestionsRequest the suggestionspec

toString

Added in API level 26
public String toString ()

Returns a string representation of the object.

Returns
String a string representation of the object.

writeToParcel

Added in API level 26
public void writeToParcel (Parcel dest, 
                int flags)

Flatten this object in to a Parcel.

Parameters
dest Parcel: This value cannot be null.

flags int: Additional flags about how the object should be written. May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES