diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemPropertiesFlagsModule.kt b/packages/SystemUI/src/com/android/systemui/dagger/SystemPropertiesFlagsModule.kt new file mode 100644 index 0000000000000..c6f833ba2cfd9 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemPropertiesFlagsModule.kt @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.dagger + +import com.android.internal.config.sysui.SystemUiSystemPropertiesFlags +import dagger.Module +import dagger.Provides + +/** A module which provides access to the default [SystemUiSystemPropertiesFlags.FlagResolver] */ +@Module +object SystemPropertiesFlagsModule { + /** provide the default FlagResolver. */ + @Provides + fun provideFlagResolver(): SystemUiSystemPropertiesFlags.FlagResolver = + SystemUiSystemPropertiesFlags.getResolver() +} diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java index 6274a26682f47..c3ee9bee19dbf 100644 --- a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java @@ -139,6 +139,7 @@ import dagger.Provides; DemoModeModule.class, FalsingModule.class, FlagsModule.class, + SystemPropertiesFlagsModule.class, FooterActionsModule.class, LogModule.class, MediaProjectionModule.class, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotifPipelineFlags.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotifPipelineFlags.kt index 48567592c43e3..fc89be2c6670d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotifPipelineFlags.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotifPipelineFlags.kt @@ -17,13 +17,16 @@ package com.android.systemui.statusbar.notification import android.content.Context +import com.android.internal.config.sysui.SystemUiSystemPropertiesFlags.FlagResolver +import com.android.internal.config.sysui.SystemUiSystemPropertiesFlags.NotificationFlags import com.android.systemui.flags.FeatureFlags import com.android.systemui.flags.Flags import javax.inject.Inject class NotifPipelineFlags @Inject constructor( val context: Context, - val featureFlags: FeatureFlags + val featureFlags: FeatureFlags, + val sysPropFlags: FlagResolver, ) { init { featureFlags.addListener(Flags.DISABLE_FSI) { event -> event.requestNoRestart() } @@ -39,11 +42,21 @@ class NotifPipelineFlags @Inject constructor( fun disableFsi(): Boolean = featureFlags.isEnabled(Flags.DISABLE_FSI) - val shouldFilterUnseenNotifsOnKeyguard: Boolean by lazy { - featureFlags.isEnabled(Flags.FILTER_UNSEEN_NOTIFS_ON_KEYGUARD) - } + fun forceDemoteFsi(): Boolean = + sysPropFlags.isEnabled(NotificationFlags.FSI_FORCE_DEMOTE) - val isNoHunForOldWhenEnabled: Boolean by lazy { - featureFlags.isEnabled(Flags.NO_HUN_FOR_OLD_WHEN) - } + fun showStickyHunForDeniedFsi(): Boolean = + sysPropFlags.isEnabled(NotificationFlags.SHOW_STICKY_HUN_FOR_DENIED_FSI) + + fun allowDismissOngoing(): Boolean = + sysPropFlags.isEnabled(NotificationFlags.ALLOW_DISMISS_ONGOING) + + fun isOtpRedactionEnabled(): Boolean = + sysPropFlags.isEnabled(NotificationFlags.OTP_REDACTION) + + val shouldFilterUnseenNotifsOnKeyguard: Boolean + get() = featureFlags.isEnabled(Flags.FILTER_UNSEEN_NOTIFS_ON_KEYGUARD) + + val isNoHunForOldWhenEnabled: Boolean + get() = featureFlags.isEnabled(Flags.NO_HUN_FOR_OLD_WHEN) }