1 /*
2  * Copyright 2023 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.systemui.scene
18 
19 import android.view.View
20 import com.android.systemui.dagger.SysUISingleton
21 import com.android.systemui.keyguard.KeyguardViewConfigurator
22 import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor
23 import com.android.systemui.keyguard.qualifiers.KeyguardRootView
24 import com.android.systemui.keyguard.shared.model.LockscreenSceneBlueprint
25 import com.android.systemui.keyguard.ui.composable.LockscreenContent
26 import com.android.systemui.keyguard.ui.composable.LockscreenScene
27 import com.android.systemui.keyguard.ui.composable.LockscreenSceneBlueprintModule
28 import com.android.systemui.keyguard.ui.composable.blueprint.ComposableLockscreenSceneBlueprint
29 import com.android.systemui.keyguard.ui.viewmodel.LockscreenContentViewModel
30 import com.android.systemui.scene.shared.model.Scene
31 import dagger.Binds
32 import dagger.Module
33 import dagger.Provides
34 import dagger.multibindings.IntoSet
35 import javax.inject.Provider
36 import kotlinx.coroutines.ExperimentalCoroutinesApi
37 
38 @Module(
39     includes =
40         [
41             LockscreenSceneBlueprintModule::class,
42         ],
43 )
44 interface LockscreenSceneModule {
45 
lockscreenScenenull46     @Binds @IntoSet fun lockscreenScene(scene: LockscreenScene): Scene
47 
48     companion object {
49 
50         @OptIn(ExperimentalCoroutinesApi::class)
51         @Provides
52         @SysUISingleton
53         @KeyguardRootView
54         fun viewProvider(
55             configurator: Provider<KeyguardViewConfigurator>,
56         ): () -> View {
57             return { configurator.get().getKeyguardRootView() }
58         }
59 
60         @Provides
61         fun providesLockscreenBlueprints(
62             blueprints: Set<@JvmSuppressWildcards ComposableLockscreenSceneBlueprint>
63         ): Set<LockscreenSceneBlueprint> {
64             return blueprints
65         }
66 
67         @Provides
68         fun providesLockscreenContent(
69             viewModel: LockscreenContentViewModel,
70             blueprints: Set<@JvmSuppressWildcards ComposableLockscreenSceneBlueprint>,
71             clockInteractor: KeyguardClockInteractor,
72         ): LockscreenContent {
73             return LockscreenContent(viewModel, blueprints, clockInteractor)
74         }
75     }
76 }
77