Loading packages/SystemUI/src/com/android/systemui/display/dagger/PerDisplaySystemUIModule.kt +9 −35 Original line number Diff line number Diff line Loading @@ -38,23 +38,24 @@ import com.android.systemui.statusbar.dagger.PerDisplayStatusBarModule import com.android.systemui.statusbar.phone.DarkIconDispatcherImpl import com.android.systemui.statusbar.phone.SysuiDarkIconDispatcher import com.android.systemui.statusbar.pipeline.shared.ui.composable.StatusBarRootFactory import com.android.systemui.wallpapers.WallpaperPresentationEnabled import com.android.systemui.wallpapers.WallpaperPresentationManager import com.android.systemui.wallpapers.domain.interactor.DisplayWallpaperPresentationInteractor import com.android.systemui.wallpapers.domain.interactor.DisplayWallpaperPresentationInteractorImpl import com.android.systemui.wallpapers.domain.interactor.NoOpDisplayWallpaperPresentationInteractor import com.android.systemui.wallpapers.dagger.PerDisplayWallpaperModule import dagger.Binds import dagger.Module import dagger.Provides import dagger.multibindings.ElementsIntoSet import dagger.multibindings.IntoSet import dagger.multibindings.Multibinds import javax.inject.Provider import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineScope /** Module providing common dependencies for per-display singletons. */ @Module(includes = [PerDisplayStatusBarModule::class, PerDisplayConfigurationModule::class]) @Module( includes = [ PerDisplayStatusBarModule::class, PerDisplayConfigurationModule::class, PerDisplayWallpaperModule::class, ] ) interface PerDisplaySystemUIModule { @Multibinds Loading Loading @@ -138,32 +139,5 @@ interface PerDisplaySystemUIModule { } @Provides @DisplayAware fun provideDisplayId(@DisplayId displayId: Int): Int = displayId @Provides @PerDisplaySingleton @DisplayAware fun bindsDisplayWallpaperPresentationInteractor( @WallpaperPresentationEnabled isWallpaperPresentationEnabled: Boolean, impl: Provider<DisplayWallpaperPresentationInteractorImpl>, ): DisplayWallpaperPresentationInteractor = if (isWallpaperPresentationEnabled) { impl.get() } else { NoOpDisplayWallpaperPresentationInteractor } @Provides @PerDisplaySingleton @DisplayAware @ElementsIntoSet fun bindWallpaperPresentationManagerLifecycleListener( @WallpaperPresentationEnabled isWallpaperPresentationEnabled: Boolean, impl: Provider<WallpaperPresentationManager>, ): Set<SystemUIDisplaySubcomponent.LifecycleListener> = if (isWallpaperPresentationEnabled) { setOf(impl.get()) } else { emptySet() } } } packages/SystemUI/src/com/android/systemui/wallpapers/dagger/PerDisplayWallpaperModule.kt 0 → 100644 +67 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.wallpapers.dagger import com.android.systemui.display.dagger.SystemUIDisplaySubcomponent import com.android.systemui.display.dagger.SystemUIDisplaySubcomponent.DisplayAware import com.android.systemui.display.dagger.SystemUIDisplaySubcomponent.PerDisplaySingleton import com.android.systemui.wallpapers.WallpaperPresentationEnabled import com.android.systemui.wallpapers.WallpaperPresentationManager import com.android.systemui.wallpapers.domain.interactor.DisplayWallpaperPresentationInteractor import com.android.systemui.wallpapers.domain.interactor.DisplayWallpaperPresentationInteractorImpl import com.android.systemui.wallpapers.domain.interactor.NoOpDisplayWallpaperPresentationInteractor import dagger.Module import dagger.Provides import dagger.multibindings.ElementsIntoSet import javax.inject.Provider /** * Module providing [SystemUIDisplaySubcomponent.DisplayAware] components that are related to the * wallpaper. */ @Module interface PerDisplayWallpaperModule { companion object { @Provides @PerDisplaySingleton @DisplayAware fun bindsDisplayWallpaperPresentationInteractor( @WallpaperPresentationEnabled isWallpaperPresentationEnabled: Boolean, impl: Provider<DisplayWallpaperPresentationInteractorImpl>, ): DisplayWallpaperPresentationInteractor = if (isWallpaperPresentationEnabled) { impl.get() } else { NoOpDisplayWallpaperPresentationInteractor } @Provides @PerDisplaySingleton @DisplayAware @ElementsIntoSet fun bindWallpaperPresentationManagerLifecycleListener( @WallpaperPresentationEnabled isWallpaperPresentationEnabled: Boolean, impl: Provider<WallpaperPresentationManager>, ): Set<SystemUIDisplaySubcomponent.LifecycleListener> = if (isWallpaperPresentationEnabled) { setOf(impl.get()) } else { emptySet() } } } Loading
packages/SystemUI/src/com/android/systemui/display/dagger/PerDisplaySystemUIModule.kt +9 −35 Original line number Diff line number Diff line Loading @@ -38,23 +38,24 @@ import com.android.systemui.statusbar.dagger.PerDisplayStatusBarModule import com.android.systemui.statusbar.phone.DarkIconDispatcherImpl import com.android.systemui.statusbar.phone.SysuiDarkIconDispatcher import com.android.systemui.statusbar.pipeline.shared.ui.composable.StatusBarRootFactory import com.android.systemui.wallpapers.WallpaperPresentationEnabled import com.android.systemui.wallpapers.WallpaperPresentationManager import com.android.systemui.wallpapers.domain.interactor.DisplayWallpaperPresentationInteractor import com.android.systemui.wallpapers.domain.interactor.DisplayWallpaperPresentationInteractorImpl import com.android.systemui.wallpapers.domain.interactor.NoOpDisplayWallpaperPresentationInteractor import com.android.systemui.wallpapers.dagger.PerDisplayWallpaperModule import dagger.Binds import dagger.Module import dagger.Provides import dagger.multibindings.ElementsIntoSet import dagger.multibindings.IntoSet import dagger.multibindings.Multibinds import javax.inject.Provider import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineScope /** Module providing common dependencies for per-display singletons. */ @Module(includes = [PerDisplayStatusBarModule::class, PerDisplayConfigurationModule::class]) @Module( includes = [ PerDisplayStatusBarModule::class, PerDisplayConfigurationModule::class, PerDisplayWallpaperModule::class, ] ) interface PerDisplaySystemUIModule { @Multibinds Loading Loading @@ -138,32 +139,5 @@ interface PerDisplaySystemUIModule { } @Provides @DisplayAware fun provideDisplayId(@DisplayId displayId: Int): Int = displayId @Provides @PerDisplaySingleton @DisplayAware fun bindsDisplayWallpaperPresentationInteractor( @WallpaperPresentationEnabled isWallpaperPresentationEnabled: Boolean, impl: Provider<DisplayWallpaperPresentationInteractorImpl>, ): DisplayWallpaperPresentationInteractor = if (isWallpaperPresentationEnabled) { impl.get() } else { NoOpDisplayWallpaperPresentationInteractor } @Provides @PerDisplaySingleton @DisplayAware @ElementsIntoSet fun bindWallpaperPresentationManagerLifecycleListener( @WallpaperPresentationEnabled isWallpaperPresentationEnabled: Boolean, impl: Provider<WallpaperPresentationManager>, ): Set<SystemUIDisplaySubcomponent.LifecycleListener> = if (isWallpaperPresentationEnabled) { setOf(impl.get()) } else { emptySet() } } }
packages/SystemUI/src/com/android/systemui/wallpapers/dagger/PerDisplayWallpaperModule.kt 0 → 100644 +67 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.wallpapers.dagger import com.android.systemui.display.dagger.SystemUIDisplaySubcomponent import com.android.systemui.display.dagger.SystemUIDisplaySubcomponent.DisplayAware import com.android.systemui.display.dagger.SystemUIDisplaySubcomponent.PerDisplaySingleton import com.android.systemui.wallpapers.WallpaperPresentationEnabled import com.android.systemui.wallpapers.WallpaperPresentationManager import com.android.systemui.wallpapers.domain.interactor.DisplayWallpaperPresentationInteractor import com.android.systemui.wallpapers.domain.interactor.DisplayWallpaperPresentationInteractorImpl import com.android.systemui.wallpapers.domain.interactor.NoOpDisplayWallpaperPresentationInteractor import dagger.Module import dagger.Provides import dagger.multibindings.ElementsIntoSet import javax.inject.Provider /** * Module providing [SystemUIDisplaySubcomponent.DisplayAware] components that are related to the * wallpaper. */ @Module interface PerDisplayWallpaperModule { companion object { @Provides @PerDisplaySingleton @DisplayAware fun bindsDisplayWallpaperPresentationInteractor( @WallpaperPresentationEnabled isWallpaperPresentationEnabled: Boolean, impl: Provider<DisplayWallpaperPresentationInteractorImpl>, ): DisplayWallpaperPresentationInteractor = if (isWallpaperPresentationEnabled) { impl.get() } else { NoOpDisplayWallpaperPresentationInteractor } @Provides @PerDisplaySingleton @DisplayAware @ElementsIntoSet fun bindWallpaperPresentationManagerLifecycleListener( @WallpaperPresentationEnabled isWallpaperPresentationEnabled: Boolean, impl: Provider<WallpaperPresentationManager>, ): Set<SystemUIDisplaySubcomponent.LifecycleListener> = if (isWallpaperPresentationEnabled) { setOf(impl.get()) } else { emptySet() } } }