diff options
author | Fabian Meumertzheim <4312191+fmeum@users.noreply.github.com> | 2020-12-23 06:13:10 +0100 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2021-03-20 22:42:39 +0530 |
commit | de1b976638dae3ca98c665d8cba3560f49898030 (patch) | |
tree | 85588365bcf461044a76eb1152ed34d1733d448a /autofill-parser/src/main/java | |
parent | eaa541b7b033b203f60b1acfa4936c3a9816d421 (diff) |
Mark unfocused single password fields as fillable (#1258)
Unfocused single password fields in forms with no other recognized
fields must be marked as fillable or the Autofill service will no
longer be invoked on that form.
This is compatible with the restrictions of single-origin mode as
filling only takes place after the password field has gained focus and
the user has tapped the fill UI.
For an example website where fill UI is not shown without this commit,
open https://amazon.lbb.de and tab the user name field ("Benutzername")
first before focusing the password field.
(cherry picked from commit c15594b045ad035b2026a201acd2a89e3962de4d)
Diffstat (limited to 'autofill-parser/src/main/java')
-rw-r--r-- | autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillStrategy.kt | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillStrategy.kt b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillStrategy.kt index a98d6e81..9f34a200 100644 --- a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillStrategy.kt +++ b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillStrategy.kt @@ -187,6 +187,26 @@ internal val autofillStrategy = strategy { } } + // Fallback rule for the case of a login form with a password field and other fields that are + // not recognized by any other rule. If one of the other fields is focused and we return no + // response, the system will not invoke the service again if focus later changes to the password + // field. Hence, we must mark it as fillable now. + // This rule can apply in single origin mode since even though the password field may not be + // focused at the time the rule runs, the fill suggestion will only show if it ever receives + // focus. + rule(applyInSingleOriginMode = true) { + currentPassword { + takeSingle { hasAutocompleteHintCurrentPassword } + } + } + + // See above. + rule(applyInSingleOriginMode = true) { + genericPassword { + takeSingle { true } + } + } + // Match any focused password field with optional username field on manual request. rule(applyInSingleOriginMode = true, applyOnManualRequestOnly = true) { genericPassword { |