summaryrefslogtreecommitdiff
path: root/autofill-parser/src
diff options
context:
space:
mode:
Diffstat (limited to 'autofill-parser/src')
-rw-r--r--autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillFormParser.kt1
-rw-r--r--autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillScenario.kt8
-rw-r--r--autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/FormField.kt3
-rw-r--r--autofill-parser/src/main/java/mozilla/components/lib/publicsuffixlist/PublicSuffixListData.kt2
4 files changed, 14 insertions, 0 deletions
diff --git a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillFormParser.kt b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillFormParser.kt
index fc1fcca3..49c3b4c9 100644
--- a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillFormParser.kt
+++ b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillFormParser.kt
@@ -21,6 +21,7 @@ import logcat.logcat
public sealed class FormOrigin(public open val identifier: String) {
public data class Web(override val identifier: String) : FormOrigin(identifier)
+
public data class App(override val identifier: String) : FormOrigin(identifier)
public companion object {
diff --git a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillScenario.kt b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillScenario.kt
index 9d620fe6..2670a77d 100644
--- a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillScenario.kt
+++ b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillScenario.kt
@@ -199,12 +199,16 @@ internal data class ClassifiedAutofillScenario<T : Any>(
override val allPasswordFields
get() = currentPassword + newPassword
+
override val passwordFieldsToFillOnMatch
get() = currentPassword
+
override val passwordFieldsToFillOnSearch
get() = currentPassword
+
override val passwordFieldsToFillOnGenerate
get() = newPassword
+
override val passwordFieldsToSave
get() = newPassword.ifEmpty { currentPassword }
}
@@ -219,12 +223,16 @@ internal data class GenericAutofillScenario<T : Any>(
override val allPasswordFields
get() = genericPassword
+
override val passwordFieldsToFillOnMatch
get() = if (genericPassword.size == 1) genericPassword else emptyList()
+
override val passwordFieldsToFillOnSearch
get() = if (genericPassword.size == 1) genericPassword else emptyList()
+
override val passwordFieldsToFillOnGenerate
get() = genericPassword
+
override val passwordFieldsToSave
get() = genericPassword
}
diff --git a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/FormField.kt b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/FormField.kt
index dc03e82b..4d4dd218 100644
--- a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/FormField.kt
+++ b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/FormField.kt
@@ -76,6 +76,7 @@ internal class FormField(
"com.google.android.material.textfield.TextInputEditText",
)
private const val ANDROID_WEB_VIEW_CLASS_NAME = "android.webkit.WebView"
+
private fun isPasswordInputType(inputType: Int): Boolean {
val typeClass = inputType and InputType.TYPE_MASK_CLASS
val typeVariation = inputType and InputType.TYPE_MASK_VARIATION
@@ -116,6 +117,7 @@ internal class FormField(
@RequiresApi(Build.VERSION_CODES.O)
private fun isSupportedHint(hint: String?) = hint in HINTS_FILLABLE
+
private val EXCLUDED_TERMS =
listOf(
"url_bar", // Chrome/Edge/Firefox address bar
@@ -157,6 +159,7 @@ internal class FormField(
private val List<String>.anyMatchesFieldInfo
get() = any { fieldId.contains(it) || hint.contains(it) || htmlName.contains(it) }
+
val autofillId: AutofillId = node.autofillId!!
// Information for heuristics and exclusion rules based only on the current field
diff --git a/autofill-parser/src/main/java/mozilla/components/lib/publicsuffixlist/PublicSuffixListData.kt b/autofill-parser/src/main/java/mozilla/components/lib/publicsuffixlist/PublicSuffixListData.kt
index b64b1b2f..97a2fbae 100644
--- a/autofill-parser/src/main/java/mozilla/components/lib/publicsuffixlist/PublicSuffixListData.kt
+++ b/autofill-parser/src/main/java/mozilla/components/lib/publicsuffixlist/PublicSuffixListData.kt
@@ -156,6 +156,8 @@ internal class PublicSuffixListData(
internal sealed class PublicSuffixOffset {
data class Offset(val value: Int) : PublicSuffixOffset()
+
object PublicSuffix : PublicSuffixOffset()
+
object PrevailingRule : PublicSuffixOffset()
}