Skip to content

Completely stop the Private Notifcation Service

When the app is closed (destroyed), it currently calls stop on the notification service's observer:

https://gitlab.torproject.org/tpo/applications/fenix/-/blob/tor-browser-82.0.0b4-10.0-1/app/src/main/java/org/mozilla/fenix/HomeActivity.kt#L364

    override fun onDestroy() {
        super.onDestroy()

        // Diagnostic breadcrumb for "Display already aquired" crash:
        // https://github.com/mozilla-mobile/android-components/issues/7960
        breadcrumb(
            message = "onDestroy()",
            data = mapOf(
                "finishing" to isFinishing.toString()
            )
        )

        privateNotificationObserver?.stop()

Unfortunately, that doesn't stop the underlying Service:

https://gitlab.torproject.org/tpo/applications/android-components/-/blob/android-components-60.0.3-10.0-1/components/feature/privatemode/src/main/java/mozilla/components/feature/privatemode/notification/PrivateNotificationFeature.kt#L50

    override fun stop() {
        scope?.cancel()
    }

This causes issues like the one described n fenix!49 (comment 2712256)