• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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         /** The BcSmartspaceDataProvider for dreams. */
32         const val DREAM_SMARTSPACE_DATA_PLUGIN = "dreams_smartspace_data_plugin"
33 
34         /** The BcSmartspaceDataPlugin for the standalone weather on dream. */
35         const val DREAM_WEATHER_SMARTSPACE_DATA_PLUGIN = "dream_weather_smartspace_data_plugin"
36 
37         /** The target filter for smartspace over lockscreen. */
38         const val LOCKSCREEN_SMARTSPACE_TARGET_FILTER = "lockscreen_smartspace_target_filter"
39 
40         /** The precondition for smartspace over lockscreen */
41         const val LOCKSCREEN_SMARTSPACE_PRECONDITION = "lockscreen_smartspace_precondition"
42 
43         /** The BcSmartspaceDataPlugin for the standalone date (+alarm+dnd). */
44         const val DATE_SMARTSPACE_DATA_PLUGIN = "date_smartspace_data_plugin"
45 
46         /** The BcSmartspaceDataPlugin for the standalone weather. */
47         const val WEATHER_SMARTSPACE_DATA_PLUGIN = "weather_smartspace_data_plugin"
48 
49         /** The BcSmartspaceDataProvider for the glanceable hub. */
50         const val GLANCEABLE_HUB_SMARTSPACE_DATA_PLUGIN = "glanceable_hub_smartspace_data_plugin"
51     }
52 
53     @BindsOptionalOf
54     @Named(LOCKSCREEN_SMARTSPACE_TARGET_FILTER)
optionalDreamSmartspaceTargetFilternull55     abstract fun optionalDreamSmartspaceTargetFilter(): SmartspaceTargetFilter?
56 
57     @BindsOptionalOf
58     @Named(DREAM_SMARTSPACE_DATA_PLUGIN)
59     abstract fun optionalDreamsBcSmartspaceDataPlugin(): BcSmartspaceDataPlugin?
60 
61     @BindsOptionalOf
62     @Named(DREAM_WEATHER_SMARTSPACE_DATA_PLUGIN)
63     abstract fun optionalDreamWeatherSmartspaceDataPlugin(): BcSmartspaceDataPlugin?
64 
65     @Binds
66     @Named(LOCKSCREEN_SMARTSPACE_PRECONDITION)
67     abstract fun bindSmartspacePrecondition(
68         lockscreenPrecondition: LockscreenPrecondition
69     ): SmartspacePrecondition
70 
71     @BindsOptionalOf
72     @Named(GLANCEABLE_HUB_SMARTSPACE_DATA_PLUGIN)
73     abstract fun optionalBcSmartspaceDataPlugin(): BcSmartspaceDataPlugin?
74 }
75