Dan Ballard pushed to branch tor-browser-152.0a1-16.0-2 at The Tor Project / Applications / Tor Browser Commits: bff7e7d7 by clairehurst at 2026-06-08T11:44:47-06:00 fixup! [android] Implement Android-native Connection Assist UI Bug 43576: Connection Assist on Android Fast Follows (Bug 41188) Add frequent regions - - - - - bfdbead3 by clairehurst at 2026-06-08T11:44:47-06:00 fixup! TB 42247: Android helpers for the TorProvider Bug 43576: Connection Assist on Android Fast Follows (Bug 41188) Add frequent regions - - - - - 4 changed files: - mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tor/TorConnectionAssistFragment.kt - mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tor/TorConnectionAssistViewModel.kt - mobile/android/geckoview/src/main/java/org/mozilla/geckoview/TorAndroidIntegration.java - toolkit/modules/TorAndroidIntegration.sys.mjs Changes: ===================================== mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tor/TorConnectionAssistFragment.kt ===================================== @@ -212,6 +212,7 @@ class TorConnectionAssistFragment : Fragment(), UserInteractionHandler, SystemIn if (screen.regionDropDownVisible) { if (binding.countryDropDown.isEmpty()) { regionDropDownSpinnerAdapter = initializeSpinner() + torConnectionAssistViewModel.fetchFrequentRegions() torConnectionAssistViewModel.fetchRegionNames() } @@ -285,6 +286,18 @@ class TorConnectionAssistFragment : Fragment(), UserInteractionHandler, SystemIn } } + viewLifecycleOwner.lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.STARTED) { + torConnectionAssistViewModel.frequentRegionCodes.collect { + if (it != null) { + for (region in it) { + Log.d(TAG, "collected region: $region") + } + } + } + } + } + return spinnerAdapter } ===================================== mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tor/TorConnectionAssistViewModel.kt ===================================== @@ -80,6 +80,14 @@ class TorConnectionAssistViewModel( } } + fun fetchFrequentRegions() { + torAndroidIntegration.frequentRegionNamesGet { frequentRegionNames -> + if (frequentRegionNames != null) { + frequentRegionCodes.value = frequentRegionNames + } + } + } + override fun onCleared() { torAndroidIntegration.unregisterBootstrapStateChangeListener(this) super.onCleared() @@ -96,6 +104,10 @@ class TorConnectionAssistViewModel( MutableStateFlow(null) } + val frequentRegionCodes: MutableStateFlow<Array<String>?> by lazy { + MutableStateFlow(null) + } + val selectedCountryCode: MutableStateFlow<String> by lazy { MutableStateFlow("automatic") } ===================================== mobile/android/geckoview/src/main/java/org/mozilla/geckoview/TorAndroidIntegration.java ===================================== @@ -60,6 +60,7 @@ public class TorAndroidIntegration implements BundleEventListener { private static final String EVENT_QUICKSTART_GET = "GeckoView:Tor:QuickstartGet"; private static final String EVENT_QUICKSTART_SET = "GeckoView:Tor:QuickstartSet"; private static final String EVENT_REGION_NAMES_GET = "GeckoView:Tor:RegionNamesGet"; + private static final String EVENT_FREQUENT_REGION_NAMES_GET = "GeckoView:Tor:FrequentRegionNamesGet"; private static final String EVENT_SHOULD_SHOW_TOR_CONNECT = "GeckoView:Tor:ShouldShowTorConnect"; private static final String CONTROL_PORT_FILE = "/control-ipc"; @@ -709,6 +710,19 @@ public class TorAndroidIntegration implements BundleEventListener { }); } + public interface FrequentRegionNamesGetter { + void onValue(String[] frequentRegionNames); + } + + public void frequentRegionNamesGet(FrequentRegionNamesGetter frequentRegionNamesGetter) { + EventDispatcher.getInstance().queryBundle(EVENT_FREQUENT_REGION_NAMES_GET).then( frequentRegionNames -> { + if (frequentRegionNames != null) { + frequentRegionNamesGetter.onValue(frequentRegionNames.getStringArray("codes")); + } + return new GeckoResult<Void>(); + }); + } + public interface ShouldShowTorConnectGetter { void onValue(Boolean shouldShowTorConnect); } ===================================== toolkit/modules/TorAndroidIntegration.sys.mjs ===================================== @@ -49,6 +49,7 @@ const ListenedEvents = Object.freeze({ quickstartGet: "GeckoView:Tor:QuickstartGet", quickstartSet: "GeckoView:Tor:QuickstartSet", regionNamesGet: "GeckoView:Tor:RegionNamesGet", + frequentRegionNamesGet: "GeckoView:Tor:FrequentRegionNamesGet", shouldShowTorConnectGet: "GeckoView:Tor:ShouldShowTorConnect", }); @@ -213,6 +214,11 @@ class TorAndroidIntegrationImpl { case ListenedEvents.regionNamesGet: callback?.onSuccess(lazy.TorConnect.getRegionNames()); return; + case ListenedEvents.frequentRegionNamesGet: + callback?.onSuccess({ + codes: await lazy.TorConnect.getFrequentRegions(), + }); + return; case ListenedEvents.shouldShowTorConnectGet: callback?.onSuccess(lazy.TorConnect.shouldShowTorConnect()); return; View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/631e5e4... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/631e5e4... You're receiving this email because of your account on gitlab.torproject.org. Manage all notifications: https://gitlab.torproject.org/-/profile/notifications | Help: https://gitlab.torproject.org/help
participants (1)
-
Dan Ballard (@dan)