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.scene.shared.flag.SceneContainerFlag 29 import com.android.systemui.statusbar.notification.collection.SortBySectionTimeFlag 30 import com.android.systemui.statusbar.notification.emptyshade.shared.ModesEmptyShadeFix 31 import com.android.systemui.statusbar.notification.interruption.VisualInterruptionRefactor 32 import com.android.systemui.statusbar.notification.shared.NotificationAvalancheSuppression 33 import com.android.systemui.statusbar.notification.shared.NotificationMinimalism 34 import com.android.systemui.statusbar.notification.shared.NotificationThrottleHun 35 import com.android.systemui.statusbar.notification.shared.PriorityPeopleSection 36 import javax.inject.Inject 37 38 /** A class in which engineers can define flag dependencies */ 39 @SysUISingleton 40 class FlagDependencies @Inject constructor(featureFlags: FeatureFlagsClassic, handler: Handler) : 41 FlagDependenciesBase(featureFlags, handler) { 42 override fun defineDependencies() { 43 // Internal notification backend dependencies 44 crossAppPoliteNotifications dependsOn politeNotifications 45 vibrateWhileUnlockedToken dependsOn politeNotifications 46 47 // Internal notification frontend dependencies 48 NotificationAvalancheSuppression.token dependsOn VisualInterruptionRefactor.token 49 PriorityPeopleSection.token dependsOn SortBySectionTimeFlag.token 50 NotificationMinimalism.token dependsOn NotificationThrottleHun.token 51 ModesEmptyShadeFix.token dependsOn modesUi 52 53 // SceneContainer dependencies 54 SceneContainerFlag.getFlagDependencies().forEach { (alpha, beta) -> alpha dependsOn beta } 55 } 56 57 private inline val politeNotifications 58 get() = FlagToken(FLAG_POLITE_NOTIFICATIONS, politeNotifications()) 59 60 private inline val crossAppPoliteNotifications 61 get() = FlagToken(FLAG_CROSS_APP_POLITE_NOTIFICATIONS, crossAppPoliteNotifications()) 62 63 private inline val vibrateWhileUnlockedToken: FlagToken 64 get() = FlagToken(FLAG_VIBRATE_WHILE_UNLOCKED, vibrateWhileUnlocked()) 65 66 private inline val modesUi 67 get() = FlagToken(android.app.Flags.FLAG_MODES_UI, android.app.Flags.modesUi()) 68 69 private inline val communalHub 70 get() = FlagToken(FLAG_COMMUNAL_HUB, communalHub()) 71 } 72