From 10f334303ddad4ba064084c7e133a59d0e33ab70 Mon Sep 17 00:00:00 2001 From: Severin Rudie Date: Mon, 7 Oct 2019 10:45:32 -0700 Subject: [PATCH] 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. --- .../main/java/org/mozilla/fenix/FenixApplication.kt | 12 ------------ .../fenix/session/SessionNotificationService.kt | 5 ----- 2 files changed, 17 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/FenixApplication.kt b/app/src/main/java/org/mozilla/fenix/FenixApplication.kt index 00e4c9393..33aaad640 100644 --- a/app/src/main/java/org/mozilla/fenix/FenixApplication.kt +++ b/app/src/main/java/org/mozilla/fenix/FenixApplication.kt @@ -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 diff --git a/app/src/main/java/org/mozilla/fenix/session/SessionNotificationService.kt b/app/src/main/java/org/mozilla/fenix/session/SessionNotificationService.kt index 60ebf6db4..f1e4db812 100644 --- a/app/src/main/java/org/mozilla/fenix/session/SessionNotificationService.kt +++ b/app/src/main/java/org/mozilla/fenix/session/SessionNotificationService.kt @@ -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() }