Loading app/src/main/java/org/mozilla/fenix/FenixApplication.kt +12 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,8 @@ open class FenixApplication : LocaleAwareApplication(), Provider { private val logger = Logger("FenixApplication") var terminating = false open val components by lazy { Components(this) } var visibilityLifecycleCallback: VisibilityLifecycleCallback? = null Loading Loading @@ -96,9 +98,19 @@ open class FenixApplication : LocaleAwareApplication(), Provider { setupInMainProcessOnly() } fun isTerminating() = terminating fun terminate() { onTerminate() System.exit(0) } override fun onTerminate() { terminating = true super.onTerminate() components.torController.stop() components.torController.stopTor() } protected open fun initializeGlean() { Loading app/src/main/java/org/mozilla/fenix/HomeActivity.kt +12 −4 Original line number Diff line number Diff line Loading @@ -131,6 +131,8 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { private var isToolbarInflated = false private var isBeingRecreated = false private val webExtensionPopupFeature by lazy { WebExtensionPopupFeature(components.core.store, ::openPopup) } Loading Loading @@ -362,10 +364,14 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { ) privateNotificationObserver?.stop() components.torController.stopTor() // Explicitly change our internal state because the status broadcast from tor-android-service may // arrive after we unregister the broadcast listener when the app is exiting. components.torController.setTorStopped() if (!isBeingRecreated && !(application as FenixApplication).isTerminating()) { // We assume the Activity is being destroyed because the user // swiped away the app on the Recent screen. When this happens, // we assume the user expects the entire Application is destroyed // and not only the top Activity/Task. Therefore we kill the // underlying Application, as well. (application as FenixApplication).terminate() } } override fun onConfigurationChanged(newConfig: Configuration) { Loading @@ -385,6 +391,8 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { message = "recreate()" ) isBeingRecreated = true super.recreate() } Loading Loading
app/src/main/java/org/mozilla/fenix/FenixApplication.kt +12 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,8 @@ open class FenixApplication : LocaleAwareApplication(), Provider { private val logger = Logger("FenixApplication") var terminating = false open val components by lazy { Components(this) } var visibilityLifecycleCallback: VisibilityLifecycleCallback? = null Loading Loading @@ -96,9 +98,19 @@ open class FenixApplication : LocaleAwareApplication(), Provider { setupInMainProcessOnly() } fun isTerminating() = terminating fun terminate() { onTerminate() System.exit(0) } override fun onTerminate() { terminating = true super.onTerminate() components.torController.stop() components.torController.stopTor() } protected open fun initializeGlean() { Loading
app/src/main/java/org/mozilla/fenix/HomeActivity.kt +12 −4 Original line number Diff line number Diff line Loading @@ -131,6 +131,8 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { private var isToolbarInflated = false private var isBeingRecreated = false private val webExtensionPopupFeature by lazy { WebExtensionPopupFeature(components.core.store, ::openPopup) } Loading Loading @@ -362,10 +364,14 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { ) privateNotificationObserver?.stop() components.torController.stopTor() // Explicitly change our internal state because the status broadcast from tor-android-service may // arrive after we unregister the broadcast listener when the app is exiting. components.torController.setTorStopped() if (!isBeingRecreated && !(application as FenixApplication).isTerminating()) { // We assume the Activity is being destroyed because the user // swiped away the app on the Recent screen. When this happens, // we assume the user expects the entire Application is destroyed // and not only the top Activity/Task. Therefore we kill the // underlying Application, as well. (application as FenixApplication).terminate() } } override fun onConfigurationChanged(newConfig: Configuration) { Loading @@ -385,6 +391,8 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { message = "recreate()" ) isBeingRecreated = true super.recreate() } Loading