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

Commit e8ebb8cd authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Changed FillResponse so it can have only a client state."

parents 28df95a2 b57080eb
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -323,6 +323,7 @@ public final class FillResponse implements Parcelable {
         */
        public Builder setClientState(@Nullable Bundle clientState) {
            throwIfDestroyed();
            throwIfDisableAutofillCalled();
            mClientState = clientState;
            return this;
        }
@@ -389,8 +390,9 @@ public final class FillResponse implements Parcelable {
         *
         * @throws IllegalArgumentException if {@code duration} is not a positive number.
         * @throws IllegalStateException if either {@link #addDataset(Dataset)},
         *       {@link #setAuthentication(AutofillId[], IntentSender, RemoteViews)}, or
         *       {@link #setSaveInfo(SaveInfo)} was already called.
         *       {@link #setAuthentication(AutofillId[], IntentSender, RemoteViews)},
         *       {@link #setSaveInfo(SaveInfo)}, or {@link #setClientState(Bundle)}
         *       was already called.
         */
        public Builder disableAutofill(long duration) {
            throwIfDestroyed();
@@ -398,7 +400,7 @@ public final class FillResponse implements Parcelable {
                throw new IllegalArgumentException("duration must be greater than 0");
            }
            if (mAuthentication != null || mDatasets != null || mSaveInfo != null
                    || mFieldsDetection != null) {
                    || mFieldsDetection != null || mClientState != null) {
                throw new IllegalStateException("disableAutofill() must be the only method called");
            }

@@ -414,7 +416,8 @@ public final class FillResponse implements Parcelable {
         *   <li>{@link #build()} was already called.
         *   <li>No call was made to {@link #addDataset(Dataset)},
         *       {@link #setAuthentication(AutofillId[], IntentSender, RemoteViews)},
         *       {@link #setSaveInfo(SaveInfo)}, or {@link #disableAutofill(long)}.
         *       {@link #setSaveInfo(SaveInfo)}, {@link #disableAutofill(long)},
         *       or {@link #setClientState(Bundle)}.
         * </ol>
         *
         * @return A built response.
@@ -422,10 +425,10 @@ public final class FillResponse implements Parcelable {
        public FillResponse build() {
            throwIfDestroyed();
            if (mAuthentication == null && mDatasets == null && mSaveInfo == null
                    && mDisableDuration == 0 && mFieldsDetection == null) {
                    && mDisableDuration == 0 && mFieldsDetection == null && mClientState == null) {
                throw new IllegalStateException("need to provide: at least one DataSet, or a "
                        + "SaveInfo, or an authentication with a presentation, "
                        + "or a FieldsDetection, or disable autofill");
                        + "or a FieldsDetection, or a client state, or disable autofill");
            }
            mDestroyed = true;
            return new FillResponse(this);