Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.

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_MANUAL_REQUEST

Indicates autofill was explicitly requested by the user.

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.

List<FillContext> getFillContexts()

Gets the contexts associated with each previous fill request.

int getFlags()

Gets the flags associated with this request.

int getId()

Gets the unique id of this request.

String toString()

Returns a string representation of the object.

void writeToParcel(Parcel parcel, int flags)

Flatten this object in to a Parcel.

Inherited methods

Constants

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.

Constant Value: 1 (0x00000001)

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(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.

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.

getFillContexts

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

Gets the contexts associated with each previous fill request.

Returns
List<FillContext>

This value will never be null.

getFlags

added in API level 26
public int getFlags ()

Gets the flags associated with this request.

Returns
int

Value is either 0 or FLAG_MANUAL_REQUEST.

getId

added in API level 26
public int getId ()

Gets the unique id of this request.

Returns
int

toString

added in API level 26
public String toString ()

Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
String a string representation of the object.

writeToParcel

added in API level 26
public void writeToParcel (Parcel parcel, 
                int flags)

Flatten this object in to a Parcel.

Parameters
parcel Parcel: The Parcel in which the object should be written.

flags int: Additional flags about how the object should be written. May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE.