Dan Ballard pushed to branch tor-browser-140.2.0esr-15.0-1 at The Tor Project / 
Applications / Tor Browser


Commits:
1df86592 by clairehurst at 2025-08-26T14:27:58-07:00
fixup! [android] Implement Android-native Connection Assist UI

Bug_44081: Swiping away the "private tabs" notification requires 
rebootstrapping.

- - - - -


3 changed files:

- 
mobile/android/android-components/components/support/base/src/main/java/mozilla/components/support/base/android/NotificationsDelegate.kt
- mobile/android/fenix/app/src/main/java/org/mozilla/fenix/HomeActivity.kt
- 
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/session/PrivateNotificationService.kt


Changes:

=====================================
mobile/android/android-components/components/support/base/src/main/java/mozilla/components/support/base/android/NotificationsDelegate.kt
=====================================
@@ -33,6 +33,15 @@ class NotificationsDelegate(
     var isRequestingPermission: Boolean = false
         private set
 
+    /**
+     * Defaults to true, normal behavior is to destroy the app when OnDestroy 
is called with isFinishing set to true
+     *
+     * A value of false indicates that the notification was just swiped away 
and the app should not shut down on it's behalf
+     *
+     * Workaround to make swiping the notification away not shutdown the app
+     */
+    var shouldShutDownWithOnDestroyWhenIsFinishing: Boolean = true
+
     @VisibleForTesting
     internal var permissionRequestsCount: Int = 0
 


=====================================
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/HomeActivity.kt
=====================================
@@ -821,10 +821,6 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), 
NavHostActivity, TorAn
 
         super.onDestroy()
 
-        if (isFinishing) {
-            exitProcess(0)
-        }
-
         // Diagnostic breadcrumb for "Display already aquired" crash:
         // https://github.com/mozilla-mobile/android-components/issues/7960
         breadcrumb(
@@ -852,6 +848,16 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), 
NavHostActivity, TorAn
             stopMediaSession()
         }
 
+        if 
(applicationContext.components.notificationsDelegate.shouldShutDownWithOnDestroyWhenIsFinishing)
 {
+            if (isFinishing) {
+                shutDown()
+            }
+        } else {
+            // We only want to not shut down when the notification is swiped 
away,
+            // if we do not reset this value
+            
applicationContext.components.notificationsDelegate.shouldShutDownWithOnDestroyWhenIsFinishing
 = true
+        }
+
         components.core.engine.profiler?.addMarker(
             MarkersActivityLifecycleCallbacks.MARKER_NAME,
             startTimeProfiler,


=====================================
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/session/PrivateNotificationService.kt
=====================================
@@ -79,6 +79,7 @@ class PrivateNotificationService : 
AbstractPrivateNotificationService() {
     @SuppressLint("MissingSuperCall")
     override fun erasePrivateTabs() {
         val inPrivateMode = store.state.selectedTab?.content?.private ?: false
+        notificationsDelegate.shouldShutDownWithOnDestroyWhenIsFinishing = 
false
 
         // Trigger use case directly for now (instead of calling 
super.erasePrivateTabs)
         // as otherwise SessionManager and the store will be out of sync.



View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/1df86592894237ddcc72947ac04b6f8a2aa38fe2

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


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

Reply via email to