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.master
parent
47f952a2a2
commit
10f334303d
|
@ -117,10 +117,6 @@ open class FenixApplication : Application() {
|
||||||
if ((System.currentTimeMillis() - settings().lastPlacesStorageMaintenance) > ONE_DAY_MILLIS) {
|
if ((System.currentTimeMillis() - settings().lastPlacesStorageMaintenance) > ONE_DAY_MILLIS) {
|
||||||
runStorageMaintenance()
|
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() {
|
private fun runStorageMaintenance() {
|
||||||
|
@ -132,14 +128,6 @@ open class FenixApplication : Application() {
|
||||||
settings().lastPlacesStorageMaintenance = System.currentTimeMillis()
|
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() {
|
private fun registerRxExceptionHandling() {
|
||||||
RxJavaPlugins.setErrorHandler {
|
RxJavaPlugins.setErrorHandler {
|
||||||
throw it.cause ?: it
|
throw it.cause ?: it
|
||||||
|
|
|
@ -63,11 +63,6 @@ class SessionNotificationService : Service() {
|
||||||
override fun onTaskRemoved(rootIntent: Intent) {
|
override fun onTaskRemoved(rootIntent: Intent) {
|
||||||
components.core.sessionManager.removeAndCloseAllPrivateSessions()
|
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)
|
stopForeground(true)
|
||||||
stopSelf()
|
stopSelf()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue