private final @Nullable RemoteViews mPresentation;
private final @Nullable IntentSender mAuthentication;
private final @Nullable AutofillId[] mAuthenticationIds;
+ private final @Nullable AutofillId[] mIgnoredIds;
private FillResponse(@NonNull Builder builder) {
mDatasets = builder.mDatasets;
mPresentation = builder.mPresentation;
mAuthentication = builder.mAuthentication;
mAuthenticationIds = builder.mAuthenticationIds;
+ mIgnoredIds = builder.mIgnoredIds;
}
/** @hide */
return mAuthenticationIds;
}
+ /** @hide */
+ public @Nullable AutofillId[] getIgnoredIds() {
+ return mIgnoredIds;
+ }
+
/**
* Builder for {@link FillResponse} objects. You must to provide at least
* one dataset or set an authentication intent with a presentation view.
private RemoteViews mPresentation;
private IntentSender mAuthentication;
private AutofillId[] mAuthenticationIds;
+ private AutofillId[] mIgnoredIds;
private boolean mDestroyed;
/**
* {@code EditText} representing a captcha.
*/
public Builder setIgnoredIds(AutofillId...ids) {
- // TODO: implement
+ mIgnoredIds = ids;
return this;
}
.append(", hasAuthentication=").append(mAuthentication != null)
.append(", authenticationSize=").append(mAuthenticationIds != null
? mAuthenticationIds.length : "N/A")
+ .append(", ignoredIdsSize=").append(mIgnoredIds != null
+ ? mIgnoredIds.length : "N/A")
.toString();
}
parcel.writeParcelableArray(mAuthenticationIds, flags);
parcel.writeParcelable(mAuthentication, flags);
parcel.writeParcelable(mPresentation, flags);
+ parcel.writeParcelableArray(mIgnoredIds, flags);
}
public static final Parcelable.Creator<FillResponse> CREATOR =
builder.addDataset(datasets.get(i));
}
builder.setSaveInfo(parcel.readParcelable(null));
- builder.setExtras(parcel.readParcelable(null));
+ builder.setClientState(parcel.readParcelable(null));
builder.setAuthentication(parcel.readParcelableArray(null, AutofillId.class),
parcel.readParcelable(null), parcel.readParcelable(null));
+ builder.setIgnoredIds(parcel.readParcelableArray(null, AutofillId.class));
return builder.build();
}
package com.android.server.autofill;
-import static android.view.autofill.AutofillManager.FLAG_MANUAL_REQUEST;
+import static android.service.autofill.FillRequest.FLAG_MANUAL_REQUEST;
import static android.view.autofill.AutofillManager.FLAG_START_SESSION;
import static android.view.autofill.AutofillManager.FLAG_VALUE_CHANGED;
import static android.view.autofill.AutofillManager.FLAG_VIEW_ENTERED;
import java.io.PrintWriter;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Map;
import java.util.Map.Entry;
final int lastResponseIdx = getLastResponseIndex();
final int requestId = mResponses.keyAt(lastResponseIdx);
final FillContext fillContext = new FillContext(requestId, mStructure);
- final ArrayList fillContexts = new ArrayList(1);
+ final ArrayList<FillContext> fillContexts = new ArrayList<>(1);
fillContexts.add(fillContext);
final SaveRequest saveRequest = new SaveRequest(fillContexts, mClientState);
viewState = new ViewState(this, id, value, this, ViewState.STATE_INITIAL);
mViewStates.put(id, viewState);
} else if (mStructure != null && (flags & FLAG_VIEW_ENTERED) != 0) {
+ if (isIgnoredLocked(id)) {
+ if (DEBUG) {
+ Slog.d(TAG, "Not starting partition for ignored view id " + id);
+ }
+ return;
+ }
viewState = startPartitionLocked(id, value);
} else {
if (VERBOSE) Slog.v(TAG, "Ignored " + getFlagAsString(flags) + " for " + id);
}
}
+ private boolean isIgnoredLocked(@NonNull AutofillId id) {
+ if (mResponses == null) return false;
+
+ for (int i = mResponses.size() - 1; i >= 0; i--) {
+ final FillResponse response = mResponses.valueAt(i);
+ final AutofillId[] ignoredIds = response.getIgnoredIds();
+ if (ignoredIds == null) continue;
+ for (int j = 0; j < ignoredIds.length; j++) {
+ final AutofillId ignoredId = ignoredIds[j];
+ if (ignoredId != null && ignoredId.equals(id)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
void dumpLocked(String prefix, PrintWriter pw) {
pw.print(prefix); pw.print("id: "); pw.println(id);
pw.print(prefix); pw.print("uid: "); pw.println(uid);