Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f8d2447f authored by Jeff DeCew's avatar Jeff DeCew Committed by Android (Google) Code Review
Browse files

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

parents 0db8b1de 47a9f56b
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
/*
 * 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()
}
+1 −0
Original line number Diff line number Diff line
@@ -139,6 +139,7 @@ import dagger.Provides;
            DemoModeModule.class,
            FalsingModule.class,
            FlagsModule.class,
            SystemPropertiesFlagsModule.class,
            FooterActionsModule.class,
            LogModule.class,
            MediaProjectionModule.class,
+20 −7
Original line number Diff line number Diff line
@@ -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)
}