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

Commit 28b7c236 authored by Haoran Zhang's avatar Haoran Zhang Committed by Android (Google) Code Review
Browse files

Merge "[Autofill Brute Force] Do no show suggestion after user entered 4 or...

Merge "[Autofill Brute Force] Do no show suggestion after user entered 4 or more characters" into main
parents bad64b39 732cd1b8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -115,6 +115,8 @@ import java.util.regex.Pattern;
 * with the lower case value of the view's text are shown.
 *   <li>All other datasets are hidden.
 * </ol>
 * <p>Note: If user enters four or more characters, all datasets will be hidden</p>
 *
 */
public final class Dataset implements Parcelable {
    /**
+7 −1
Original line number Diff line number Diff line
@@ -426,12 +426,18 @@ final class FillUi {
            if (mDestroyed) {
                return;
            }
            final int size = mFilterText == null ? 0 : mFilterText.length();
            if (count <= 0) {
                if (sDebug) {
                    final int size = mFilterText == null ? 0 : mFilterText.length();
                    Slog.d(TAG, "No dataset matches filter with " + size + " chars");
                }
                mCallback.requestHideFillUi();
            } else if (size > 3) {
                // Do not show suggestion if user entered four or more characters
                if (sDebug) {
                    Slog.d(TAG, "Not showing fill UI because user entered more than 3 characters");
                }
                mCallback.requestHideFillUi();
            } else {
                if (updateContentSize()) {
                    requestShowFillUi();
+10 −0
Original line number Diff line number Diff line
@@ -216,6 +216,16 @@ public final class InlineFillUi {
            }
            return new InlineSuggestionsResponse(inlineSuggestions);
        }

        // Do not show suggestion if user entered four or more characters
        if (!TextUtils.isEmpty(mFilterText) && mFilterText.length() > 3) {
            if (sVerbose) {
                Slog.v(TAG, "Not showing inline suggestion because user entered more than 3 "
                        + "characters");
            }
            return new InlineSuggestionsResponse(inlineSuggestions);
        }

        for (int i = 0; i < size; i++) {
            final Dataset dataset = mDatasets.get(i);
            final int fieldIndex = dataset.getFieldIds().indexOf(mAutofillId);