launcher3: Use @UiExecutor within ThemeManager.

Use the provided @UiExecutor within the ThemeManager
instead of referencing the MAIN_EXECUTOR directly.

Bug: 407593767
Test: ThemeManagerTest
Flag: NONE - new module
Change-Id: I6359adc1308bdb209dcf6c6e1c2d3fc7f4438585
This commit is contained in:
Adnan Begovic
2025-04-15 09:04:44 -07:00
parent 3019338ae9
commit ee79e0f5d2
2 changed files with 10 additions and 2 deletions
@@ -23,6 +23,7 @@ import com.android.launcher3.Item
import com.android.launcher3.LauncherPrefChangeListener
import com.android.launcher3.LauncherPrefs
import com.android.launcher3.LauncherPrefs.Companion.backedUpItem
import com.android.launcher3.concurrent.annotations.Ui
import com.android.launcher3.dagger.ApplicationContext
import com.android.launcher3.dagger.LauncherAppComponent
import com.android.launcher3.dagger.LauncherAppSingleton
@@ -33,9 +34,10 @@ import com.android.launcher3.shapes.IconShapeModel.Companion.DEFAULT_ICON_RADIUS
import com.android.launcher3.shapes.ShapesProvider
import com.android.launcher3.util.DaggerSingletonObject
import com.android.launcher3.util.DaggerSingletonTracker
import com.android.launcher3.util.Executors.MAIN_EXECUTOR
import com.android.launcher3.util.LooperExecutor
import com.android.launcher3.util.SimpleBroadcastReceiver
import java.util.concurrent.CopyOnWriteArrayList
import java.util.concurrent.Executor
import javax.inject.Inject
/** Centralized class for managing Launcher icon theming */
@@ -44,6 +46,7 @@ class ThemeManager
@Inject
constructor(
@ApplicationContext private val context: Context,
@Ui private val uiExecutor: LooperExecutor,
private val prefs: LauncherPrefs,
private val iconControllerFactory: IconControllerFactory,
lifecycle: DaggerSingletonTracker,
@@ -72,7 +75,8 @@ constructor(
private val listeners = CopyOnWriteArrayList<ThemeChangeListener>()
init {
val receiver = SimpleBroadcastReceiver(context, MAIN_EXECUTOR) { verifyIconState() }
val receiver = SimpleBroadcastReceiver(
context, uiExecutor) { verifyIconState() }
receiver.registerPkgActions("android", ACTION_OVERLAY_CHANGED)
val keys = (iconControllerFactory.prefKeys + PREF_ICON_SHAPE)
@@ -18,6 +18,8 @@ package com.android.launcher3.util
import com.android.launcher3.FakeLauncherPrefs
import com.android.launcher3.LauncherPrefs
import com.android.launcher3.concurrent.ExecutorsModule
import com.android.launcher3.util.dagger.LauncherExecutorsModule
import com.android.launcher3.dagger.ApiWrapperModule
import com.android.launcher3.dagger.AppModule
import com.android.launcher3.dagger.LauncherConcurrencyModule
@@ -43,6 +45,8 @@ abstract class FakePrefsModule {
AppModule::class,
PerDisplayModule::class,
LauncherConcurrencyModule::class,
ExecutorsModule::class,
LauncherExecutorsModule::class,
]
)
class CommonModulesForTest