[fenix] No bug- protect nimbus init from StrictMode (https://github.com/mozilla-mobile/fenix/pull/17033) r=christian

pull/600/head
jhugman 4 years ago committed by GitHub
parent b5387ba7fb
commit 6c27e44fa1

@ -9,6 +9,7 @@ import android.app.PendingIntent
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.net.Uri import android.net.Uri
import android.os.StrictMode
import mozilla.components.lib.crash.CrashReporter import mozilla.components.lib.crash.CrashReporter
import mozilla.components.lib.crash.service.CrashReporterService import mozilla.components.lib.crash.service.CrashReporterService
import mozilla.components.lib.crash.service.GleanCrashReporterService import mozilla.components.lib.crash.service.GleanCrashReporterService
@ -117,12 +118,15 @@ class Analytics(
// from the app unless the user does so from a UI control. // from the app unless the user does so from a UI control.
// However, the user may have opt-ed out of mako experiments already, so // However, the user may have opt-ed out of mako experiments already, so
// we should respect that setting here. // we should respect that setting here.
val enabled = context.settings().isExperimentationEnabled val enabled = context.components.strictMode.resetAfter(StrictMode.allowThreadDiskReads()) {
context.settings().isExperimentationEnabled
}
if (!enabled) { if (!enabled) {
globalUserParticipation = enabled globalUserParticipation = enabled
} }
context.settings().isExperimentationEnabled = globalUserParticipation }
}.apply {
if (FeatureFlags.nimbusExperiments) {
// Nimbus should look after downloading experiment definitions from remote settings // Nimbus should look after downloading experiment definitions from remote settings
// on another thread, and making sure we don't hit the server each time we start. // on another thread, and making sure we don't hit the server each time we start.
updateExperiments() updateExperiments()

Loading…
Cancel
Save