[fenix] closes https://github.com/mozilla-mobile/fenix/issues/24366: reset strict mode after locale read

pull/600/head
MatthewTighe 2 years ago committed by mergify[bot]
parent d292efd9e7
commit 20f4564cfb

@ -21,7 +21,7 @@ import org.mozilla.fenix.ext.components
import org.mozilla.fenix.helpers.HomeActivityTestRule import org.mozilla.fenix.helpers.HomeActivityTestRule
// BEFORE INCREASING THESE VALUES, PLEASE CONSULT WITH THE PERF TEAM. // BEFORE INCREASING THESE VALUES, PLEASE CONSULT WITH THE PERF TEAM.
private const val EXPECTED_SUPPRESSION_COUNT = 19 private const val EXPECTED_SUPPRESSION_COUNT = 20
@Suppress("TopLevelPropertyNaming") // it's silly this would have a different naming convention b/c no const @Suppress("TopLevelPropertyNaming") // it's silly this would have a different naming convention b/c no const
private val EXPECTED_RUNBLOCKING_RANGE = 0..1 // CI has +1 counts compared to local runs: increment these together private val EXPECTED_RUNBLOCKING_RANGE = 0..1 // CI has +1 counts compared to local runs: increment these together
private const val EXPECTED_RECYCLER_VIEW_CONSTRAINT_LAYOUT_CHILDREN = 4 private const val EXPECTED_RECYCLER_VIEW_CONSTRAINT_LAYOUT_CHILDREN = 4

@ -5,8 +5,10 @@
package org.mozilla.fenix package org.mozilla.fenix
import android.content.Context import android.content.Context
import android.os.StrictMode
import mozilla.components.support.locale.LocaleManager import mozilla.components.support.locale.LocaleManager
import mozilla.components.support.locale.LocaleManager.getSystemDefault import mozilla.components.support.locale.LocaleManager.getSystemDefault
import org.mozilla.fenix.ext.components
/** /**
* A single source for setting feature flags that are mostly based on build type. * A single source for setting feature flags that are mostly based on build type.
@ -91,9 +93,11 @@ object FeatureFlags {
* Enables themed wallpapers feature. * Enables themed wallpapers feature.
*/ */
fun isThemedWallpapersFeatureEnabled(context: Context): Boolean { fun isThemedWallpapersFeatureEnabled(context: Context): Boolean {
val langTag = LocaleManager.getCurrentLocale(context) return context.components.strictMode.resetAfter(StrictMode.allowThreadDiskReads()) {
?.toLanguageTag() ?: getSystemDefault().toLanguageTag() val langTag = LocaleManager.getCurrentLocale(context)
return listOf("en-US", "es-US").contains(langTag) ?.toLanguageTag() ?: getSystemDefault().toLanguageTag()
listOf("en-US", "es-US").contains(langTag)
}
} }
/** /**

Loading…
Cancel
Save