Merge "Make SystemUiSystemPropertiesFlags.FlagResolver injectable." into tm-qpr-dev am: f8d2447f60

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21361114

Change-Id: I4a5624706e8aa98c0527c9470f1c0f71f5a88253
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Jeff DeCew
2023-02-10 18:51:28 +00:00
committed by Automerger Merge Worker
3 changed files with 51 additions and 7 deletions

View File

@@ -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()
}

View File

@@ -139,6 +139,7 @@ import dagger.Provides;
DemoModeModule.class,
FalsingModule.class,
FlagsModule.class,
SystemPropertiesFlagsModule.class,
FooterActionsModule.class,
LogModule.class,
MediaProjectionModule.class,

View File

@@ -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)
}