From 2352d2b1299939ec67c9e52590c9f31e17b633da Mon Sep 17 00:00:00 2001 From: MatthewTighe Date: Tue, 15 Mar 2022 15:28:41 -0700 Subject: [PATCH] [fenix] closes https://github.com/mozilla-mobile/fenix/issues/24289: reset strict mode after WallpaperManager construction --- .../perf/StartupExcessiveResourceUseTest.kt | 2 +- .../mozilla/fenix/components/Components.kt | 21 +++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/app/src/androidTest/java/org/mozilla/fenix/perf/StartupExcessiveResourceUseTest.kt b/app/src/androidTest/java/org/mozilla/fenix/perf/StartupExcessiveResourceUseTest.kt index 577e7ba65..68b361cdd 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/perf/StartupExcessiveResourceUseTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/perf/StartupExcessiveResourceUseTest.kt @@ -21,7 +21,7 @@ import org.mozilla.fenix.ext.components import org.mozilla.fenix.helpers.HomeActivityTestRule // 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 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 diff --git a/app/src/main/java/org/mozilla/fenix/components/Components.kt b/app/src/main/java/org/mozilla/fenix/components/Components.kt index acabbeff0..bd4b7fec0 100644 --- a/app/src/main/java/org/mozilla/fenix/components/Components.kt +++ b/app/src/main/java/org/mozilla/fenix/components/Components.kt @@ -7,6 +7,7 @@ package org.mozilla.fenix.components import android.app.Application import android.content.Context import android.content.Intent +import android.os.StrictMode import androidx.compose.runtime.Composable import androidx.compose.ui.platform.LocalContext import androidx.core.net.toUri @@ -144,15 +145,6 @@ class Components(private val context: Context) { AddonManager(core.store, core.engine, addonCollectionProvider, addonUpdater) } - val wallpaperManager by lazyMonitored { - WallpaperManager( - settings, - WallpaperDownloader(context, core.client), - WallpaperFileManager(context.filesDir), - analytics.crashReporter, - ) - } - val analytics by lazyMonitored { Analytics(context) } val publicSuffixList by lazyMonitored { PublicSuffixList(context) } val clipboardHandler by lazyMonitored { ClipboardHandler(context) } @@ -162,6 +154,17 @@ class Components(private val context: Context) { val wifiConnectionMonitor by lazyMonitored { WifiConnectionMonitor(context as Application) } val strictMode by lazyMonitored { StrictModeManager(Config, this) } + val wallpaperManager by lazyMonitored { + strictMode.resetAfter(StrictMode.allowThreadDiskReads()) { + WallpaperManager( + settings, + WallpaperDownloader(context, core.client), + WallpaperFileManager(context.filesDir), + analytics.crashReporter, + ) + } + } + val settings by lazyMonitored { Settings(context) } val reviewPromptController by lazyMonitored {