2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-19 09:25:34 +00:00

[fenix] No issue: Fix onConfigurationChange crashes in Debug build

This commit is contained in:
Christian Sadilek 2020-10-27 16:43:57 -04:00
parent 56c98b57b8
commit 79ab29eff2

View File

@ -431,8 +431,17 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
// https://issuetracker.google.com/issues/143570309#comment3
applicationContext.resources.configuration.uiMode = config.uiMode
// random StrictMode onDiskRead violation even when Fenix is not running in the background.
components.strictMode.resetAfter(StrictMode.allowThreadDiskReads()) {
if (isMainProcess()) {
// We can only do this on the main process as resetAfter will access components.core, which
// will initialize the engine and create an additional GeckoRuntime from the Gecko
// child process, causing a crash.
// There's a strict mode violation in A-Cs LocaleAwareApplication which
// reads from shared prefs: https://github.com/mozilla-mobile/android-components/issues/8816
components.strictMode.resetAfter(StrictMode.allowThreadDiskReads()) {
super.onConfigurationChanged(config)
}
} else {
super.onConfigurationChanged(config)
}
}