aboutsummaryrefslogtreecommitdiff
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.kt12
-rw-r--r--autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillHelper.kt4
-rw-r--r--autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillScenario.kt28
-rw-r--r--autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillStrategyDsl.kt44
-rw-r--r--autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/FeatureAndTrustDetection.kt23
-rw-r--r--autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/FormField.kt72
-rw-r--r--autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/PublicSuffixListCache.kt4
-rw-r--r--autofill-parser/src/main/java/mozilla/components/lib/publicsuffixlist/PublicSuffixList.kt2
-rw-r--r--autofill-parser/src/main/java/mozilla/components/lib/publicsuffixlist/PublicSuffixListData.kt2
9 files changed, 69 insertions, 122 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 badaabcb..89359057 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
@@ -47,7 +47,7 @@ public sealed class FormOrigin(public open val identifier: String) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
context.packageManager.getApplicationInfo(
identifier,
- ApplicationInfoFlags.of(PackageManager.GET_META_DATA.toLong())
+ ApplicationInfoFlags.of(PackageManager.GET_META_DATA.toLong()),
)
} else {
context.packageManager.getApplicationInfo(identifier, PackageManager.GET_META_DATA)
@@ -74,7 +74,7 @@ private class AutofillFormParser(
context: Context,
structure: AssistStructure,
isManualRequest: Boolean,
- private val customSuffixes: Sequence<String>
+ private val customSuffixes: Sequence<String>,
) {
companion object {
@@ -136,7 +136,7 @@ private class AutofillFormParser(
autofillStrategy.match(
relevantFields,
singleOriginMode = trustedBrowserInfo?.multiOriginMethod == BrowserMultiOriginMethod.None,
- isManualRequest = isManualRequest
+ isManualRequest = isManualRequest,
)
private fun trackOrigin(node: AssistStructure.ViewNode) {
@@ -187,7 +187,7 @@ private class AutofillFormParser(
// situation is uncertain and Autofill should not be offered.
webOriginToFormOrigin(
context,
- scenario.allFields.map { it.webOrigin }.toSet().singleOrNull() ?: return null
+ scenario.allFields.map { it.webOrigin }.toSet().singleOrNull() ?: return null,
)
}
}
@@ -206,7 +206,7 @@ private constructor(
public val formOrigin: FormOrigin,
public val scenario: AutofillScenario<AutofillId>,
public val ignoredIds: List<AutofillId>,
- public val saveFlags: Int?
+ public val saveFlags: Int?,
) {
public companion object {
/** Returns a [FillableForm] if a login form could be detected in [structure]. */
@@ -222,7 +222,7 @@ private constructor(
form.formOrigin,
form.scenario.map { it.autofillId },
form.ignoredIds,
- form.saveFlags
+ form.saveFlags,
)
}
}
diff --git a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillHelper.kt b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillHelper.kt
index b12fd9c1..f08f3172 100644
--- a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillHelper.kt
+++ b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillHelper.kt
@@ -57,7 +57,7 @@ public fun computeCertificatesHash(context: Context, appPackage: String): String
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
context.packageManager.getPackageInfo(
appPackage,
- PackageManager.PackageInfoFlags.of(PackageManager.GET_SIGNING_CERTIFICATES.toLong())
+ PackageManager.PackageInfoFlags.of(PackageManager.GET_SIGNING_CERTIFICATES.toLong()),
)
} else {
context.packageManager.getPackageInfo(appPackage, PackageManager.GET_SIGNING_CERTIFICATES)
@@ -121,7 +121,7 @@ private fun visitViewNodes(structure: AssistStructure, block: (AssistStructure.V
private fun visitViewNode(
node: AssistStructure.ViewNode,
- block: (AssistStructure.ViewNode) -> Unit
+ block: (AssistStructure.ViewNode) -> Unit,
) {
block(node)
for (i in 0 until node.childCount) {
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 c7bd99fc..9c32d62f 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
@@ -21,7 +21,7 @@ public enum class AutofillAction {
Match,
Search,
Generate,
- FillOtpFromSms
+ FillOtpFromSms,
}
/**
@@ -46,8 +46,8 @@ public sealed class AutofillScenario<out T : Any> {
"Use `fromClientState` instead.",
ReplaceWith(
"fromClientState(clientState)",
- "com.github.androidpasswordstore.autofillparser.AutofillScenario.Companion.fromClientState"
- )
+ "com.github.androidpasswordstore.autofillparser.AutofillScenario.Companion.fromClientState",
+ ),
)
public fun fromBundle(clientState: Bundle): AutofillScenario<AutofillId>? {
return fromClientState(clientState)
@@ -61,7 +61,7 @@ public sealed class AutofillScenario<out T : Any> {
BundleCompat.getParcelable(
clientState,
BUNDLE_KEY_USERNAME_ID,
- AutofillId::class.java
+ AutofillId::class.java,
)
fillUsername = clientState.getBoolean(BUNDLE_KEY_FILL_USERNAME)
otp = BundleCompat.getParcelable(clientState, BUNDLE_KEY_OTP_ID, AutofillId::class.java)
@@ -69,21 +69,21 @@ public sealed class AutofillScenario<out T : Any> {
BundleCompat.getParcelableArrayList(
clientState,
BUNDLE_KEY_CURRENT_PASSWORD_IDS,
- AutofillId::class.java
+ AutofillId::class.java,
) ?: emptyList()
)
newPassword.addAll(
BundleCompat.getParcelableArrayList(
clientState,
BUNDLE_KEY_NEW_PASSWORD_IDS,
- AutofillId::class.java
+ AutofillId::class.java,
) ?: emptyList()
)
genericPassword.addAll(
BundleCompat.getParcelableArrayList(
clientState,
BUNDLE_KEY_GENERIC_PASSWORD_IDS,
- AutofillId::class.java
+ AutofillId::class.java,
) ?: emptyList()
)
}
@@ -114,14 +114,14 @@ public sealed class AutofillScenario<out T : Any> {
fillUsername = fillUsername,
otp = otp,
currentPassword = currentPassword,
- newPassword = newPassword
+ newPassword = newPassword,
)
} else {
GenericAutofillScenario(
username = username,
fillUsername = fillUsername,
otp = otp,
- genericPassword = genericPassword
+ genericPassword = genericPassword,
)
}
}
@@ -193,7 +193,7 @@ internal data class ClassifiedAutofillScenario<T : Any>(
override val fillUsername: Boolean,
override val otp: T?,
val currentPassword: List<T>,
- val newPassword: List<T>
+ val newPassword: List<T>,
) : AutofillScenario<T>() {
override val allPasswordFields
@@ -217,7 +217,7 @@ internal data class GenericAutofillScenario<T : Any>(
override val username: T?,
override val fillUsername: Boolean,
override val otp: T?,
- val genericPassword: List<T>
+ val genericPassword: List<T>,
) : AutofillScenario<T>() {
override val allPasswordFields
@@ -254,7 +254,7 @@ internal fun AutofillScenario<FormField>.passesOriginCheck(singleOriginMode: Boo
public fun Dataset.Builder.fillWith(
scenario: AutofillScenario<AutofillId>,
action: AutofillAction,
- credentials: Credentials?
+ credentials: Credentials?,
) {
val credentialsToFill = credentials ?: Credentials("USERNAME", "PASSWORD", "OTP")
for (field in scenario.fieldsToFillOn(action)) {
@@ -303,7 +303,7 @@ internal fun AutofillScenario<AutofillId>.toBundle(): Bundle =
putParcelable(AutofillScenario.BUNDLE_KEY_OTP_ID, otp)
putParcelableArrayList(
AutofillScenario.BUNDLE_KEY_CURRENT_PASSWORD_IDS,
- ArrayList(currentPassword)
+ ArrayList(currentPassword),
)
putParcelableArrayList(AutofillScenario.BUNDLE_KEY_NEW_PASSWORD_IDS, ArrayList(newPassword))
}
@@ -315,7 +315,7 @@ internal fun AutofillScenario<AutofillId>.toBundle(): Bundle =
putParcelable(AutofillScenario.BUNDLE_KEY_OTP_ID, otp)
putParcelableArrayList(
AutofillScenario.BUNDLE_KEY_GENERIC_PASSWORD_IDS,
- ArrayList(genericPassword)
+ ArrayList(genericPassword),
)
}
}
diff --git a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillStrategyDsl.kt b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillStrategyDsl.kt
index 04e8d98c..6cd6afc7 100644
--- a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillStrategyDsl.kt
+++ b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillStrategyDsl.kt
@@ -75,7 +75,7 @@ internal interface FieldMatcher {
@RequiresApi(Build.VERSION_CODES.O)
internal class SingleFieldMatcher(
private val take: (FormField, List<FormField>) -> Boolean,
- private val tieBreakers: List<(FormField, List<FormField>) -> Boolean>
+ private val tieBreakers: List<(FormField, List<FormField>) -> Boolean>,
) : FieldMatcher {
@AutofillDsl
@@ -100,7 +100,7 @@ internal class SingleFieldMatcher(
fun build() =
SingleFieldMatcher(
takeSingle ?: throw IllegalArgumentException("Every block needs a take{Single,Pair} block"),
- tieBreakersSingle
+ tieBreakersSingle,
)
}
@@ -139,7 +139,7 @@ internal class SingleFieldMatcher(
@RequiresApi(Build.VERSION_CODES.O)
private class PairOfFieldsMatcher(
private val take: (Pair<FormField, FormField>, List<FormField>) -> Boolean,
- private val tieBreakers: List<(Pair<FormField, FormField>, List<FormField>) -> Boolean>
+ private val tieBreakers: List<(Pair<FormField, FormField>, List<FormField>) -> Boolean>,
) : FieldMatcher {
override fun match(fields: List<FormField>, alreadyMatched: List<FormField>): List<FormField>? {
@@ -180,14 +180,14 @@ private constructor(
private val matchers: List<AutofillRuleMatcher>,
private val applyInSingleOriginMode: Boolean,
private val applyOnManualRequestOnly: Boolean,
- private val name: String
+ private val name: String,
) {
data class AutofillRuleMatcher(
val type: FillableFieldType,
val matcher: FieldMatcher,
val optional: Boolean,
- val matchHidden: Boolean
+ val matchHidden: Boolean,
)
enum class FillableFieldType {
@@ -201,7 +201,7 @@ private constructor(
@AutofillDsl
class Builder(
private val applyInSingleOriginMode: Boolean,
- private val applyOnManualRequestOnly: Boolean
+ private val applyOnManualRequestOnly: Boolean,
) {
companion object {
@@ -215,7 +215,7 @@ private constructor(
fun username(
optional: Boolean = false,
matchHidden: Boolean = false,
- block: SingleFieldMatcher.Builder.() -> Unit
+ block: SingleFieldMatcher.Builder.() -> Unit,
) {
require(matchers.none { it.type == FillableFieldType.Username }) {
"Every rule block can only have at most one username block"
@@ -225,7 +225,7 @@ private constructor(
type = FillableFieldType.Username,
matcher = SingleFieldMatcher.Builder().apply(block).build(),
optional = optional,
- matchHidden = matchHidden
+ matchHidden = matchHidden,
)
)
}
@@ -239,7 +239,7 @@ private constructor(
type = FillableFieldType.Otp,
matcher = SingleFieldMatcher.Builder().apply(block).build(),
optional = optional,
- matchHidden = false
+ matchHidden = false,
)
)
}
@@ -247,7 +247,7 @@ private constructor(
fun currentPassword(
optional: Boolean = false,
matchHidden: Boolean = false,
- block: FieldMatcher.Builder.() -> Unit
+ block: FieldMatcher.Builder.() -> Unit,
) {
require(matchers.none { it.type == FillableFieldType.GenericPassword }) {
"Every rule block can only have either genericPassword or {current,new}Password blocks"
@@ -257,7 +257,7 @@ private constructor(
type = FillableFieldType.CurrentPassword,
matcher = FieldMatcher.Builder().apply(block).build(),
optional = optional,
- matchHidden = matchHidden
+ matchHidden = matchHidden,
)
)
}
@@ -271,7 +271,7 @@ private constructor(
type = FillableFieldType.NewPassword,
matcher = FieldMatcher.Builder().apply(block).build(),
optional = optional,
- matchHidden = false
+ matchHidden = false,
)
)
}
@@ -279,11 +279,7 @@ private constructor(
fun genericPassword(optional: Boolean = false, block: FieldMatcher.Builder.() -> Unit) {
require(
matchers.none {
- it.type in
- listOf(
- FillableFieldType.CurrentPassword,
- FillableFieldType.NewPassword,
- )
+ it.type in listOf(FillableFieldType.CurrentPassword, FillableFieldType.NewPassword)
}
) {
"Every rule block can only have either genericPassword or {current,new}Password blocks"
@@ -293,7 +289,7 @@ private constructor(
type = FillableFieldType.GenericPassword,
matcher = FieldMatcher.Builder().apply(block).build(),
optional = optional,
- matchHidden = false
+ matchHidden = false,
)
)
}
@@ -314,7 +310,7 @@ private constructor(
matchers,
applyInSingleOriginMode,
applyOnManualRequestOnly,
- name ?: "Rule #$ruleId"
+ name ?: "Rule #$ruleId",
)
.also { ruleId++ }
}
@@ -325,7 +321,7 @@ private constructor(
allUsername: List<FormField>,
allOtp: List<FormField>,
singleOriginMode: Boolean,
- isManualRequest: Boolean
+ isManualRequest: Boolean,
): AutofillScenario<FormField>? {
if (singleOriginMode && !applyInSingleOriginMode) {
logcat { "$name: Skipped in single origin mode" }
@@ -399,12 +395,12 @@ internal class AutofillStrategy private constructor(private val rules: List<Auto
fun rule(
applyInSingleOriginMode: Boolean = false,
applyOnManualRequestOnly: Boolean = false,
- block: AutofillRule.Builder.() -> Unit
+ block: AutofillRule.Builder.() -> Unit,
) {
rules.add(
AutofillRule.Builder(
applyInSingleOriginMode = applyInSingleOriginMode,
- applyOnManualRequestOnly = applyOnManualRequestOnly
+ applyOnManualRequestOnly = applyOnManualRequestOnly,
)
.apply(block)
.build()
@@ -417,7 +413,7 @@ internal class AutofillStrategy private constructor(private val rules: List<Auto
fun match(
fields: List<FormField>,
singleOriginMode: Boolean,
- isManualRequest: Boolean
+ isManualRequest: Boolean,
): AutofillScenario<FormField>? {
val possiblePasswordFields = fields.filter { it.passwordCertainty >= CertaintyLevel.Possible }
logcat { "Possible password fields: ${possiblePasswordFields.size}" }
@@ -433,7 +429,7 @@ internal class AutofillStrategy private constructor(private val rules: List<Auto
possibleUsernameFields,
possibleOtpFields,
singleOriginMode = singleOriginMode,
- isManualRequest = isManualRequest
+ isManualRequest = isManualRequest,
) ?: continue
}
return null
diff --git a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/FeatureAndTrustDetection.kt b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/FeatureAndTrustDetection.kt
index 3bb56920..d5bc9444 100644
--- a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/FeatureAndTrustDetection.kt
+++ b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/FeatureAndTrustDetection.kt
@@ -59,7 +59,7 @@ private val TRUSTED_BROWSER_CERTIFICATE_HASH =
"com.duckduckgo.mobile.android" to
arrayOf(
"u3uzHFc8RqHaf8XFKKas9DIQhFb+7FCBDH8zaU6z0tQ=",
- "8HB9AhwL8+b43MEbo/VwBCXVl9yjAaMeIQVWk067Gwo="
+ "8HB9AhwL8+b43MEbo/VwBCXVl9yjAaMeIQVWk067Gwo=",
),
"com.jamal2367.styx" to arrayOf("Lph3oaG1C8WLhLiK5PVxOp5+6wTU9ipJSBYlD2bA3VI="),
"com.microsoft.emmx" to arrayOf("AeGZlxCoLCdJtNUMRF3IXWcLYTYInQp2anOCfIKh6sk="),
@@ -85,7 +85,7 @@ private val TRUSTED_BROWSER_CERTIFICATE_HASH =
"us.spotco.fennec_dos" to
arrayOf(
"Jg4KSWeMeLcMAtZTet07bcChcXG73oznX9QCaoo+GNI=",
- "/4H1vlY5ZZTu5w/vKDIlbhUhQSLiupzt0mAF/9S8qqg="
+ "/4H1vlY5ZZTu5w/vKDIlbhUhQSLiupzt0mAF/9S8qqg=",
),
"com.vivaldi.browser" to arrayOf("6KeFRGVbqMCYF/cydo9WibFmLsSyvFoLwOwTjTPKPR4="),
"app.vanadium.browser" to arrayOf("xq24uDxtTBfSkq/eVv1IilHTFv+PLBHFQQIjv/in27M="),
@@ -100,7 +100,7 @@ private fun isTrustedBrowser(context: Context, appPackage: String): Boolean {
internal enum class BrowserMultiOriginMethod {
None,
WebView,
- Field
+ Field,
}
/**
@@ -173,7 +173,7 @@ private fun isNoAccessibilityServiceEnabled(context: Context): Boolean {
// See https://chromium.googlesource.com/chromium/src/+/447a31e977a65e2eb78804e4a09633699b4ede33
return Settings.Secure.getString(
context.contentResolver,
- Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES
+ Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,
)
.isNullOrEmpty()
}
@@ -187,25 +187,22 @@ private fun getBrowserSaveFlag(context: Context, appPackage: String): Int? =
internal data class BrowserAutofillSupportInfo(
val multiOriginMethod: BrowserMultiOriginMethod,
- val saveFlags: Int?
+ val saveFlags: Int?,
)
@RequiresApi(Build.VERSION_CODES.O)
internal fun getBrowserAutofillSupportInfoIfTrusted(
context: Context,
- appPackage: String
+ appPackage: String,
): BrowserAutofillSupportInfo? {
if (!isTrustedBrowser(context, appPackage)) return null
return BrowserAutofillSupportInfo(
multiOriginMethod = getBrowserMultiOriginMethod(appPackage),
- saveFlags = getBrowserSaveFlag(context, appPackage)
+ saveFlags = getBrowserSaveFlag(context, appPackage),
)
}
-private val FLAKY_BROWSERS =
- listOf(
- "com.kiwibrowser.browser",
- )
+private val FLAKY_BROWSERS = listOf("com.kiwibrowser.browser")
public enum class BrowserAutofillSupportLevel {
None,
@@ -219,7 +216,7 @@ public enum class BrowserAutofillSupportLevel {
@RequiresApi(Build.VERSION_CODES.O)
private fun getBrowserAutofillSupportLevel(
context: Context,
- appPackage: String
+ appPackage: String,
): BrowserAutofillSupportLevel {
val browserInfo = getBrowserAutofillSupportInfoIfTrusted(context, appPackage)
return when {
@@ -252,7 +249,7 @@ public fun getInstalledBrowsersWithAutofillSupportLevel(
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
context.packageManager.queryIntentActivities(
testWebIntent,
- ResolveInfoFlags.of(PackageManager.MATCH_ALL.toLong())
+ ResolveInfoFlags.of(PackageManager.MATCH_ALL.toLong()),
)
} else {
context.packageManager.queryIntentActivities(testWebIntent, PackageManager.MATCH_ALL)
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 4d4dd218..5bcc7479 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
@@ -17,7 +17,7 @@ internal enum class CertaintyLevel {
Impossible,
Possible,
Likely,
- Certain
+ Certain,
}
/**
@@ -29,31 +29,19 @@ internal class FormField(
node: AssistStructure.ViewNode,
private val index: Int,
passDownWebViewOrigins: Boolean,
- passedDownWebOrigin: String? = null
+ passedDownWebOrigin: String? = null,
) {
companion object {
private val HINTS_USERNAME =
- listOf(
- HintConstants.AUTOFILL_HINT_USERNAME,
- HintConstants.AUTOFILL_HINT_NEW_USERNAME,
- )
- private val HINTS_NEW_PASSWORD =
- listOf(
- HintConstants.AUTOFILL_HINT_NEW_PASSWORD,
- )
+ listOf(HintConstants.AUTOFILL_HINT_USERNAME, HintConstants.AUTOFILL_HINT_NEW_USERNAME)
+ private val HINTS_NEW_PASSWORD = listOf(HintConstants.AUTOFILL_HINT_NEW_PASSWORD)
private val HINTS_PASSWORD =
HINTS_NEW_PASSWORD +
- listOf(
- HintConstants.AUTOFILL_HINT_PASSWORD,
- HintConstants.AUTOFILL_HINT_WIFI_PASSWORD,
- )
+ listOf(HintConstants.AUTOFILL_HINT_PASSWORD, HintConstants.AUTOFILL_HINT_WIFI_PASSWORD)
private val HINTS_OTP =
- listOf(
- HintConstants.AUTOFILL_HINT_SMS_OTP,
- HintConstants.AUTOFILL_HINT_2FA_APP_OTP,
- )
+ listOf(HintConstants.AUTOFILL_HINT_SMS_OTP, HintConstants.AUTOFILL_HINT_2FA_APP_OTP)
@Suppress("DEPRECATION")
private val HINTS_FILLABLE =
@@ -93,21 +81,9 @@ internal class FormField(
}
}
- private val HTML_INPUT_FIELD_TYPES_USERNAME =
- listOf(
- "email",
- "tel",
- "text",
- )
- private val HTML_INPUT_FIELD_TYPES_PASSWORD =
- listOf(
- "password",
- )
- private val HTML_INPUT_FIELD_TYPES_OTP =
- listOf(
- "tel",
- "text",
- )
+ private val HTML_INPUT_FIELD_TYPES_USERNAME = listOf("email", "tel", "text")
+ private val HTML_INPUT_FIELD_TYPES_PASSWORD = listOf("password")
+ private val HTML_INPUT_FIELD_TYPES_OTP = listOf("tel", "text")
private val HTML_INPUT_FIELD_TYPES_FILLABLE =
(HTML_INPUT_FIELD_TYPES_USERNAME +
HTML_INPUT_FIELD_TYPES_PASSWORD +
@@ -128,33 +104,11 @@ internal class FormField(
"captcha",
"postal", // Prevent postal code fields from being mistaken for OTP fields
)
- private val PASSWORD_HEURISTIC_TERMS =
- listOf(
- "pass",
- "pswd",
- "pwd",
- )
+ private val PASSWORD_HEURISTIC_TERMS = listOf("pass", "pswd", "pwd")
private val USERNAME_HEURISTIC_TERMS =
- listOf(
- "alias",
- "benutzername",
- "e-mail",
- "email",
- "mail",
- "login",
- "user",
- )
- private val OTP_HEURISTIC_TERMS =
- listOf(
- "einmal",
- "otp",
- "challenge",
- "verification",
- )
- private val OTP_WEAK_HEURISTIC_TERMS =
- listOf(
- "code",
- )
+ listOf("alias", "benutzername", "e-mail", "email", "mail", "login", "user")
+ private val OTP_HEURISTIC_TERMS = listOf("einmal", "otp", "challenge", "verification")
+ private val OTP_WEAK_HEURISTIC_TERMS = listOf("code")
}
private val List<String>.anyMatchesFieldInfo
diff --git a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/PublicSuffixListCache.kt b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/PublicSuffixListCache.kt
index 706aa6c5..64fb854f 100644
--- a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/PublicSuffixListCache.kt
+++ b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/PublicSuffixListCache.kt
@@ -39,7 +39,7 @@ public fun cachePublicSuffixList(context: Context) {
internal fun getPublicSuffixPlusOne(
context: Context,
domain: String,
- customSuffixes: Sequence<String>
+ customSuffixes: Sequence<String>,
) = runBlocking {
// We only feed valid domain names which are not IP addresses into getPublicSuffixPlusOne.
// We do not check whether the domain actually exists (actually, not even whether its TLD
@@ -77,7 +77,7 @@ private fun getSuffixPlusUpToOne(domain: String, suffix: String): String? {
private suspend fun getCanonicalSuffix(
context: Context,
domain: String,
- customSuffixes: Sequence<String>
+ customSuffixes: Sequence<String>,
): String {
val publicSuffixList = PublicSuffixListCache.getOrCachePublicSuffixList(context)
val publicSuffixPlusOne =
diff --git a/autofill-parser/src/main/java/mozilla/components/lib/publicsuffixlist/PublicSuffixList.kt b/autofill-parser/src/main/java/mozilla/components/lib/publicsuffixlist/PublicSuffixList.kt
index 4b45cd1c..eedde89f 100644
--- a/autofill-parser/src/main/java/mozilla/components/lib/publicsuffixlist/PublicSuffixList.kt
+++ b/autofill-parser/src/main/java/mozilla/components/lib/publicsuffixlist/PublicSuffixList.kt
@@ -29,7 +29,7 @@ import kotlinx.coroutines.async
internal class PublicSuffixList(
context: Context,
dispatcher: CoroutineDispatcher = Dispatchers.IO,
- private val scope: CoroutineScope = CoroutineScope(dispatcher)
+ private val scope: CoroutineScope = CoroutineScope(dispatcher),
) {
private val data: PublicSuffixListData by
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 97a2fbae..6f503b76 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
@@ -14,7 +14,7 @@ import mozilla.components.lib.publicsuffixlist.ext.binarySearch
/** Class wrapping the public suffix list data and offering methods for accessing rules in it. */
internal class PublicSuffixListData(
private val rules: ByteArray,
- private val exceptions: ByteArray
+ private val exceptions: ByteArray,
) {
private fun binarySearchRules(labels: List<ByteArray>, labelIndex: Int): String? {