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

Commit 341ca7e6 authored by Daniel Kim's avatar Daniel Kim Committed by Android (Google) Code Review
Browse files

Merge "Reroute to Credman based on autofill hint" into main

parents 11adf975 58dfa96a
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1327,6 +1327,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    // TODO(229765029): unhide this for UI toolkit
    public static final String AUTOFILL_HINT_PASSWORD_AUTO = "passwordAuto";
    /**
     * Hint indicating that the developer intends to fill this view with output from
     * CredentialManager.
     *
     * @hide
     */
    public static final String AUTOFILL_HINT_CREDENTIAL_MANAGER = "credential";
    /**
     * Hints for the autofill services that describes the content of the view.
     */
+18 −2
Original line number Diff line number Diff line
@@ -1464,7 +1464,7 @@ public final class AutofillManager {
        if (infos.size() == 0) {
            throw new IllegalArgumentException("No VirtualViewInfo found");
        }
        if (view.isCredential() && mIsFillAndSaveDialogDisabledForCredentialManager) {
        if (isCredmanRequested(view) && mIsFillAndSaveDialogDisabledForCredentialManager) {
            if (sDebug) {
                Log.d(TAG, "Ignoring Fill Dialog request since important for credMan:"
                        + view.getAutofillId().toString());
@@ -1488,7 +1488,7 @@ public final class AutofillManager {
     * @hide
     */
    public void notifyViewEnteredForFillDialog(View v) {
        if (v.isCredential()
        if (isCredmanRequested(v)
                && mIsFillAndSaveDialogDisabledForCredentialManager) {
            if (sDebug) {
                Log.d(TAG, "Ignoring Fill Dialog request since important for credMan:"
@@ -3434,6 +3434,22 @@ public final class AutofillManager {
        }
    }

    private boolean isCredmanRequested(View view) {
        if (view.isCredential()) {
            return true;
        }
        String[] hints = view.getAutofillHints();
        if (hints == null) {
            return false;
        }
        for (String hint : hints) {
            if (hint.equals(View.AUTOFILL_HINT_CREDENTIAL_MANAGER)) {
                return true;
            }
        }
        return false;
    }

    /**
     * Find a single view by its id.
     *