1 /*
2  * Copyright (C) 2022 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 package com.android.systemui.smartspace.dagger
17 
18 import com.android.systemui.plugins.BcSmartspaceDataPlugin
19 import com.android.systemui.smartspace.SmartspacePrecondition
20 import com.android.systemui.smartspace.SmartspaceTargetFilter
21 import com.android.systemui.smartspace.preconditions.LockscreenPrecondition
22 import dagger.Binds
23 import dagger.BindsOptionalOf
24 import dagger.Module
25 import javax.inject.Named
26 
27 @Module(subcomponents = [SmartspaceViewComponent::class])
28 abstract class SmartspaceModule {
29     @Module
30     companion object {
31         /**
32          * The BcSmartspaceDataProvider for dreams.
33          */
34         const val DREAM_SMARTSPACE_DATA_PLUGIN = "dreams_smartspace_data_plugin"
35 
36         /**
37          * The BcSmartspaceDataPlugin for the standalone weather on dream.
38          */
39         const val DREAM_WEATHER_SMARTSPACE_DATA_PLUGIN = "dream_weather_smartspace_data_plugin"
40 
41         /**
42          * The dream smartspace target filter.
43          */
44         const val DREAM_SMARTSPACE_TARGET_FILTER = "dream_smartspace_target_filter"
45 
46         /**
47          * The precondition for dream smartspace
48          */
49         const val DREAM_SMARTSPACE_PRECONDITION = "dream_smartspace_precondition"
50 
51         /**
52          * The BcSmartspaceDataPlugin for the standalone date (+alarm+dnd).
53          */
54         const val DATE_SMARTSPACE_DATA_PLUGIN = "date_smartspace_data_plugin"
55 
56         /**
57          * The BcSmartspaceDataPlugin for the standalone weather.
58          */
59         const val WEATHER_SMARTSPACE_DATA_PLUGIN = "weather_smartspace_data_plugin"
60     }
61 
62     @BindsOptionalOf
63     @Named(DREAM_SMARTSPACE_TARGET_FILTER)
64     abstract fun optionalDreamSmartspaceTargetFilter(): SmartspaceTargetFilter?
65 
66     @BindsOptionalOf
67     @Named(DREAM_SMARTSPACE_DATA_PLUGIN)
68     abstract fun optionalDreamsBcSmartspaceDataPlugin(): BcSmartspaceDataPlugin?
69 
70     @BindsOptionalOf
71     @Named(DREAM_WEATHER_SMARTSPACE_DATA_PLUGIN)
72     abstract fun optionalDreamWeatherSmartspaceDataPlugin(): BcSmartspaceDataPlugin?
73 
74     @Binds
75     @Named(DREAM_SMARTSPACE_PRECONDITION)
76     abstract fun bindSmartspacePrecondition(
77         lockscreenPrecondition: LockscreenPrecondition?
78     ): SmartspacePrecondition?
79 }
80