1 /*
<lambda>null2  * Copyright (C) 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.flags
18 
19 import com.android.server.notification.Flags.FLAG_CROSS_APP_POLITE_NOTIFICATIONS
20 import com.android.server.notification.Flags.FLAG_POLITE_NOTIFICATIONS
21 import com.android.server.notification.Flags.FLAG_VIBRATE_WHILE_UNLOCKED
22 import com.android.server.notification.Flags.crossAppPoliteNotifications
23 import com.android.server.notification.Flags.politeNotifications
24 import com.android.server.notification.Flags.vibrateWhileUnlocked
25 import com.android.systemui.Flags.FLAG_COMMUNAL_HUB
26 import com.android.systemui.Flags.communalHub
27 import com.android.systemui.dagger.SysUISingleton
28 import com.android.systemui.keyguard.KeyguardBottomAreaRefactor
29 import com.android.systemui.keyguard.MigrateClocksToBlueprint
30 import com.android.systemui.keyguard.shared.ComposeLockscreen
31 import com.android.systemui.scene.shared.flag.SceneContainerFlag
32 import com.android.systemui.statusbar.notification.collection.SortBySectionTimeFlag
33 import com.android.systemui.statusbar.notification.footer.shared.FooterViewRefactor
34 import com.android.systemui.statusbar.notification.interruption.VisualInterruptionRefactor
35 import com.android.systemui.statusbar.notification.shared.NotificationAvalancheSuppression
36 import com.android.systemui.statusbar.notification.shared.NotificationIconContainerRefactor
37 import com.android.systemui.statusbar.notification.shared.NotificationsLiveDataStoreRefactor
38 import com.android.systemui.statusbar.notification.shared.PriorityPeopleSection
39 import javax.inject.Inject
40 
41 /** A class in which engineers can define flag dependencies */
42 @SysUISingleton
43 class FlagDependencies @Inject constructor(featureFlags: FeatureFlagsClassic, handler: Handler) :
44     FlagDependenciesBase(featureFlags, handler) {
45     override fun defineDependencies() {
46         // Internal notification backend dependencies
47         crossAppPoliteNotifications dependsOn politeNotifications
48         vibrateWhileUnlockedToken dependsOn politeNotifications
49 
50         // Internal notification frontend dependencies
51         NotificationsLiveDataStoreRefactor.token dependsOn NotificationIconContainerRefactor.token
52         FooterViewRefactor.token dependsOn NotificationIconContainerRefactor.token
53         NotificationAvalancheSuppression.token dependsOn VisualInterruptionRefactor.token
54         PriorityPeopleSection.token dependsOn SortBySectionTimeFlag.token
55 
56         // SceneContainer dependencies
57         SceneContainerFlag.getFlagDependencies().forEach { (alpha, beta) -> alpha dependsOn beta }
58 
59         // ComposeLockscreen dependencies
60         ComposeLockscreen.token dependsOn KeyguardBottomAreaRefactor.token
61         ComposeLockscreen.token dependsOn MigrateClocksToBlueprint.token
62 
63         // CommunalHub dependencies
64         communalHub dependsOn MigrateClocksToBlueprint.token
65     }
66 
67     private inline val politeNotifications
68         get() = FlagToken(FLAG_POLITE_NOTIFICATIONS, politeNotifications())
69     private inline val crossAppPoliteNotifications
70         get() = FlagToken(FLAG_CROSS_APP_POLITE_NOTIFICATIONS, crossAppPoliteNotifications())
71     private inline val vibrateWhileUnlockedToken: FlagToken
72         get() = FlagToken(FLAG_VIBRATE_WHILE_UNLOCKED, vibrateWhileUnlocked())
73     private inline val communalHub
74         get() = FlagToken(FLAG_COMMUNAL_HUB, communalHub())
75 }
76