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

This commit is contained in:
Jeff DeCew
2023-02-10 18:17:20 +00:00
committed by Android (Google) Code Review
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, DemoModeModule.class,
FalsingModule.class, FalsingModule.class,
FlagsModule.class, FlagsModule.class,
SystemPropertiesFlagsModule.class,
FooterActionsModule.class, FooterActionsModule.class,
LogModule.class, LogModule.class,
MediaProjectionModule.class, MediaProjectionModule.class,

View File

@@ -17,13 +17,16 @@
package com.android.systemui.statusbar.notification package com.android.systemui.statusbar.notification
import android.content.Context 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.FeatureFlags
import com.android.systemui.flags.Flags import com.android.systemui.flags.Flags
import javax.inject.Inject import javax.inject.Inject
class NotifPipelineFlags @Inject constructor( class NotifPipelineFlags @Inject constructor(
val context: Context, val context: Context,
val featureFlags: FeatureFlags val featureFlags: FeatureFlags,
val sysPropFlags: FlagResolver,
) { ) {
init { init {
featureFlags.addListener(Flags.DISABLE_FSI) { event -> event.requestNoRestart() } featureFlags.addListener(Flags.DISABLE_FSI) { event -> event.requestNoRestart() }
@@ -39,11 +42,21 @@ class NotifPipelineFlags @Inject constructor(
fun disableFsi(): Boolean = featureFlags.isEnabled(Flags.DISABLE_FSI) fun disableFsi(): Boolean = featureFlags.isEnabled(Flags.DISABLE_FSI)
val shouldFilterUnseenNotifsOnKeyguard: Boolean by lazy { fun forceDemoteFsi(): Boolean =
featureFlags.isEnabled(Flags.FILTER_UNSEEN_NOTIFS_ON_KEYGUARD) sysPropFlags.isEnabled(NotificationFlags.FSI_FORCE_DEMOTE)
}
val isNoHunForOldWhenEnabled: Boolean by lazy { fun showStickyHunForDeniedFsi(): Boolean =
featureFlags.isEnabled(Flags.NO_HUN_FOR_OLD_WHEN) 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)
} }