tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 3a70684a114d6b50380a65787ac9deeabee8bbf8
parent be52f52e18286c6ec6946f3cf2b02910aded3964
Author: fmasalha <fmasalha@mozilla.com>
Date:   Mon, 27 Oct 2025 18:31:45 +0000

Bug 1988733 - Added a autofill callback to ensure the nav stack is not popped if android autofill auth is prompted. r=android-reviewers,boek

Differential Revision: https://phabricator.services.mozilla.com/D269059

Diffstat:
Mmobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/creditcards/CreditCardEditorFragment.kt | 37+++++++++++++++++++++++++++++++------
1 file changed, 31 insertions(+), 6 deletions(-)

diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/creditcards/CreditCardEditorFragment.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/creditcards/CreditCardEditorFragment.kt @@ -10,6 +10,7 @@ import android.view.Menu import android.view.MenuInflater import android.view.MenuItem import android.view.View +import android.view.autofill.AutofillManager import android.widget.AdapterView import androidx.appcompat.app.AlertDialog import androidx.core.view.MenuProvider @@ -59,6 +60,26 @@ class CreditCardEditorFragment : private lateinit var interactor: CreditCardEditorInteractor + private var isAutofillSessionActive = false + + private val autofillCallback = object : AutofillManager.AutofillCallback() { + override fun onAutofillEvent(view: View, event: Int) { + super.onAutofillEvent(view, event) + + when (event) { + EVENT_INPUT_SHOWN -> { + isAutofillSessionActive = true + } + EVENT_INPUT_HIDDEN -> { + isAutofillSessionActive = false + } + EVENT_INPUT_UNAVAILABLE -> { + isAutofillSessionActive = false + } + } + } + } + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -110,6 +131,7 @@ class CreditCardEditorFragment : override fun onResume() { super.onResume() + activity?.getSystemService(AutofillManager::class.java)?.registerCallback(autofillCallback) if (!isEditing) { showToolbar(getString(R.string.credit_cards_add_card)) } else { @@ -122,16 +144,19 @@ class CreditCardEditorFragment : * fragment is paused and the user is not navigating to [CreditCardsManagementFragment]. */ override fun onPause() { + activity?.getSystemService(AutofillManager::class.java)?.unregisterCallback(autofillCallback) + view?.hideKeyboard() menu.close() deleteDialog?.dismiss() - redirectToReAuth( - listOf(R.id.creditCardsManagementFragment), - findNavController().currentDestination?.id, - R.id.creditCardEditorFragment, - ) - + if (!isAutofillSessionActive) { + redirectToReAuth( + listOf(R.id.creditCardsManagementFragment), + findNavController().currentDestination?.id, + R.id.creditCardEditorFragment, + ) + } super.onPause() }