• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
<lambda>null2  * Copyright (C) 2021 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.statusbar.notification
18 
19 import android.content.Context
20 import com.android.internal.config.sysui.SystemUiSystemPropertiesFlags.FlagResolver
21 import com.android.internal.config.sysui.SystemUiSystemPropertiesFlags.NotificationFlags
22 import com.android.systemui.flags.FeatureFlags
23 import com.android.systemui.flags.Flags
24 import javax.inject.Inject
25 
26 class NotifPipelineFlags @Inject constructor(
27     val context: Context,
28     val featureFlags: FeatureFlags,
29     val sysPropFlags: FlagResolver,
30 ) {
31     init {
32         featureFlags.addListener(Flags.DISABLE_FSI) { event -> event.requestNoRestart() }
33     }
34 
35     fun isDevLoggingEnabled(): Boolean =
36         featureFlags.isEnabled(Flags.NOTIFICATION_PIPELINE_DEVELOPER_LOGGING)
37 
38     fun fullScreenIntentRequiresKeyguard(): Boolean =
39         featureFlags.isEnabled(Flags.FSI_REQUIRES_KEYGUARD)
40 
41     fun fsiOnDNDUpdate(): Boolean = featureFlags.isEnabled(Flags.FSI_ON_DND_UPDATE)
42 
43     fun disableFsi(): Boolean = featureFlags.isEnabled(Flags.DISABLE_FSI)
44 
45     fun forceDemoteFsi(): Boolean =
46             sysPropFlags.isEnabled(NotificationFlags.FSI_FORCE_DEMOTE)
47 
48     fun showStickyHunForDeniedFsi(): Boolean =
49             sysPropFlags.isEnabled(NotificationFlags.SHOW_STICKY_HUN_FOR_DENIED_FSI)
50 
51     fun allowDismissOngoing(): Boolean =
52             sysPropFlags.isEnabled(NotificationFlags.ALLOW_DISMISS_ONGOING)
53 
54     fun isOtpRedactionEnabled(): Boolean =
55             sysPropFlags.isEnabled(NotificationFlags.OTP_REDACTION)
56 
57     val shouldFilterUnseenNotifsOnKeyguard: Boolean
58         get() = featureFlags.isEnabled(Flags.FILTER_UNSEEN_NOTIFS_ON_KEYGUARD)
59 
60     val isNoHunForOldWhenEnabled: Boolean
61         get() = featureFlags.isEnabled(Flags.NO_HUN_FOR_OLD_WHEN)
62 }
63