diff --git a/app/src/main/java/org/mozilla/fenix/FenixApplication.kt b/app/src/main/java/org/mozilla/fenix/FenixApplication.kt index b91e40fca..3088d5428 100644 --- a/app/src/main/java/org/mozilla/fenix/FenixApplication.kt +++ b/app/src/main/java/org/mozilla/fenix/FenixApplication.kt @@ -139,14 +139,7 @@ open class FenixApplication : LocaleAwareApplication() { prefetchForHomeFragment() setupLeakCanary() - if (settings().isTelemetryEnabled) { - components.analytics.metrics.start(MetricServiceType.Data) - } - - if (settings().isMarketingTelemetryEnabled) { - components.analytics.metrics.start(MetricServiceType.Marketing) - } - + startMetricsIfEnabled() setupPush() visibilityLifecycleCallback = VisibilityLifecycleCallback(getSystemService()) @@ -203,6 +196,16 @@ open class FenixApplication : LocaleAwareApplication() { } } + private fun startMetricsIfEnabled() { + if (settings().isTelemetryEnabled) { + components.analytics.metrics.start(MetricServiceType.Data) + } + + if (settings().isMarketingTelemetryEnabled) { + components.analytics.metrics.start(MetricServiceType.Marketing) + } + } + // See https://github.com/mozilla-mobile/fenix/issues/7227 for context. // To re-enable this, we need to do so in a way that won't interfere with any startup operations // which acquire reserved+ sqlite lock. Currently, Fennec migrations need to write to storage