Loading core/java/android/service/autofill/Dataset.java +38 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.service.autofill; import static android.view.autofill.Helper.sDebug; import android.annotation.Hide; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; Loading @@ -26,6 +27,7 @@ import android.annotation.SystemApi; import android.annotation.TestApi; import android.content.ClipData; import android.content.IntentSender; import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import android.util.ArrayMap; Loading Loading @@ -187,6 +189,9 @@ public final class Dataset implements Parcelable { @Nullable private final InlinePresentation mInlinePresentation; @Nullable private final InlinePresentation mInlineTooltipPresentation; private final IntentSender mAuthentication; @Nullable private final Bundle mAuthenticationExtras; @Nullable String mId; /** Loading Loading @@ -224,6 +229,7 @@ public final class Dataset implements Parcelable { mInlinePresentation = inlinePresentation; mInlineTooltipPresentation = inlineTooltipPresentation; mAuthentication = authentication; mAuthenticationExtras = null; mId = id; } Loading @@ -246,6 +252,7 @@ public final class Dataset implements Parcelable { mInlinePresentation = dataset.mInlinePresentation; mInlineTooltipPresentation = dataset.mInlineTooltipPresentation; mAuthentication = dataset.mAuthentication; mAuthenticationExtras = dataset.mAuthenticationExtras; mId = dataset.mId; mAutofillDatatypes = dataset.mAutofillDatatypes; } Loading @@ -264,6 +271,7 @@ public final class Dataset implements Parcelable { mInlinePresentation = builder.mInlinePresentation; mInlineTooltipPresentation = builder.mInlineTooltipPresentation; mAuthentication = builder.mAuthentication; mAuthenticationExtras = builder.mAuthenticationExtras; mId = builder.mId; mAutofillDatatypes = builder.mAutofillDatatypes; } Loading Loading @@ -344,6 +352,12 @@ public final class Dataset implements Parcelable { return mAuthentication; } /** @hide */ @Hide public @Nullable Bundle getAuthenticationExtras() { return mAuthenticationExtras; } /** @hide */ @TestApi public boolean isEmpty() { Loading Loading @@ -401,6 +415,9 @@ public final class Dataset implements Parcelable { if (mAuthentication != null) { builder.append(", hasAuthentication"); } if (mAuthenticationExtras != null) { builder.append(", hasAuthenticationExtras"); } if (mAutofillDatatypes != null) { builder.append(", autofillDatatypes=").append(mAutofillDatatypes); } Loading Loading @@ -454,6 +471,8 @@ public final class Dataset implements Parcelable { @Nullable private InlinePresentation mInlinePresentation; @Nullable private InlinePresentation mInlineTooltipPresentation; private IntentSender mAuthentication; private Bundle mAuthenticationExtras; private boolean mDestroyed; @Nullable private String mId; Loading Loading @@ -623,6 +642,25 @@ public final class Dataset implements Parcelable { return this; } /** * Sets extras to be associated with the {@code authentication} intent sender, to be * set on the intent that is fired through the intent sender. * * Autofill providers can set any extras they wish to receive directly on the intent * that is used to create the {@code authentication}. This is an internal API, to be * used by the platform to associate data with a given dataset. These extras will be * merged with the {@code clientState} and sent as part of the fill in intent when * the {@code authentication} intentSender is invoked. * * @hide */ @Hide public @NonNull Builder setAuthenticationExtras(@Nullable Bundle authenticationExtra) { throwIfDestroyed(); mAuthenticationExtras = authenticationExtra; return this; } /** * Sets the id for the dataset so its usage can be tracked. * Loading core/java/android/view/autofill/AutofillManager.java +6 −0 Original line number Diff line number Diff line Loading @@ -276,6 +276,12 @@ public final class AutofillManager { public static final String EXTRA_CLIENT_STATE = "android.view.autofill.extra.CLIENT_STATE"; /** * @hide */ public static final String EXTRA_AUTH_STATE = "android.view.autofill.extra.AUTH_STATE"; /** * Intent extra: the {@link android.view.inputmethod.InlineSuggestionsRequest} in the * autofill request. Loading services/autofill/java/com/android/server/autofill/Session.java +8 −3 Original line number Diff line number Diff line Loading @@ -2437,7 +2437,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState + id + " destroyed"); return; } fillInIntent = createAuthFillInIntentLocked(requestId, extras); fillInIntent = createAuthFillInIntentLocked(requestId, extras, /* authExtras= */ null); if (fillInIntent == null) { forceRemoveFromServiceLocked(); return; Loading Loading @@ -5558,7 +5558,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState mPresentationStatsEventLogger.maybeSetAuthenticationType( AUTHENTICATION_TYPE_DATASET_AUTHENTICATION); setViewStatesLocked(null, dataset, ViewState.STATE_WAITING_DATASET_AUTH, false); final Intent fillInIntent = createAuthFillInIntentLocked(requestId, mClientState); final Intent fillInIntent = createAuthFillInIntentLocked(requestId, mClientState, dataset.getAuthenticationExtras()); if (fillInIntent == null) { forceRemoveFromServiceLocked(); return; Loading @@ -5574,7 +5575,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState // TODO: this should never be null, but we got at least one occurrence, probably due to a race. @GuardedBy("mLock") @Nullable private Intent createAuthFillInIntentLocked(int requestId, Bundle extras) { private Intent createAuthFillInIntentLocked(int requestId, Bundle extras, @Nullable Bundle authExtras) { final Intent fillInIntent = new Intent(); final FillContext context = getFillContextByRequestIdLocked(requestId); Loading @@ -5591,6 +5593,9 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState } fillInIntent.putExtra(AutofillManager.EXTRA_ASSIST_STRUCTURE, context.getStructure()); fillInIntent.putExtra(AutofillManager.EXTRA_CLIENT_STATE, extras); if (authExtras != null) { fillInIntent.putExtra(AutofillManager.EXTRA_AUTH_STATE, authExtras); } return fillInIntent; } Loading Loading
core/java/android/service/autofill/Dataset.java +38 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.service.autofill; import static android.view.autofill.Helper.sDebug; import android.annotation.Hide; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; Loading @@ -26,6 +27,7 @@ import android.annotation.SystemApi; import android.annotation.TestApi; import android.content.ClipData; import android.content.IntentSender; import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import android.util.ArrayMap; Loading Loading @@ -187,6 +189,9 @@ public final class Dataset implements Parcelable { @Nullable private final InlinePresentation mInlinePresentation; @Nullable private final InlinePresentation mInlineTooltipPresentation; private final IntentSender mAuthentication; @Nullable private final Bundle mAuthenticationExtras; @Nullable String mId; /** Loading Loading @@ -224,6 +229,7 @@ public final class Dataset implements Parcelable { mInlinePresentation = inlinePresentation; mInlineTooltipPresentation = inlineTooltipPresentation; mAuthentication = authentication; mAuthenticationExtras = null; mId = id; } Loading @@ -246,6 +252,7 @@ public final class Dataset implements Parcelable { mInlinePresentation = dataset.mInlinePresentation; mInlineTooltipPresentation = dataset.mInlineTooltipPresentation; mAuthentication = dataset.mAuthentication; mAuthenticationExtras = dataset.mAuthenticationExtras; mId = dataset.mId; mAutofillDatatypes = dataset.mAutofillDatatypes; } Loading @@ -264,6 +271,7 @@ public final class Dataset implements Parcelable { mInlinePresentation = builder.mInlinePresentation; mInlineTooltipPresentation = builder.mInlineTooltipPresentation; mAuthentication = builder.mAuthentication; mAuthenticationExtras = builder.mAuthenticationExtras; mId = builder.mId; mAutofillDatatypes = builder.mAutofillDatatypes; } Loading Loading @@ -344,6 +352,12 @@ public final class Dataset implements Parcelable { return mAuthentication; } /** @hide */ @Hide public @Nullable Bundle getAuthenticationExtras() { return mAuthenticationExtras; } /** @hide */ @TestApi public boolean isEmpty() { Loading Loading @@ -401,6 +415,9 @@ public final class Dataset implements Parcelable { if (mAuthentication != null) { builder.append(", hasAuthentication"); } if (mAuthenticationExtras != null) { builder.append(", hasAuthenticationExtras"); } if (mAutofillDatatypes != null) { builder.append(", autofillDatatypes=").append(mAutofillDatatypes); } Loading Loading @@ -454,6 +471,8 @@ public final class Dataset implements Parcelable { @Nullable private InlinePresentation mInlinePresentation; @Nullable private InlinePresentation mInlineTooltipPresentation; private IntentSender mAuthentication; private Bundle mAuthenticationExtras; private boolean mDestroyed; @Nullable private String mId; Loading Loading @@ -623,6 +642,25 @@ public final class Dataset implements Parcelable { return this; } /** * Sets extras to be associated with the {@code authentication} intent sender, to be * set on the intent that is fired through the intent sender. * * Autofill providers can set any extras they wish to receive directly on the intent * that is used to create the {@code authentication}. This is an internal API, to be * used by the platform to associate data with a given dataset. These extras will be * merged with the {@code clientState} and sent as part of the fill in intent when * the {@code authentication} intentSender is invoked. * * @hide */ @Hide public @NonNull Builder setAuthenticationExtras(@Nullable Bundle authenticationExtra) { throwIfDestroyed(); mAuthenticationExtras = authenticationExtra; return this; } /** * Sets the id for the dataset so its usage can be tracked. * Loading
core/java/android/view/autofill/AutofillManager.java +6 −0 Original line number Diff line number Diff line Loading @@ -276,6 +276,12 @@ public final class AutofillManager { public static final String EXTRA_CLIENT_STATE = "android.view.autofill.extra.CLIENT_STATE"; /** * @hide */ public static final String EXTRA_AUTH_STATE = "android.view.autofill.extra.AUTH_STATE"; /** * Intent extra: the {@link android.view.inputmethod.InlineSuggestionsRequest} in the * autofill request. Loading
services/autofill/java/com/android/server/autofill/Session.java +8 −3 Original line number Diff line number Diff line Loading @@ -2437,7 +2437,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState + id + " destroyed"); return; } fillInIntent = createAuthFillInIntentLocked(requestId, extras); fillInIntent = createAuthFillInIntentLocked(requestId, extras, /* authExtras= */ null); if (fillInIntent == null) { forceRemoveFromServiceLocked(); return; Loading Loading @@ -5558,7 +5558,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState mPresentationStatsEventLogger.maybeSetAuthenticationType( AUTHENTICATION_TYPE_DATASET_AUTHENTICATION); setViewStatesLocked(null, dataset, ViewState.STATE_WAITING_DATASET_AUTH, false); final Intent fillInIntent = createAuthFillInIntentLocked(requestId, mClientState); final Intent fillInIntent = createAuthFillInIntentLocked(requestId, mClientState, dataset.getAuthenticationExtras()); if (fillInIntent == null) { forceRemoveFromServiceLocked(); return; Loading @@ -5574,7 +5575,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState // TODO: this should never be null, but we got at least one occurrence, probably due to a race. @GuardedBy("mLock") @Nullable private Intent createAuthFillInIntentLocked(int requestId, Bundle extras) { private Intent createAuthFillInIntentLocked(int requestId, Bundle extras, @Nullable Bundle authExtras) { final Intent fillInIntent = new Intent(); final FillContext context = getFillContextByRequestIdLocked(requestId); Loading @@ -5591,6 +5593,9 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState } fillInIntent.putExtra(AutofillManager.EXTRA_ASSIST_STRUCTURE, context.getStructure()); fillInIntent.putExtra(AutofillManager.EXTRA_CLIENT_STATE, extras); if (authExtras != null) { fillInIntent.putExtra(AutofillManager.EXTRA_AUTH_STATE, authExtras); } return fillInIntent; } Loading