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

Commits:

3 changed files:

Changes:

  • mobile/android/android-components/components/support/base/src/main/java/mozilla/components/support/base/android/NotificationsDelegate.kt
    ... ... @@ -37,6 +37,15 @@ class NotificationsDelegate(
    37 37
         var isRequestingPermission: Boolean = false
    
    38 38
             private set
    
    39 39
     
    
    40
    +    /**
    
    41
    +     * Defaults to true, normal behavior is to destroy the app when OnDestroy is called with isFinishing set to true
    
    42
    +     *
    
    43
    +     * A value of false indicates that the notification was just swiped away and the app should not shut down on it's behalf
    
    44
    +     *
    
    45
    +     * Workaround to make swiping the notification away not shutdown the app
    
    46
    +     */
    
    47
    +    var shouldShutDownWithOnDestroyWhenIsFinishing: Boolean = true
    
    48
    +
    
    40 49
         private var onPermissionGranted: OnPermissionGranted = { }
    
    41 50
         private var onPermissionRejected: OnPermissionRejected = { }
    
    42 51
         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
    635 635
         override fun onDestroy() {
    
    636 636
             super.onDestroy()
    
    637 637
     
    
    638
    -        if (isFinishing) {
    
    639
    -            exitProcess(0)
    
    640
    -        }
    
    641
    -
    
    642 638
             // Diagnostic breadcrumb for "Display already aquired" crash:
    
    643 639
             // https://github.com/mozilla-mobile/android-components/issues/7960
    
    644 640
             breadcrumb(
    
    ... ... @@ -658,6 +654,16 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity, TorAn
    658 654
             if (this !is ExternalAppBrowserActivity && !activityStartedWithLink) {
    
    659 655
                 stopMediaSession()
    
    660 656
             }
    
    657
    +
    
    658
    +        if (applicationContext.components.notificationsDelegate.shouldShutDownWithOnDestroyWhenIsFinishing) {
    
    659
    +            if (isFinishing) {
    
    660
    +                shutDown()
    
    661
    +            }
    
    662
    +        } else {
    
    663
    +            // We only want to not shut down when the notification is swiped away,
    
    664
    +            // if we do not reset this value
    
    665
    +            applicationContext.components.notificationsDelegate.shouldShutDownWithOnDestroyWhenIsFinishing = true
    
    666
    +        }
    
    661 667
         }
    
    662 668
     
    
    663 669
         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() {
    70 70
         @SuppressLint("MissingSuperCall")
    
    71 71
         override fun erasePrivateTabs() {
    
    72 72
             val inPrivateMode = store.state.selectedTab?.content?.private ?: false
    
    73
    +        notificationsDelegate.shouldShutDownWithOnDestroyWhenIsFinishing = false
    
    73 74
     
    
    74 75
             // Trigger use case directly for now (instead of calling super.erasePrivateTabs)
    
    75 76
             // as otherwise SessionManager and the store will be out of sync.