
Dan Ballard pushed to branch tor-browser-128.14.0esr-14.5-1 at The Tor Project / Applications / Tor Browser Commits: 5a8cfa37 by clairehurst at 2025-08-26T17:10:09-05: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 ===================================== @@ -37,6 +37,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 + private var onPermissionGranted: OnPermissionGranted = { } private var onPermissionRejected: OnPermissionRejected = { } private val notificationPermissionHandler: MutableMap<AppCompatActivity, ActivityResultLauncher<String>> = ===================================== mobile/android/fenix/app/src/main/java/org/mozilla/fenix/HomeActivity.kt ===================================== @@ -635,10 +635,6 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity, TorAn override fun onDestroy() { super.onDestroy() - if (isFinishing) { - exitProcess(0) - } - // Diagnostic breadcrumb for "Display already aquired" crash: // https://github.com/mozilla-mobile/android-components/issues/7960 breadcrumb( @@ -658,6 +654,16 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity, TorAn if (this !is ExternalAppBrowserActivity && !activityStartedWithLink) { 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 + } } final override fun onConfigurationChanged(newConfig: Configuration) { ===================================== mobile/android/fenix/app/src/main/java/org/mozilla/fenix/session/PrivateNotificationService.kt ===================================== @@ -70,6 +70,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/5a8cfa37... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/5a8cfa37... You're receiving this email because of your account on gitlab.torproject.org.
participants (1)
-
Dan Ballard (@dan)