Skip to content

Commit 94c85a5

Browse files
authored
Prevent system autofill offering to save passwords (#5091)
Task/Issue URL: https://app.asana.com/0/1203822806345703/1208458715174512/f ### Description On Android 14, `importantForAutofill` is not respected so need to do something else to stop the system autofill provider prompt offering to save a password that our user has just manually entered or edited ### Steps to test this PR QA-optional. But if you are curious: - [ ] Install on Android 14 device, with Google Password Manager set as autofill provider - [ ] Manually add a password in our password management screen and save it. Return to the password management list - [ ] Verify you aren't prompted to save in Google Password Manager
1 parent 6a0a463 commit 94c85a5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/ui/credential/management/viewing/AutofillManagementCredentialsMode.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ import android.view.Menu
2323
import android.view.MenuInflater
2424
import android.view.MenuItem
2525
import android.view.View
26+
import android.view.autofill.AutofillManager
2627
import android.widget.CompoundButton
2728
import androidx.appcompat.app.ActionBar
2829
import androidx.appcompat.app.AppCompatActivity
2930
import androidx.appcompat.widget.Toolbar
30-
import androidx.core.content.ContextCompat.startActivity
3131
import androidx.core.graphics.drawable.toBitmap
3232
import androidx.core.view.MenuProvider
3333
import androidx.lifecycle.Lifecycle
@@ -237,6 +237,7 @@ class AutofillManagementCredentialsMode : DuckDuckGoFragment(R.layout.fragment_a
237237

238238
override fun onDestroyView() {
239239
super.onDestroyView()
240+
disableSystemAutofillServiceOnPasswordField()
240241
resetToolbarOnExit()
241242
binding.removeSaveStateWatcher(saveStateWatcher)
242243
}
@@ -502,6 +503,9 @@ class AutofillManagementCredentialsMode : DuckDuckGoFragment(R.layout.fragment_a
502503

503504
private fun disableSystemAutofillServiceOnPasswordField() {
504505
binding.passwordEditText.importantForAutofill = View.IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS
506+
context?.let {
507+
it.getSystemService(AutofillManager::class.java)?.cancel()
508+
}
505509
}
506510

507511
private fun String.convertBlankToNull(): String? = this.ifBlank { null }

0 commit comments

Comments
 (0)