Skip to content

Commit 101d0f3

Browse files
authored
Autofill service fallback FF (#5836)
Task/Issue URL: https://app.asana.com/0/1149059203486286/1209843796003365/f ### Description See: https://app.asana.com/0/488551667048375/1209843796003365/f TLDR; adds an extra fallback FF in case we can't rely on the parent FF ### Steps to test this PR N/A ### UI changes | Before | After | | ------ | ----- | !(Upload before screenshot)|(Upload after screenshot)|
1 parent 33d5b6c commit 101d0f3

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/service/AutofillServiceFeature.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,7 @@ interface AutofillServiceFeature {
4444
@Toggle.DefaultValue(false)
4545
@InternalAlwaysEnabled
4646
fun canAutofillInsideDDG(): Toggle
47+
48+
@Toggle.DefaultValue(true)
49+
fun canProcessSystemFillRequests(): Toggle
4750
}

autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/service/RealAutofillService.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class RealAutofillService : AutofillService() {
7676

7777
autofillJob += coroutineScope.launch(dispatcherProvider.io()) {
7878
runCatching {
79-
if (autofillServiceFeature.self().isEnabled().not()) {
79+
if (isAutofillServiceEnabled().not()) {
8080
callback.onSuccess(null)
8181
return@launch
8282
}
@@ -169,6 +169,10 @@ class RealAutofillService : AutofillService() {
169169
Timber.v("DDGAutofillService onDisconnected")
170170
}
171171

172+
private fun isAutofillServiceEnabled(): Boolean {
173+
return autofillServiceFeature.self().isEnabled() && autofillServiceFeature.canProcessSystemFillRequests().isEnabled()
174+
}
175+
172176
companion object {
173177
private val DDG_PACKAGE_IDS = setOf(
174178
"com.duckduckgo.mobile.android",

0 commit comments

Comments
 (0)