Bug 1812149 - Add ActivityContextWrapper before updating locale

From ohall's learnings, we know that we need to use the original Android
Activity Context with the system PrintManager. When a configuration
change happens, a new Context is created and the original is lost.
The most straight-forward way to do that is to use a ContextWrapper
which internally holds a reference to the original context.
fenix/113.0
Jonathan Almeida 2 years ago committed by Ryan VanderMeulen
parent b5b7ad6a7c
commit 59c4860c1e

@ -99,6 +99,7 @@ import mozilla.components.support.ktx.android.view.hideKeyboard
import mozilla.components.support.ktx.kotlin.getOrigin
import mozilla.components.support.ktx.kotlinx.coroutines.flow.ifAnyChanged
import mozilla.components.support.ktx.kotlinx.coroutines.flow.ifChanged
import mozilla.components.support.locale.ActivityContextWrapper
import org.mozilla.fenix.BuildConfig
import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.GleanMetrics.MediaState
@ -250,6 +251,8 @@ abstract class BaseBrowserFragment :
val activity = activity as HomeActivity
activity.themeManager.applyStatusBarTheme(activity)
val originalContext = ActivityContextWrapper.getOriginalContext(activity)
binding.engineView.setActivityContext(originalContext)
browserFragmentStore = StoreProvider.get(this) {
BrowserFragmentStore(
@ -1494,7 +1497,9 @@ abstract class BaseBrowserFragment :
message = "onDestroyView()",
)
binding.engineView.setActivityContext(null)
requireContext().accessibilityManager.removeAccessibilityStateChangeListener(this)
_browserToolbarView = null
_browserToolbarInteractor = null
_binding = null

Loading…
Cancel
Save