Commit 10f33430 authored by Severin Rudie's avatar Severin Rudie Committed by Emily Kager
Browse files

For #4780: remove previous fix for leaking private mode status

This didn't function when 'open links in a private tab' was set.  Rather than adding another sketchy fix for the edge case, following commits will change `usePrivateMode` to be maintained in memory, instead of in Settings.
parent 47f952a2
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -117,10 +117,6 @@ open class FenixApplication : Application() {
        if ((System.currentTimeMillis() - settings().lastPlacesStorageMaintenance) > ONE_DAY_MILLIS) {
            runStorageMaintenance()
        }

        // This needs to be called before the theme is set. No BrowsingModeManager is available
        // at this point, which is why this is set directly
        maybeClearPrivateMode()
    }

    private fun runStorageMaintenance() {
@@ -132,14 +128,6 @@ open class FenixApplication : Application() {
        settings().lastPlacesStorageMaintenance = System.currentTimeMillis()
    }

    /**
     * Clears private mode. This is done in order to avoid leaking the fact that
     * private mode was in use during the previous session.
     */
    fun maybeClearPrivateMode(settings: Settings = settings()) {
        if (!settings.openLinksInAPrivateTab) settings.usePrivateMode = false
    }

    private fun registerRxExceptionHandling() {
        RxJavaPlugins.setErrorHandler {
            throw it.cause ?: it
+0 −5
Original line number Diff line number Diff line
@@ -63,11 +63,6 @@ class SessionNotificationService : Service() {
    override fun onTaskRemoved(rootIntent: Intent) {
        components.core.sessionManager.removeAndCloseAllPrivateSessions()

        // This is currently safe because we remove this service while destroying activities. If
        // this service is ever removed while HomeActivity is still active, this could cause
        // theming issues. See usePrivateMode kdoc
        baseContext.application.maybeClearPrivateMode()

        stopForeground(true)
        stopSelf()
    }