diff options
| -rw-r--r-- | core/java/android/view/View.java | 8 | ||||
| -rw-r--r-- | core/java/android/view/autofill/AutofillManager.java | 20 |
2 files changed, 26 insertions, 2 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 5eaded218a0b..552263a16937 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -1328,6 +1328,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, 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. */ private @Nullable String[] mAutofillHints; diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java index 4cb8788ab9f2..6cf185a5b460 100644 --- a/core/java/android/view/autofill/AutofillManager.java +++ b/core/java/android/view/autofill/AutofillManager.java @@ -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. * |