Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/CommonVisualInterruptionSuppressors.kt +18 −2 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ import com.android.systemui.statusbar.policy.BatteryController import com.android.systemui.statusbar.policy.HeadsUpManager import com.android.systemui.util.NotificationChannels import com.android.systemui.util.settings.GlobalSettings import com.android.systemui.util.settings.SystemSettings import com.android.systemui.util.time.SystemClock import com.android.wm.shell.bubbles.Bubbles import java.util.Optional Loading Loading @@ -279,7 +280,8 @@ class AvalancheSuppressor( private val uiEventLogger: UiEventLogger, private val context: Context, private val notificationManager: NotificationManager, private val logger: VisualInterruptionDecisionLogger private val logger: VisualInterruptionDecisionLogger, private val systemSettings: SystemSettings, ) : VisualInterruptionFilter( types = setOf(PEEK, PULSE), Loading @@ -300,6 +302,11 @@ class AvalancheSuppressor( // education HUNs. private var hasShownOnceForDebug = false // Sometimes the kotlin flow value is false even when the cooldown setting is true (b/356768397) // so let's directly check settings until we confirm that the flow is initialized and in sync // with the real settings value. private var isCooldownFlowInSync = false private fun shouldShowEdu(): Boolean { val forceShowOnce = SystemProperties.get(FORCE_SHOW_AVALANCHE_EDU_ONCE, "").equals("1") return !hasSeenEdu || (forceShowOnce && !hasShownOnceForDebug) Loading Loading @@ -479,6 +486,15 @@ class AvalancheSuppressor( } private fun isCooldownEnabled(): Boolean { return settingsInteractor.isCooldownEnabled.value val isEnabledFromFlow = settingsInteractor.isCooldownEnabled.value if (isCooldownFlowInSync) { return isEnabledFromFlow } val isEnabled = systemSettings.getInt(Settings.System.NOTIFICATION_COOLDOWN_ENABLED, /* def */ 1) == 1 if (isEnabled == isEnabledFromFlow) { isCooldownFlowInSync = true } return isEnabled } } packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImpl.kt +2 −1 Original line number Diff line number Diff line Loading @@ -195,7 +195,8 @@ constructor( uiEventLogger, context, notificationManager, logger logger, systemSettings ) ) avalancheProvider.register() Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImplTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -101,7 +101,7 @@ class VisualInterruptionDecisionProviderImplTest : VisualInterruptionDecisionPro private fun getAvalancheSuppressor() : AvalancheSuppressor { return AvalancheSuppressor( avalancheProvider, systemClock, settingsInteractor, packageManager, uiEventLogger, context, notificationManager, logger uiEventLogger, context, notificationManager, logger, systemSettings ) } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/CommonVisualInterruptionSuppressors.kt +18 −2 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ import com.android.systemui.statusbar.policy.BatteryController import com.android.systemui.statusbar.policy.HeadsUpManager import com.android.systemui.util.NotificationChannels import com.android.systemui.util.settings.GlobalSettings import com.android.systemui.util.settings.SystemSettings import com.android.systemui.util.time.SystemClock import com.android.wm.shell.bubbles.Bubbles import java.util.Optional Loading Loading @@ -279,7 +280,8 @@ class AvalancheSuppressor( private val uiEventLogger: UiEventLogger, private val context: Context, private val notificationManager: NotificationManager, private val logger: VisualInterruptionDecisionLogger private val logger: VisualInterruptionDecisionLogger, private val systemSettings: SystemSettings, ) : VisualInterruptionFilter( types = setOf(PEEK, PULSE), Loading @@ -300,6 +302,11 @@ class AvalancheSuppressor( // education HUNs. private var hasShownOnceForDebug = false // Sometimes the kotlin flow value is false even when the cooldown setting is true (b/356768397) // so let's directly check settings until we confirm that the flow is initialized and in sync // with the real settings value. private var isCooldownFlowInSync = false private fun shouldShowEdu(): Boolean { val forceShowOnce = SystemProperties.get(FORCE_SHOW_AVALANCHE_EDU_ONCE, "").equals("1") return !hasSeenEdu || (forceShowOnce && !hasShownOnceForDebug) Loading Loading @@ -479,6 +486,15 @@ class AvalancheSuppressor( } private fun isCooldownEnabled(): Boolean { return settingsInteractor.isCooldownEnabled.value val isEnabledFromFlow = settingsInteractor.isCooldownEnabled.value if (isCooldownFlowInSync) { return isEnabledFromFlow } val isEnabled = systemSettings.getInt(Settings.System.NOTIFICATION_COOLDOWN_ENABLED, /* def */ 1) == 1 if (isEnabled == isEnabledFromFlow) { isCooldownFlowInSync = true } return isEnabled } }
packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImpl.kt +2 −1 Original line number Diff line number Diff line Loading @@ -195,7 +195,8 @@ constructor( uiEventLogger, context, notificationManager, logger logger, systemSettings ) ) avalancheProvider.register() Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImplTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -101,7 +101,7 @@ class VisualInterruptionDecisionProviderImplTest : VisualInterruptionDecisionPro private fun getAvalancheSuppressor() : AvalancheSuppressor { return AvalancheSuppressor( avalancheProvider, systemClock, settingsInteractor, packageManager, uiEventLogger, context, notificationManager, logger uiEventLogger, context, notificationManager, logger, systemSettings ) } Loading