• 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         /**
32          * The BcSmartspaceDataProvider for dreams.
33          */
34         const val DREAM_SMARTSPACE_DATA_PLUGIN = "dreams_smartspace_data_plugin"
35 
36         /**
37          * The dream smartspace target filter.
38          */
39         const val DREAM_SMARTSPACE_TARGET_FILTER = "dream_smartspace_target_filter"
40 
41         /**
42          * The precondition for dream smartspace
43          */
44         const val DREAM_SMARTSPACE_PRECONDITION = "dream_smartspace_precondition"
45 
46         /**
47          * The BcSmartspaceDataPlugin for the standalone date (+alarm+dnd).
48          */
49         const val DATE_SMARTSPACE_DATA_PLUGIN = "date_smartspace_data_plugin"
50 
51         /**
52          * The BcSmartspaceDataPlugin for the standalone weather.
53          */
54         const val WEATHER_SMARTSPACE_DATA_PLUGIN = "weather_smartspace_data_plugin"
55     }
56 
57     @BindsOptionalOf
58     @Named(DREAM_SMARTSPACE_TARGET_FILTER)
optionalDreamSmartspaceTargetFilternull59     abstract fun optionalDreamSmartspaceTargetFilter(): SmartspaceTargetFilter?
60 
61     @BindsOptionalOf
62     @Named(DREAM_SMARTSPACE_DATA_PLUGIN)
63     abstract fun optionalDreamsBcSmartspaceDataPlugin(): BcSmartspaceDataPlugin?
64 
65     @Binds
66     @Named(DREAM_SMARTSPACE_PRECONDITION)
67     abstract fun bindSmartspacePrecondition(
68         lockscreenPrecondition: LockscreenPrecondition?
69     ): SmartspacePrecondition?
70 }
71