|
|
|
@ -156,10 +156,12 @@ open class FenixApplication : LocaleAwareApplication() {
|
|
|
|
|
|
|
|
|
|
private fun initVisualCompletenessQueueAndQueueTasks() {
|
|
|
|
|
val taskQueue = components.performance.visualCompletenessQueue
|
|
|
|
|
|
|
|
|
|
fun initQueue() {
|
|
|
|
|
registerActivityLifecycleCallbacks(PerformanceActivityLifecycleCallbacks(taskQueue))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Enable the service-experiments component to be initialized after visual completeness
|
|
|
|
|
// for performance wins.
|
|
|
|
|
fun queueInitExperiments() {
|
|
|
|
|
if (settings().isExperimentationEnabled) {
|
|
|
|
|
taskQueue.runIfReadyOrQueue {
|
|
|
|
|
Experiments.initialize(
|
|
|
|
@ -179,7 +181,9 @@ open class FenixApplication : LocaleAwareApplication() {
|
|
|
|
|
// See https://github.com/mozilla-mobile/fenix/issues/6278
|
|
|
|
|
ExperimentsManager.optOutSearchWidgetExperiment(this)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun queueInitStorageAndServices() {
|
|
|
|
|
components.performance.visualCompletenessQueue.runIfReadyOrQueue {
|
|
|
|
|
GlobalScope.launch(Dispatchers.IO) {
|
|
|
|
|
logger.info("Running post-visual completeness tasks...")
|
|
|
|
@ -198,6 +202,14 @@ open class FenixApplication : LocaleAwareApplication() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
initQueue()
|
|
|
|
|
|
|
|
|
|
// We init these items in the visual completeness queue to avoid them initing in the critical
|
|
|
|
|
// startup path, before the UI finishes drawing (i.e. visual completeness).
|
|
|
|
|
queueInitExperiments()
|
|
|
|
|
queueInitStorageAndServices()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun startMetricsIfEnabled() {
|
|
|
|
|
if (settings().isTelemetryEnabled) {
|
|
|
|
|
components.analytics.metrics.start(MetricServiceType.Data)
|
|
|
|
|