clairehurst pushed to branch tor-browser-147.0a1-16.0-2 at The Tor Project / 
Applications / Tor Browser


Commits:
5eb4ba41 by Dan Ballard at 2026-02-05T13:09:54-07:00
fixup! TB 42247: Android helpers for the TorProvider

Bug 43645: wiring in proper call to shutdown the tor process

- - - - -
c9a70495 by Dan Ballard at 2026-02-05T13:09:54-07:00
fixup! TB 41878: [android] Add standalone Tor Bootstrap

Bug 43645: wire in call to shutdown tor process onDestroy

- - - - -


4 changed files:

- mobile/android/fenix/app/src/main/java/org/mozilla/fenix/HomeActivity.kt
- mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tor/TorController.kt
- 
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tor/TorControllerGV.kt
- 
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/TorAndroidIntegration.java


Changes:

=====================================
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/HomeActivity.kt
=====================================
@@ -184,6 +184,7 @@ import mozilla.components.browser.engine.gecko.GeckoEngine
 import org.mozilla.fenix.compose.core.Action
 import org.mozilla.fenix.compose.snackbar.SnackbarState
 import org.mozilla.fenix.compose.snackbar.Snackbar
+import org.mozilla.fenix.tor.TorController
 import org.mozilla.fenix.tor.UrlQuickLoadViewModel
 import org.mozilla.geckoview.TorAndroidIntegration.BootstrapStateChangeListener
 import org.mozilla.geckoview.TorConnectStage
@@ -1586,6 +1587,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), 
NavHostActivity {
         // If we don't manually stop the service, the persistent "close tabs" 
notification sometimes does not clear
         applicationContext.stopService(Intent(applicationContext, 
PrivateNotificationService::class.java))
         finishAndRemoveTask()
+        components.torController.shutdown()
         exitProcess(0)
     }
 }


=====================================
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tor/TorController.kt
=====================================
@@ -38,4 +38,5 @@ interface TorController {
 
     fun initiateTorBootstrap(lifecycleScope: LifecycleCoroutineScope? = null, 
withDebugLogging: Boolean = false)
     fun stopTor()
+    fun shutdown()
 }


=====================================
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tor/TorControllerGV.kt
=====================================
@@ -176,6 +176,10 @@ class TorControllerGV(
         getTorIntegration().cancelBootstrap()
     }
 
+    override fun shutdown() {
+        getTorIntegration().shutdown()
+    }
+
     // TorEventsBootstrapStateChangeListener
     override fun onBootstrapStageChange(stage: TorConnectStage) {
         Log.d(TAG, "onBootstrapStageChange(stage = $stage)")


=====================================
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/TorAndroidIntegration.java
=====================================
@@ -105,8 +105,8 @@ public class TorAndroidIntegration implements 
BundleEventListener {
     registerListener();
   }
 
-  /* package */ synchronized void shutdown() {
-    // FIXME: It seems this never gets called
+  // To be called when the app is shutting down only
+  public synchronized void shutdown() {
     if (mTorProcess != null) {
       mTorProcess.shutdown();
       mTorProcess = null;
@@ -332,7 +332,7 @@ public class TorAndroidIntegration implements 
BundleEventListener {
           Log.i(TAG, "[tor-" + mHandle + "] " + line);
         }
       } catch (IOException e) {
-        Log.e(TAG, "Failed to read stdout of the tor process " + mHandle, e);
+        Log.e(TAG, "Failed to read stdout of the tor process " + mHandle + " 
(expected when program is exiting)", e);
       }
       Log.d(TAG, "Exiting the stdout loop for process " + mHandle);
       final GeckoBundle data = new GeckoBundle(2);



View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/cd8bcb6e7528a2a6740c3295a564e14709f20ee4...c9a704954e6f96908495eb9382c407c64ba18986

-- 
View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/cd8bcb6e7528a2a6740c3295a564e14709f20ee4...c9a704954e6f96908495eb9382c407c64ba18986
You're receiving this email because of your account on gitlab.torproject.org.


_______________________________________________
tor-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to