Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ac9836b4 authored by skxu's avatar skxu
Browse files

Add pendingIntent to FillRequest to enable retriggering

Bug: 190232037
Test: atest DelayFillTest
Change-Id: Ic224958c51d531b1d0de091ab9e2bf12756d8d0e
parent 00e99e74
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -37878,6 +37878,7 @@ package android.service.autofill {
    method public abstract void onFillRequest(@NonNull android.service.autofill.FillRequest, @NonNull android.os.CancellationSignal, @NonNull android.service.autofill.FillCallback);
    method public abstract void onSaveRequest(@NonNull android.service.autofill.SaveRequest, @NonNull android.service.autofill.SaveCallback);
    method public void onSavedDatasetsInfoRequest(@NonNull android.service.autofill.SavedDatasetsInfoCallback);
    field public static final String EXTRA_FILL_RESPONSE = "android.service.autofill.extra.FILL_RESPONSE";
    field public static final String SERVICE_INTERFACE = "android.service.autofill.AutofillService";
    field public static final String SERVICE_META_DATA = "android.autofill";
  }
@@ -38033,6 +38034,7 @@ package android.service.autofill {
  public final class FillRequest implements android.os.Parcelable {
    method public int describeContents();
    method @Nullable public android.os.Bundle getClientState();
    method @Nullable public android.content.IntentSender getDelayedFillIntentSender();
    method @NonNull public java.util.List<android.service.autofill.FillContext> getFillContexts();
    method public int getFlags();
    method public int getId();
@@ -38047,6 +38049,7 @@ package android.service.autofill {
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.FillResponse> CREATOR;
    field public static final int FLAG_DELAY_FILL = 4; // 0x4
    field public static final int FLAG_DISABLE_ACTIVITY_ONLY = 2; // 0x2
    field public static final int FLAG_TRACK_CONTEXT_COMMITED = 1; // 0x1
  }
+8 −0
Original line number Diff line number Diff line
@@ -577,6 +577,14 @@ public abstract class AutofillService extends Service {
     */
    public static final String SERVICE_META_DATA = "android.autofill";

    /**
     * Name of the {@link FillResponse} extra used to return a delayed fill response.
     *
     * <p>Please see {@link FillRequest#getDelayedFillIntentSender()} on how to send a delayed
     * fill response to framework.</p>
     */
    public static final String EXTRA_FILL_RESPONSE = "android.service.autofill.extra.FILL_RESPONSE";

    /**
     * Name of the {@link IResultReceiver} extra used to return the primary result of a request.
     *
+51 −4
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.service.autofill;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.IntentSender;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
@@ -160,6 +161,19 @@ public final class FillRequest implements Parcelable {
     */
    private final @Nullable InlineSuggestionsRequest mInlineSuggestionsRequest;

    /**
     * Gets the {@link IntentSender} to send a delayed fill response.
     *
     * <p>The autofill service must first indicate that it wants to return a delayed
     * {@link FillResponse} by setting {@link FillResponse#FLAG_DELAY_FILL} in a successful
     * fill response. Then it can use this IntentSender to send an Intent with extra
     * {@link AutofillService#EXTRA_FILL_RESPONSE} with the delayed response.</p>
     *
     * <p>Note that this may be null if a delayed fill response is not supported for
     * this fill request.</p>
     */
    private final @Nullable IntentSender mDelayedFillIntentSender;

    private void onConstructed() {
        Preconditions.checkCollectionElementsNotNull(mFillContexts, "contexts");
    }
@@ -252,6 +266,16 @@ public final class FillRequest implements Parcelable {
     *
     *   <p>The Autofill Service must set supportsInlineSuggestions in its XML to enable support
     *   for inline suggestions.</p>
     * @param delayedFillIntentSender
     *   Gets the {@link IntentSender} to send a delayed fill response.
     *
     *   <p>The autofill service must first indicate that it wants to return a delayed
     *   {@link FillResponse} by setting {@link FillResponse#FLAG_DELAY_FILL} in a successful
     *   fill response. Then it can use this IntentSender to send an Intent with extra
     *   {@link AutofillService#EXTRA_FILL_RESPONSE} with the delayed response.</p>
     *
     *   <p>Note that this may be null if a delayed fill response is not supported for
     *   this fill request.</p>
     * @hide
     */
    @DataClass.Generated.Member
@@ -260,7 +284,8 @@ public final class FillRequest implements Parcelable {
            @NonNull List<FillContext> fillContexts,
            @Nullable Bundle clientState,
            @RequestFlags int flags,
            @Nullable InlineSuggestionsRequest inlineSuggestionsRequest) {
            @Nullable InlineSuggestionsRequest inlineSuggestionsRequest,
            @Nullable IntentSender delayedFillIntentSender) {
        this.mId = id;
        this.mFillContexts = fillContexts;
        com.android.internal.util.AnnotationValidations.validate(
@@ -276,6 +301,7 @@ public final class FillRequest implements Parcelable {
                        | FLAG_VIEW_NOT_FOCUSED
                        | FLAG_ACTIVITY_START);
        this.mInlineSuggestionsRequest = inlineSuggestionsRequest;
        this.mDelayedFillIntentSender = delayedFillIntentSender;

        onConstructed();
    }
@@ -348,6 +374,22 @@ public final class FillRequest implements Parcelable {
        return mInlineSuggestionsRequest;
    }

    /**
     * Gets the {@link IntentSender} to send a delayed fill response.
     *
     * <p>The autofill service must first indicate that it wants to return a delayed
     * {@link FillResponse} by setting {@link FillResponse#FLAG_DELAY_FILL} in a successful
     * fill response. Then it can use this IntentSender to send an Intent with extra
     * {@link AutofillService#EXTRA_FILL_RESPONSE} with the delayed response.</p>
     *
     * <p>Note that this may be null if a delayed fill response is not supported for
     * this fill request.</p>
     */
    @DataClass.Generated.Member
    public @Nullable IntentSender getDelayedFillIntentSender() {
        return mDelayedFillIntentSender;
    }

    @Override
    @DataClass.Generated.Member
    public String toString() {
@@ -359,7 +401,8 @@ public final class FillRequest implements Parcelable {
                "fillContexts = " + mFillContexts + ", " +
                "clientState = " + mClientState + ", " +
                "flags = " + requestFlagsToString(mFlags) + ", " +
                "inlineSuggestionsRequest = " + mInlineSuggestionsRequest +
                "inlineSuggestionsRequest = " + mInlineSuggestionsRequest + ", " +
                "delayedFillIntentSender = " + mDelayedFillIntentSender +
        " }";
    }

@@ -372,12 +415,14 @@ public final class FillRequest implements Parcelable {
        byte flg = 0;
        if (mClientState != null) flg |= 0x4;
        if (mInlineSuggestionsRequest != null) flg |= 0x10;
        if (mDelayedFillIntentSender != null) flg |= 0x20;
        dest.writeByte(flg);
        dest.writeInt(mId);
        dest.writeParcelableList(mFillContexts, flags);
        if (mClientState != null) dest.writeBundle(mClientState);
        dest.writeInt(mFlags);
        if (mInlineSuggestionsRequest != null) dest.writeTypedObject(mInlineSuggestionsRequest, flags);
        if (mDelayedFillIntentSender != null) dest.writeTypedObject(mDelayedFillIntentSender, flags);
    }

    @Override
@@ -398,6 +443,7 @@ public final class FillRequest implements Parcelable {
        Bundle clientState = (flg & 0x4) == 0 ? null : in.readBundle();
        int flags = in.readInt();
        InlineSuggestionsRequest inlineSuggestionsRequest = (flg & 0x10) == 0 ? null : (InlineSuggestionsRequest) in.readTypedObject(InlineSuggestionsRequest.CREATOR);
        IntentSender delayedFillIntentSender = (flg & 0x20) == 0 ? null : (IntentSender) in.readTypedObject(IntentSender.CREATOR);

        this.mId = id;
        this.mFillContexts = fillContexts;
@@ -414,6 +460,7 @@ public final class FillRequest implements Parcelable {
                        | FLAG_VIEW_NOT_FOCUSED
                        | FLAG_ACTIVITY_START);
        this.mInlineSuggestionsRequest = inlineSuggestionsRequest;
        this.mDelayedFillIntentSender = delayedFillIntentSender;

        onConstructed();
    }
@@ -433,10 +480,10 @@ public final class FillRequest implements Parcelable {
    };

    @DataClass.Generated(
            time = 1643052544776L,
            time = 1643386870464L,
            codegenVersion = "1.0.23",
            sourceFile = "frameworks/base/core/java/android/service/autofill/FillRequest.java",
            inputSignatures = "public static final @android.service.autofill.FillRequest.RequestFlags int FLAG_MANUAL_REQUEST\npublic static final @android.service.autofill.FillRequest.RequestFlags int FLAG_COMPATIBILITY_MODE_REQUEST\npublic static final @android.service.autofill.FillRequest.RequestFlags int FLAG_PASSWORD_INPUT_TYPE\npublic static final @android.service.autofill.FillRequest.RequestFlags int FLAG_VIEW_NOT_FOCUSED\npublic static final @android.service.autofill.FillRequest.RequestFlags int FLAG_ACTIVITY_START\npublic static final  int INVALID_REQUEST_ID\nprivate final  int mId\nprivate final @android.annotation.NonNull java.util.List<android.service.autofill.FillContext> mFillContexts\nprivate final @android.annotation.Nullable android.os.Bundle mClientState\nprivate final @android.service.autofill.FillRequest.RequestFlags int mFlags\nprivate final @android.annotation.Nullable android.view.inputmethod.InlineSuggestionsRequest mInlineSuggestionsRequest\nprivate  void onConstructed()\nclass FillRequest extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genHiddenConstructor=true, genHiddenConstDefs=true)")
            inputSignatures = "public static final @android.service.autofill.FillRequest.RequestFlags int FLAG_MANUAL_REQUEST\npublic static final @android.service.autofill.FillRequest.RequestFlags int FLAG_COMPATIBILITY_MODE_REQUEST\npublic static final @android.service.autofill.FillRequest.RequestFlags int FLAG_PASSWORD_INPUT_TYPE\npublic static final @android.service.autofill.FillRequest.RequestFlags int FLAG_VIEW_NOT_FOCUSED\npublic static final @android.service.autofill.FillRequest.RequestFlags int FLAG_ACTIVITY_START\npublic static final  int INVALID_REQUEST_ID\nprivate final  int mId\nprivate final @android.annotation.NonNull java.util.List<android.service.autofill.FillContext> mFillContexts\nprivate final @android.annotation.Nullable android.os.Bundle mClientState\nprivate final @android.service.autofill.FillRequest.RequestFlags int mFlags\nprivate final @android.annotation.Nullable android.view.inputmethod.InlineSuggestionsRequest mInlineSuggestionsRequest\nprivate final @android.annotation.Nullable android.content.IntentSender mDelayedFillIntentSender\nprivate  void onConstructed()\nclass FillRequest extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genHiddenConstructor=true, genHiddenConstDefs=true)")
    @Deprecated
    private void __metadata() {}

+14 −2
Original line number Diff line number Diff line
@@ -65,10 +65,22 @@ public final class FillResponse implements Parcelable {
     */
    public static final int FLAG_DISABLE_ACTIVITY_ONLY = 0x2;

    /**
     * Flag used to request to wait for a delayed fill from the remote Autofill service if it's
     * passed to {@link Builder#setFlags(int)}.
     *
     * <p>Some datasets (i.e. OTP) take time to produce. This flags allows remote service to send
     * a {@link FillResponse} to the latest {@link FillRequest} via
     * {@link FillRequest#getDelayedFillIntentSender()} even if the original {@link FillCallback}
     * has timed out.
     */
    public static final int FLAG_DELAY_FILL = 0x4;

    /** @hide */
    @IntDef(flag = true, prefix = { "FLAG_" }, value = {
            FLAG_TRACK_CONTEXT_COMMITED,
            FLAG_DISABLE_ACTIVITY_ONLY
            FLAG_DISABLE_ACTIVITY_ONLY,
            FLAG_DELAY_FILL
    })
    @Retention(RetentionPolicy.SOURCE)
    @interface FillResponseFlags {}
@@ -657,7 +669,7 @@ public final class FillResponse implements Parcelable {
        public Builder setFlags(@FillResponseFlags int flags) {
            throwIfDestroyed();
            mFlags = Preconditions.checkFlagsArgument(flags,
                    FLAG_TRACK_CONTEXT_COMMITED | FLAG_DISABLE_ACTIVITY_ONLY);
                    FLAG_TRACK_CONTEXT_COMMITED | FLAG_DISABLE_ACTIVITY_ONLY | FLAG_DELAY_FILL);
            return this;
        }

+1 −0
Original line number Diff line number Diff line
@@ -718,6 +718,7 @@
    <protected-broadcast android:name="android.safetycenter.action.REFRESH_SAFETY_SOURCES" />
    <protected-broadcast android:name="android.app.action.DEVICE_POLICY_RESOURCE_UPDATED" />
    <protected-broadcast android:name="android.intent.action.SHOW_FOREGROUND_SERVICE_MANAGER" />
    <protected-broadcast android:name="android.service.autofill.action.DELAYED_FILL" />

    <!-- ====================================================================== -->
    <!--                          RUNTIME PERMISSIONS                           -->
Loading