Loading src/com/android/customization/module/CustomizationInjector.kt +1 −4 Original line number Diff line number Diff line Loading @@ -50,10 +50,7 @@ interface CustomizationInjector : Injector { fun getClockRegistry(context: Context, lifecycleOwner: LifecycleOwner): ClockRegistry fun getClockPickerInteractor( context: Context, lifecycleOwner: LifecycleOwner ): ClockPickerInteractor fun getClockPickerInteractor(context: Context): ClockPickerInteractor fun getClockSectionViewModel( context: Context, Loading src/com/android/customization/module/ThemePickerInjector.kt +31 −26 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject ), getFlags(), getClockCarouselViewModelFactory( getClockPickerInteractor(activity.applicationContext, activity), getClockPickerInteractor(activity.applicationContext), ), getClockViewFactory(activity), getDarkModeSnapshotRestorer(activity), Loading Loading @@ -181,7 +181,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject @Synchronized override fun getUserEventLogger(context: Context): ThemesUserEventLogger { return if (userEventLogger != null) userEventLogger as ThemesUserEventLogger else StatsLogUserEventLogger(context).also { userEventLogger = it } else StatsLogUserEventLogger(context.applicationContext).also { userEventLogger = it } } @Synchronized Loading Loading @@ -211,8 +211,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject this[KEY_APP_GRID_SNAPSHOT_RESTORER] = getGridSnapshotRestorer(context) this[KEY_COLOR_PICKER_SNAPSHOT_RESTORER] = getColorPickerSnapshotRestorer(context, getWallpaperColorsViewModel()) this[KEY_CLOCKS_SNAPSHOT_RESTORER] = getClockPickerSnapshotRestorer(context, lifecycleOwner) this[KEY_CLOCKS_SNAPSHOT_RESTORER] = getClockPickerSnapshotRestorer(context) } } Loading @@ -230,6 +229,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject } override fun getWallpaperInteractor(context: Context): WallpaperInteractor { val appContext = context.applicationContext return wallpaperInteractor ?: WallpaperInteractor( repository = Loading @@ -237,16 +237,16 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject scope = getApplicationCoroutineScope(), client = WallpaperClientImpl( context = context, context = appContext, infoFactory = getCurrentWallpaperInfoFactory(context), wallpaperManager = WallpaperManager.getInstance(context) ), wallpaperPreferences = getPreferences(context = context), wallpaperPreferences = getPreferences(context = appContext), backgroundDispatcher = Dispatchers.IO, ), shouldHandleReload = { TextUtils.equals( getColorCustomizationManager(context).currentColorSource, getColorCustomizationManager(appContext).currentColorSource, ColorOptionsProvider.COLOR_SOURCE_PRESET ) } Loading @@ -268,7 +268,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject ): KeyguardQuickAffordancePickerViewModel.Factory { return keyguardQuickAffordancePickerViewModelFactory ?: KeyguardQuickAffordancePickerViewModel.Factory( context, context.applicationContext, getKeyguardQuickAffordancePickerInteractor(context), getWallpaperInteractor(context), getCurrentWallpaperInfoFactory(context), Loading @@ -280,11 +280,12 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject context: Context ): KeyguardQuickAffordancePickerInteractor { val client = getKeyguardQuickAffordancePickerProviderClient(context) val appContext = context.applicationContext return KeyguardQuickAffordancePickerInteractor( KeyguardQuickAffordancePickerRepository(client, Dispatchers.IO), client ) { getKeyguardQuickAffordanceSnapshotRestorer(context) getKeyguardQuickAffordanceSnapshotRestorer(appContext) } } Loading @@ -292,7 +293,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject context: Context ): CustomizationProviderClient { return customizationProviderClient ?: CustomizationProviderClientImpl(context, Dispatchers.IO).also { ?: CustomizationProviderClientImpl(context.applicationContext, Dispatchers.IO).also { customizationProviderClient = it } } Loading Loading @@ -321,6 +322,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject private fun getNotificationsInteractor( context: Context, ): NotificationsInteractor { val appContext = context.applicationContext return notificationsInteractor ?: NotificationsInteractor( repository = Loading @@ -329,7 +331,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject backgroundDispatcher = Dispatchers.IO, secureSettingsRepository = getSecureSettingsRepository(context), ), snapshotRestorer = { getNotificationsSnapshotRestorer(context) }, snapshotRestorer = { getNotificationsSnapshotRestorer(appContext) }, ) .also { notificationsInteractor = it } } Loading @@ -348,7 +350,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject override fun getClockRegistry(context: Context, lifecycleOwner: LifecycleOwner): ClockRegistry { return (clockRegistryProvider ?: ClockRegistryProvider( context = context, context = context.applicationContext, coroutineScope = getApplicationCoroutineScope(), mainDispatcher = Dispatchers.Main, backgroundDispatcher = Dispatchers.IO, Loading @@ -359,18 +361,19 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject override fun getClockPickerInteractor( context: Context, lifecycleOwner: LifecycleOwner, ): ClockPickerInteractor { val appContext = context.applicationContext return clockPickerInteractor ?: ClockPickerInteractor( repository = ClockPickerRepositoryImpl( secureSettingsRepository = getSecureSettingsRepository(context), registry = getClockRegistry(context, lifecycleOwner), // TODO (b/285978251): remove second argument once b/285348630 is fixed registry = getClockRegistry(context, context as LifecycleOwner), scope = getApplicationCoroutineScope(), mainDispatcher = Dispatchers.Main, ), snapshotRestorer = { getClockPickerSnapshotRestorer(context, lifecycleOwner) }, snapshotRestorer = { getClockPickerSnapshotRestorer(appContext) }, ) .also { clockPickerInteractor = it } } Loading @@ -380,7 +383,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject lifecycleOwner: LifecycleOwner ): ClockSectionViewModel { return clockSectionViewModel ?: ClockSectionViewModel(context, getClockPickerInteractor(context, lifecycleOwner)) ?: ClockSectionViewModel(context.applicationContext, getClockPickerInteractor(context)) .also { clockSectionViewModel = it } } Loading Loading @@ -422,10 +425,9 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject private fun getClockPickerSnapshotRestorer( context: Context, lifecycleOwner: LifecycleOwner ): ClockPickerSnapshotRestorer { return clockPickerSnapshotRestorer ?: ClockPickerSnapshotRestorer(getClockPickerInteractor(context, lifecycleOwner)).also { ?: ClockPickerSnapshotRestorer(getClockPickerInteractor(context)).also { clockPickerSnapshotRestorer = it } } Loading @@ -434,15 +436,16 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject context: Context, wallpaperColorsViewModel: WallpaperColorsViewModel, ): ColorPickerInteractor { val appContext = context.applicationContext return colorPickerInteractor ?: ColorPickerInteractor( repository = ColorPickerRepositoryImpl( wallpaperColorsViewModel, getColorCustomizationManager(context) getColorCustomizationManager(appContext) ), snapshotRestorer = { getColorPickerSnapshotRestorer(context, wallpaperColorsViewModel) getColorPickerSnapshotRestorer(appContext, wallpaperColorsViewModel) } ) .also { colorPickerInteractor = it } Loading @@ -454,7 +457,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject ): ColorPickerViewModel.Factory { return colorPickerViewModelFactory ?: ColorPickerViewModel.Factory( context, context.applicationContext, getColorPickerInteractor(context, wallpaperColorsViewModel), ) .also { colorPickerViewModelFactory = it } Loading @@ -481,10 +484,11 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject fun getDarkModeSnapshotRestorer( context: Context, ): DarkModeSnapshotRestorer { val appContext = context.applicationContext return darkModeSnapshotRestorer ?: DarkModeSnapshotRestorer( context = context, manager = context.getSystemService(Context.UI_MODE_SERVICE) as UiModeManager, context = appContext, manager = appContext.getSystemService(Context.UI_MODE_SERVICE) as UiModeManager, backgroundDispatcher = Dispatchers.IO, ) .also { darkModeSnapshotRestorer = it } Loading Loading @@ -521,8 +525,8 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject ): ClockSettingsViewModel.Factory { return clockSettingsViewModelFactory ?: ClockSettingsViewModel.Factory( context, getClockPickerInteractor(context, lifecycleOwner), context.applicationContext, getClockPickerInteractor(context), getColorPickerInteractor( context, wallpaperColorsViewModel, Loading @@ -548,6 +552,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject private fun getGridInteractor( context: Context, ): GridInteractor { val appContext = context.applicationContext return gridInteractor ?: GridInteractor( applicationScope = getApplicationCoroutineScope(), Loading @@ -557,7 +562,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject manager = GridOptionsManager.getInstance(context), backgroundDispatcher = Dispatchers.IO, ), snapshotRestorer = { getGridSnapshotRestorer(context) }, snapshotRestorer = { getGridSnapshotRestorer(appContext) }, ) .also { gridInteractor = it } } Loading src/com/android/customization/picker/clock/ui/viewmodel/ClockSectionViewModel.kt +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ class ClockSectionViewModel(context: Context, interactor: ClockPickerInteractor) (selectedColorId, selectedClockSize) -> val colorText = clockColorMap[selectedColorId]?.colorName ?: context.getString(R.string.default_theme_title) ?: appContext.getString(R.string.default_theme_title) val sizeText = when (selectedClockSize) { ClockSize.SMALL -> appContext.getString(R.string.clock_size_small) Loading Loading
src/com/android/customization/module/CustomizationInjector.kt +1 −4 Original line number Diff line number Diff line Loading @@ -50,10 +50,7 @@ interface CustomizationInjector : Injector { fun getClockRegistry(context: Context, lifecycleOwner: LifecycleOwner): ClockRegistry fun getClockPickerInteractor( context: Context, lifecycleOwner: LifecycleOwner ): ClockPickerInteractor fun getClockPickerInteractor(context: Context): ClockPickerInteractor fun getClockSectionViewModel( context: Context, Loading
src/com/android/customization/module/ThemePickerInjector.kt +31 −26 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject ), getFlags(), getClockCarouselViewModelFactory( getClockPickerInteractor(activity.applicationContext, activity), getClockPickerInteractor(activity.applicationContext), ), getClockViewFactory(activity), getDarkModeSnapshotRestorer(activity), Loading Loading @@ -181,7 +181,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject @Synchronized override fun getUserEventLogger(context: Context): ThemesUserEventLogger { return if (userEventLogger != null) userEventLogger as ThemesUserEventLogger else StatsLogUserEventLogger(context).also { userEventLogger = it } else StatsLogUserEventLogger(context.applicationContext).also { userEventLogger = it } } @Synchronized Loading Loading @@ -211,8 +211,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject this[KEY_APP_GRID_SNAPSHOT_RESTORER] = getGridSnapshotRestorer(context) this[KEY_COLOR_PICKER_SNAPSHOT_RESTORER] = getColorPickerSnapshotRestorer(context, getWallpaperColorsViewModel()) this[KEY_CLOCKS_SNAPSHOT_RESTORER] = getClockPickerSnapshotRestorer(context, lifecycleOwner) this[KEY_CLOCKS_SNAPSHOT_RESTORER] = getClockPickerSnapshotRestorer(context) } } Loading @@ -230,6 +229,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject } override fun getWallpaperInteractor(context: Context): WallpaperInteractor { val appContext = context.applicationContext return wallpaperInteractor ?: WallpaperInteractor( repository = Loading @@ -237,16 +237,16 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject scope = getApplicationCoroutineScope(), client = WallpaperClientImpl( context = context, context = appContext, infoFactory = getCurrentWallpaperInfoFactory(context), wallpaperManager = WallpaperManager.getInstance(context) ), wallpaperPreferences = getPreferences(context = context), wallpaperPreferences = getPreferences(context = appContext), backgroundDispatcher = Dispatchers.IO, ), shouldHandleReload = { TextUtils.equals( getColorCustomizationManager(context).currentColorSource, getColorCustomizationManager(appContext).currentColorSource, ColorOptionsProvider.COLOR_SOURCE_PRESET ) } Loading @@ -268,7 +268,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject ): KeyguardQuickAffordancePickerViewModel.Factory { return keyguardQuickAffordancePickerViewModelFactory ?: KeyguardQuickAffordancePickerViewModel.Factory( context, context.applicationContext, getKeyguardQuickAffordancePickerInteractor(context), getWallpaperInteractor(context), getCurrentWallpaperInfoFactory(context), Loading @@ -280,11 +280,12 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject context: Context ): KeyguardQuickAffordancePickerInteractor { val client = getKeyguardQuickAffordancePickerProviderClient(context) val appContext = context.applicationContext return KeyguardQuickAffordancePickerInteractor( KeyguardQuickAffordancePickerRepository(client, Dispatchers.IO), client ) { getKeyguardQuickAffordanceSnapshotRestorer(context) getKeyguardQuickAffordanceSnapshotRestorer(appContext) } } Loading @@ -292,7 +293,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject context: Context ): CustomizationProviderClient { return customizationProviderClient ?: CustomizationProviderClientImpl(context, Dispatchers.IO).also { ?: CustomizationProviderClientImpl(context.applicationContext, Dispatchers.IO).also { customizationProviderClient = it } } Loading Loading @@ -321,6 +322,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject private fun getNotificationsInteractor( context: Context, ): NotificationsInteractor { val appContext = context.applicationContext return notificationsInteractor ?: NotificationsInteractor( repository = Loading @@ -329,7 +331,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject backgroundDispatcher = Dispatchers.IO, secureSettingsRepository = getSecureSettingsRepository(context), ), snapshotRestorer = { getNotificationsSnapshotRestorer(context) }, snapshotRestorer = { getNotificationsSnapshotRestorer(appContext) }, ) .also { notificationsInteractor = it } } Loading @@ -348,7 +350,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject override fun getClockRegistry(context: Context, lifecycleOwner: LifecycleOwner): ClockRegistry { return (clockRegistryProvider ?: ClockRegistryProvider( context = context, context = context.applicationContext, coroutineScope = getApplicationCoroutineScope(), mainDispatcher = Dispatchers.Main, backgroundDispatcher = Dispatchers.IO, Loading @@ -359,18 +361,19 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject override fun getClockPickerInteractor( context: Context, lifecycleOwner: LifecycleOwner, ): ClockPickerInteractor { val appContext = context.applicationContext return clockPickerInteractor ?: ClockPickerInteractor( repository = ClockPickerRepositoryImpl( secureSettingsRepository = getSecureSettingsRepository(context), registry = getClockRegistry(context, lifecycleOwner), // TODO (b/285978251): remove second argument once b/285348630 is fixed registry = getClockRegistry(context, context as LifecycleOwner), scope = getApplicationCoroutineScope(), mainDispatcher = Dispatchers.Main, ), snapshotRestorer = { getClockPickerSnapshotRestorer(context, lifecycleOwner) }, snapshotRestorer = { getClockPickerSnapshotRestorer(appContext) }, ) .also { clockPickerInteractor = it } } Loading @@ -380,7 +383,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject lifecycleOwner: LifecycleOwner ): ClockSectionViewModel { return clockSectionViewModel ?: ClockSectionViewModel(context, getClockPickerInteractor(context, lifecycleOwner)) ?: ClockSectionViewModel(context.applicationContext, getClockPickerInteractor(context)) .also { clockSectionViewModel = it } } Loading Loading @@ -422,10 +425,9 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject private fun getClockPickerSnapshotRestorer( context: Context, lifecycleOwner: LifecycleOwner ): ClockPickerSnapshotRestorer { return clockPickerSnapshotRestorer ?: ClockPickerSnapshotRestorer(getClockPickerInteractor(context, lifecycleOwner)).also { ?: ClockPickerSnapshotRestorer(getClockPickerInteractor(context)).also { clockPickerSnapshotRestorer = it } } Loading @@ -434,15 +436,16 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject context: Context, wallpaperColorsViewModel: WallpaperColorsViewModel, ): ColorPickerInteractor { val appContext = context.applicationContext return colorPickerInteractor ?: ColorPickerInteractor( repository = ColorPickerRepositoryImpl( wallpaperColorsViewModel, getColorCustomizationManager(context) getColorCustomizationManager(appContext) ), snapshotRestorer = { getColorPickerSnapshotRestorer(context, wallpaperColorsViewModel) getColorPickerSnapshotRestorer(appContext, wallpaperColorsViewModel) } ) .also { colorPickerInteractor = it } Loading @@ -454,7 +457,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject ): ColorPickerViewModel.Factory { return colorPickerViewModelFactory ?: ColorPickerViewModel.Factory( context, context.applicationContext, getColorPickerInteractor(context, wallpaperColorsViewModel), ) .also { colorPickerViewModelFactory = it } Loading @@ -481,10 +484,11 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject fun getDarkModeSnapshotRestorer( context: Context, ): DarkModeSnapshotRestorer { val appContext = context.applicationContext return darkModeSnapshotRestorer ?: DarkModeSnapshotRestorer( context = context, manager = context.getSystemService(Context.UI_MODE_SERVICE) as UiModeManager, context = appContext, manager = appContext.getSystemService(Context.UI_MODE_SERVICE) as UiModeManager, backgroundDispatcher = Dispatchers.IO, ) .also { darkModeSnapshotRestorer = it } Loading Loading @@ -521,8 +525,8 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject ): ClockSettingsViewModel.Factory { return clockSettingsViewModelFactory ?: ClockSettingsViewModel.Factory( context, getClockPickerInteractor(context, lifecycleOwner), context.applicationContext, getClockPickerInteractor(context), getColorPickerInteractor( context, wallpaperColorsViewModel, Loading @@ -548,6 +552,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject private fun getGridInteractor( context: Context, ): GridInteractor { val appContext = context.applicationContext return gridInteractor ?: GridInteractor( applicationScope = getApplicationCoroutineScope(), Loading @@ -557,7 +562,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject manager = GridOptionsManager.getInstance(context), backgroundDispatcher = Dispatchers.IO, ), snapshotRestorer = { getGridSnapshotRestorer(context) }, snapshotRestorer = { getGridSnapshotRestorer(appContext) }, ) .also { gridInteractor = it } } Loading
src/com/android/customization/picker/clock/ui/viewmodel/ClockSectionViewModel.kt +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ class ClockSectionViewModel(context: Context, interactor: ClockPickerInteractor) (selectedColorId, selectedClockSize) -> val colorText = clockColorMap[selectedColorId]?.colorName ?: context.getString(R.string.default_theme_title) ?: appContext.getString(R.string.default_theme_title) val sizeText = when (selectedClockSize) { ClockSize.SMALL -> appContext.getString(R.string.clock_size_small) Loading