Mark Chrome Canary as non-flaky and allowing save (#1237)
* Mark Chrome Canary as non-flaky and allowing save * autofill-parser: update API dump Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * autofill-parser: bump snapshot version Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> Co-authored-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
f56086cd78
commit
2e43d77c5c
5 changed files with 24 additions and 4 deletions
|
@ -514,6 +514,7 @@ class UserPreference : AppCompatActivity() {
|
||||||
BrowserAutofillSupportLevel.None -> getString(R.string.oreo_autofill_no_support)
|
BrowserAutofillSupportLevel.None -> getString(R.string.oreo_autofill_no_support)
|
||||||
BrowserAutofillSupportLevel.FlakyFill -> getString(R.string.oreo_autofill_flaky_fill_support)
|
BrowserAutofillSupportLevel.FlakyFill -> getString(R.string.oreo_autofill_flaky_fill_support)
|
||||||
BrowserAutofillSupportLevel.PasswordFill -> getString(R.string.oreo_autofill_password_fill_support)
|
BrowserAutofillSupportLevel.PasswordFill -> getString(R.string.oreo_autofill_password_fill_support)
|
||||||
|
BrowserAutofillSupportLevel.PasswordFillAndSaveIfNoAccessibility -> getString(R.string.oreo_autofill_password_fill_and_conditional_save_support)
|
||||||
BrowserAutofillSupportLevel.GeneralFill -> getString(R.string.oreo_autofill_general_fill_support)
|
BrowserAutofillSupportLevel.GeneralFill -> getString(R.string.oreo_autofill_general_fill_support)
|
||||||
BrowserAutofillSupportLevel.GeneralFillAndSave -> getString(R.string.oreo_autofill_general_fill_and_save_support)
|
BrowserAutofillSupportLevel.GeneralFillAndSave -> getString(R.string.oreo_autofill_general_fill_and_save_support)
|
||||||
}
|
}
|
||||||
|
|
|
@ -398,5 +398,6 @@
|
||||||
<string name="port">Port</string>
|
<string name="port">Port</string>
|
||||||
<string name="pref_proxy_settings">HTTP(S) proxy settings</string>
|
<string name="pref_proxy_settings">HTTP(S) proxy settings</string>
|
||||||
<string name="invalid_proxy_url">Invalid URL</string>
|
<string name="invalid_proxy_url">Invalid URL</string>
|
||||||
|
<string name="oreo_autofill_password_fill_and_conditional_save_support">Fill and save passwords (saving requires that no accessibility services are enabled)</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -40,6 +40,7 @@ public final class com/github/androidpasswordstore/autofillparser/BrowserAutofil
|
||||||
public static final field GeneralFillAndSave Lcom/github/androidpasswordstore/autofillparser/BrowserAutofillSupportLevel;
|
public static final field GeneralFillAndSave Lcom/github/androidpasswordstore/autofillparser/BrowserAutofillSupportLevel;
|
||||||
public static final field None Lcom/github/androidpasswordstore/autofillparser/BrowserAutofillSupportLevel;
|
public static final field None Lcom/github/androidpasswordstore/autofillparser/BrowserAutofillSupportLevel;
|
||||||
public static final field PasswordFill Lcom/github/androidpasswordstore/autofillparser/BrowserAutofillSupportLevel;
|
public static final field PasswordFill Lcom/github/androidpasswordstore/autofillparser/BrowserAutofillSupportLevel;
|
||||||
|
public static final field PasswordFillAndSaveIfNoAccessibility Lcom/github/androidpasswordstore/autofillparser/BrowserAutofillSupportLevel;
|
||||||
public static fun valueOf (Ljava/lang/String;)Lcom/github/androidpasswordstore/autofillparser/BrowserAutofillSupportLevel;
|
public static fun valueOf (Ljava/lang/String;)Lcom/github/androidpasswordstore/autofillparser/BrowserAutofillSupportLevel;
|
||||||
public static fun values ()[Lcom/github/androidpasswordstore/autofillparser/BrowserAutofillSupportLevel;
|
public static fun values ()[Lcom/github/androidpasswordstore/autofillparser/BrowserAutofillSupportLevel;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
GROUP=com.github.androidpasswordstore
|
GROUP=com.github.androidpasswordstore
|
||||||
VERSION_NAME=1.0.0
|
VERSION_NAME=1.1.0-SNAPSHOT
|
||||||
POM_ARTIFACT_ID=autofill-parser
|
POM_ARTIFACT_ID=autofill-parser
|
||||||
POM_ARTIFACT_DESCRIPTION=Android library for low-level parsing of Autofill structures
|
POM_ARTIFACT_DESCRIPTION=Android library for low-level parsing of Autofill structures
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@ import android.content.Intent
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
|
import android.provider.Settings
|
||||||
|
import android.service.autofill.SaveInfo
|
||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -143,7 +145,21 @@ private val BROWSER_SAVE_FLAG = mapOf(
|
||||||
)
|
)
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
private fun getBrowserSaveFlag(appPackage: String): Int? = BROWSER_SAVE_FLAG[appPackage]
|
private val BROWSER_SAVE_FLAG_IF_NO_ACCESSIBILITY = mapOf(
|
||||||
|
"com.chrome.canary" to SaveInfo.FLAG_SAVE_ON_ALL_VIEWS_INVISIBLE,
|
||||||
|
)
|
||||||
|
|
||||||
|
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).isNullOrEmpty()
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
|
private fun getBrowserSaveFlag(context: Context, appPackage: String): Int? =
|
||||||
|
BROWSER_SAVE_FLAG[appPackage] ?: BROWSER_SAVE_FLAG_IF_NO_ACCESSIBILITY[appPackage]?.takeIf {
|
||||||
|
isNoAccessibilityServiceEnabled(context)
|
||||||
|
}
|
||||||
|
|
||||||
internal data class BrowserAutofillSupportInfo(
|
internal data class BrowserAutofillSupportInfo(
|
||||||
val multiOriginMethod: BrowserMultiOriginMethod,
|
val multiOriginMethod: BrowserMultiOriginMethod,
|
||||||
|
@ -158,14 +174,13 @@ internal fun getBrowserAutofillSupportInfoIfTrusted(
|
||||||
if (!isTrustedBrowser(context, appPackage)) return null
|
if (!isTrustedBrowser(context, appPackage)) return null
|
||||||
return BrowserAutofillSupportInfo(
|
return BrowserAutofillSupportInfo(
|
||||||
multiOriginMethod = getBrowserMultiOriginMethod(appPackage),
|
multiOriginMethod = getBrowserMultiOriginMethod(appPackage),
|
||||||
saveFlags = getBrowserSaveFlag(appPackage)
|
saveFlags = getBrowserSaveFlag(context, appPackage)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val FLAKY_BROWSERS = listOf(
|
private val FLAKY_BROWSERS = listOf(
|
||||||
"com.android.chrome",
|
"com.android.chrome",
|
||||||
"com.chrome.beta",
|
"com.chrome.beta",
|
||||||
"com.chrome.canary",
|
|
||||||
"com.chrome.dev",
|
"com.chrome.dev",
|
||||||
"org.bromite.bromite",
|
"org.bromite.bromite",
|
||||||
"org.ungoogled.chromium.stable",
|
"org.ungoogled.chromium.stable",
|
||||||
|
@ -176,6 +191,7 @@ public enum class BrowserAutofillSupportLevel {
|
||||||
None,
|
None,
|
||||||
FlakyFill,
|
FlakyFill,
|
||||||
PasswordFill,
|
PasswordFill,
|
||||||
|
PasswordFillAndSaveIfNoAccessibility,
|
||||||
GeneralFill,
|
GeneralFill,
|
||||||
GeneralFillAndSave,
|
GeneralFillAndSave,
|
||||||
}
|
}
|
||||||
|
@ -189,6 +205,7 @@ private fun getBrowserAutofillSupportLevel(
|
||||||
return when {
|
return when {
|
||||||
browserInfo == null -> BrowserAutofillSupportLevel.None
|
browserInfo == null -> BrowserAutofillSupportLevel.None
|
||||||
appPackage in FLAKY_BROWSERS -> BrowserAutofillSupportLevel.FlakyFill
|
appPackage in FLAKY_BROWSERS -> BrowserAutofillSupportLevel.FlakyFill
|
||||||
|
appPackage in BROWSER_SAVE_FLAG_IF_NO_ACCESSIBILITY -> BrowserAutofillSupportLevel.PasswordFillAndSaveIfNoAccessibility
|
||||||
browserInfo.multiOriginMethod == BrowserMultiOriginMethod.None -> BrowserAutofillSupportLevel.PasswordFill
|
browserInfo.multiOriginMethod == BrowserMultiOriginMethod.None -> BrowserAutofillSupportLevel.PasswordFill
|
||||||
browserInfo.saveFlags == null -> BrowserAutofillSupportLevel.GeneralFill
|
browserInfo.saveFlags == null -> BrowserAutofillSupportLevel.GeneralFill
|
||||||
else -> BrowserAutofillSupportLevel.GeneralFillAndSave
|
else -> BrowserAutofillSupportLevel.GeneralFillAndSave
|
||||||
|
|
Loading…
Reference in a new issue