Merge NotificationsSoundPolicyRepository and ZenModeRepository

These were essentially doing the same thing in slightly different ways.
NotificationsSoundPolicyRepository is the one we're keeping under a new
name: it uses BroadcastReceiver to listen for policy changes.
Meanwhile, the other ZenModeRepository was using ZenModeController, which
in turn uses ContentObserver to listen for changes. In the long run, we
want to replace the callback-based ZenModeController with flows, so this
is one step towards that goal.

Note that the notificationPolicy flow in the old
NotificationSoundPolicyRepository was actually returning the
consolidatedNotificationPolicy. To make it more explicit, I included
both in the new repository, but changed the existing users of
notificationPolicy to use consolidatedNotificationPolicy to avoid a
behavior change.

Also replaced the ZenMode class with a simple int to avoid confusion
with the ZenMode class we're introducing from settings in a follow-up
CL. The only thing it was doing was validation, but that's not strictly
necessary since every consumer of this value (aka the interactors) has
to decide what to do with an "unknown" value anyway.

Bug: 308591859
Bug: 346519570
Test: ZenModeRepositoryTest
Flag: android.app.modes_api
Flag: com.android.systemui.new_volume_panel
Flag: com.android.systemui.notifications_footer_view_refactor
Change-Id: Ie02480dec05055ad3d7c24bd16c76f91bc64c58c
diff --git a/packages/SettingsLib/src/com/android/settingslib/statusbar/notification/data/model/ZenMode.kt b/packages/SettingsLib/src/com/android/settingslib/statusbar/notification/data/model/ZenMode.kt
deleted file mode 100644
index a696f8c..0000000
--- a/packages/SettingsLib/src/com/android/settingslib/statusbar/notification/data/model/ZenMode.kt
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2024 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.settingslib.statusbar.notification.data.model
-
-import android.provider.Settings.Global
-
-/** Validating wrapper for [android.app.NotificationManager.getZenMode] values. */
-@JvmInline
-value class ZenMode(val zenMode: Int) {
-
-    init {
-        require(zenMode in supportedModes) { "Unsupported zenMode=$zenMode" }
-    }
-
-    private companion object {
-
-        val supportedModes =
-            listOf(
-                Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS,
-                Global.ZEN_MODE_NO_INTERRUPTIONS,
-                Global.ZEN_MODE_ALARMS,
-                Global.ZEN_MODE_OFF,
-            )
-    }
-}
diff --git a/packages/SettingsLib/src/com/android/settingslib/statusbar/notification/data/repository/FakeNotificationsSoundPolicyRepository.kt b/packages/SettingsLib/src/com/android/settingslib/statusbar/notification/data/repository/FakeZenModeRepository.kt
similarity index 80%
rename from packages/SettingsLib/src/com/android/settingslib/statusbar/notification/data/repository/FakeNotificationsSoundPolicyRepository.kt
rename to packages/SettingsLib/src/com/android/settingslib/statusbar/notification/data/repository/FakeZenModeRepository.kt
index a939ed1..775e2fc 100644
--- a/packages/SettingsLib/src/com/android/settingslib/statusbar/notification/data/repository/FakeNotificationsSoundPolicyRepository.kt
+++ b/packages/SettingsLib/src/com/android/settingslib/statusbar/notification/data/repository/FakeZenModeRepository.kt
@@ -18,19 +18,18 @@
 
 import android.app.NotificationManager
 import android.provider.Settings
-import com.android.settingslib.statusbar.notification.data.model.ZenMode
 import kotlinx.coroutines.flow.MutableStateFlow
 import kotlinx.coroutines.flow.StateFlow
 import kotlinx.coroutines.flow.asStateFlow
 
-class FakeNotificationsSoundPolicyRepository : NotificationsSoundPolicyRepository {
+class FakeZenModeRepository : ZenModeRepository {
 
     private val mutableNotificationPolicy = MutableStateFlow<NotificationManager.Policy?>(null)
-    override val notificationPolicy: StateFlow<NotificationManager.Policy?>
+    override val consolidatedNotificationPolicy: StateFlow<NotificationManager.Policy?>
         get() = mutableNotificationPolicy.asStateFlow()
 
-    private val mutableZenMode = MutableStateFlow<ZenMode?>(ZenMode(Settings.Global.ZEN_MODE_OFF))
-    override val zenMode: StateFlow<ZenMode?>
+    private val mutableZenMode = MutableStateFlow(Settings.Global.ZEN_MODE_OFF)
+    override val globalZenMode: StateFlow<Int>
         get() = mutableZenMode.asStateFlow()
 
     init {
@@ -41,12 +40,12 @@
         mutableNotificationPolicy.value = policy
     }
 
-    fun updateZenMode(zenMode: ZenMode?) {
+    fun updateZenMode(zenMode: Int) {
         mutableZenMode.value = zenMode
     }
 }
 
-fun FakeNotificationsSoundPolicyRepository.updateNotificationPolicy(
+fun FakeZenModeRepository.updateNotificationPolicy(
     priorityCategories: Int = 0,
     priorityCallSenders: Int = NotificationManager.Policy.PRIORITY_SENDERS_ANY,
     priorityMessageSenders: Int = NotificationManager.Policy.CONVERSATION_SENDERS_NONE,
diff --git a/packages/SettingsLib/src/com/android/settingslib/statusbar/notification/data/repository/NotificationsSoundPolicyRepository.kt b/packages/SettingsLib/src/com/android/settingslib/statusbar/notification/data/repository/ZenModeRepository.kt
similarity index 68%
rename from packages/SettingsLib/src/com/android/settingslib/statusbar/notification/data/repository/NotificationsSoundPolicyRepository.kt
rename to packages/SettingsLib/src/com/android/settingslib/statusbar/notification/data/repository/ZenModeRepository.kt
index 0fb8c3f..aa0c940 100644
--- a/packages/SettingsLib/src/com/android/settingslib/statusbar/notification/data/repository/NotificationsSoundPolicyRepository.kt
+++ b/packages/SettingsLib/src/com/android/settingslib/statusbar/notification/data/repository/ZenModeRepository.kt
@@ -21,7 +21,6 @@
 import android.content.Context
 import android.content.Intent
 import android.content.IntentFilter
-import com.android.settingslib.statusbar.notification.data.model.ZenMode
 import kotlin.coroutines.CoroutineContext
 import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.channels.awaitClose
@@ -37,21 +36,20 @@
 import kotlinx.coroutines.launch
 
 /** Provides state of volume policy and restrictions imposed by notifications. */
-interface NotificationsSoundPolicyRepository {
-
-    /** @see NotificationManager.getNotificationPolicy */
-    val notificationPolicy: StateFlow<NotificationManager.Policy?>
+interface ZenModeRepository {
+    /** @see NotificationManager.getConsolidatedNotificationPolicy */
+    val consolidatedNotificationPolicy: StateFlow<NotificationManager.Policy?>
 
     /** @see NotificationManager.getZenMode */
-    val zenMode: StateFlow<ZenMode?>
+    val globalZenMode: StateFlow<Int?>
 }
 
-class NotificationsSoundPolicyRepositoryImpl(
+class ZenModeRepositoryImpl(
     private val context: Context,
     private val notificationManager: NotificationManager,
-    scope: CoroutineScope,
-    backgroundCoroutineContext: CoroutineContext,
-) : NotificationsSoundPolicyRepository {
+    val scope: CoroutineScope,
+    val backgroundCoroutineContext: CoroutineContext,
+) : ZenModeRepository {
 
     private val notificationBroadcasts =
         callbackFlow {
@@ -67,8 +65,7 @@
                     IntentFilter().apply {
                         addAction(NotificationManager.ACTION_INTERRUPTION_FILTER_CHANGED)
                         addAction(NotificationManager.ACTION_NOTIFICATION_POLICY_CHANGED)
-                    }
-                )
+                    })
 
                 awaitClose { context.unregisterReceiver(receiver) }
             }
@@ -77,19 +74,23 @@
                 scope = scope,
             )
 
-    override val notificationPolicy: StateFlow<NotificationManager.Policy?> =
-        notificationBroadcasts
-            .filter { NotificationManager.ACTION_NOTIFICATION_POLICY_CHANGED == it }
-            .map { notificationManager.consolidatedNotificationPolicy }
-            .onStart { emit(notificationManager.consolidatedNotificationPolicy) }
-            .flowOn(backgroundCoroutineContext)
-            .stateIn(scope, SharingStarted.WhileSubscribed(), null)
+    override val consolidatedNotificationPolicy: StateFlow<NotificationManager.Policy?> =
+        // TODO(b/347707024): This should use ACTION_CONSOLIDATED_NOTIFICATION_POLICY_CHANGED
+        // instead.
+        flowFromBroadcast(NotificationManager.ACTION_NOTIFICATION_POLICY_CHANGED) {
+            notificationManager.consolidatedNotificationPolicy
+        }
 
-    override val zenMode: StateFlow<ZenMode?> =
+    override val globalZenMode: StateFlow<Int?> =
+        flowFromBroadcast(NotificationManager.ACTION_INTERRUPTION_FILTER_CHANGED) {
+            notificationManager.zenMode
+        }
+
+    private fun <T> flowFromBroadcast(intentAction: String, mapper: () -> T) =
         notificationBroadcasts
-            .filter { NotificationManager.ACTION_INTERRUPTION_FILTER_CHANGED == it }
-            .map { ZenMode(notificationManager.zenMode) }
-            .onStart { emit(ZenMode(notificationManager.zenMode)) }
+            .filter { intentAction == it }
+            .map { mapper() }
+            .onStart { emit(mapper()) }
             .flowOn(backgroundCoroutineContext)
             .stateIn(scope, SharingStarted.WhileSubscribed(), null)
 }
diff --git a/packages/SettingsLib/src/com/android/settingslib/statusbar/notification/domain/interactor/NotificationsSoundPolicyInteractor.kt b/packages/SettingsLib/src/com/android/settingslib/statusbar/notification/domain/interactor/NotificationsSoundPolicyInteractor.kt
index 7719c4b..953c90d 100644
--- a/packages/SettingsLib/src/com/android/settingslib/statusbar/notification/domain/interactor/NotificationsSoundPolicyInteractor.kt
+++ b/packages/SettingsLib/src/com/android/settingslib/statusbar/notification/domain/interactor/NotificationsSoundPolicyInteractor.kt
@@ -20,8 +20,7 @@
 import android.media.AudioManager
 import android.provider.Settings
 import android.service.notification.ZenModeConfig
-import com.android.settingslib.statusbar.notification.data.model.ZenMode
-import com.android.settingslib.statusbar.notification.data.repository.NotificationsSoundPolicyRepository
+import com.android.settingslib.statusbar.notification.data.repository.ZenModeRepository
 import com.android.settingslib.volume.shared.model.AudioStream
 import kotlinx.coroutines.flow.Flow
 import kotlinx.coroutines.flow.StateFlow
@@ -30,17 +29,15 @@
 import kotlinx.coroutines.flow.map
 
 /** Determines notification sounds state and limitations. */
-class NotificationsSoundPolicyInteractor(
-    private val repository: NotificationsSoundPolicyRepository
-) {
+class NotificationsSoundPolicyInteractor(private val repository: ZenModeRepository) {
 
     /** @see NotificationManager.getNotificationPolicy */
-    val notificationPolicy: StateFlow<NotificationManager.Policy?>
-        get() = repository.notificationPolicy
+    private val notificationPolicy: StateFlow<NotificationManager.Policy?>
+        get() = repository.consolidatedNotificationPolicy
 
     /** @see NotificationManager.getZenMode */
-    val zenMode: StateFlow<ZenMode?>
-        get() = repository.zenMode
+    val zenMode: StateFlow<Int?>
+        get() = repository.globalZenMode
 
     /** Checks if [notificationPolicy] allows alarms. */
     val areAlarmsAllowed: Flow<Boolean?> = notificationPolicy.map { it?.allowAlarms() }
@@ -67,7 +64,7 @@
             isRingerAllowed.filterNotNull(),
             isSystemAllowed.filterNotNull(),
         ) { zenMode, areAlarmsAllowed, isMediaAllowed, isRingerAllowed, isSystemAllowed ->
-            when (zenMode.zenMode) {
+            when (zenMode) {
                 // Everything is muted
                 Settings.Global.ZEN_MODE_NO_INTERRUPTIONS -> return@combine true
                 Settings.Global.ZEN_MODE_ALARMS ->
diff --git a/packages/SettingsLib/tests/integ/src/com/android/settingslib/statusbar/notification/data/repository/NotificationsSoundPolicyRepositoryTest.kt b/packages/SettingsLib/tests/integ/src/com/android/settingslib/statusbar/notification/data/repository/ZenModeRepositoryTest.kt
similarity index 74%
rename from packages/SettingsLib/tests/integ/src/com/android/settingslib/statusbar/notification/data/repository/NotificationsSoundPolicyRepositoryTest.kt
rename to packages/SettingsLib/tests/integ/src/com/android/settingslib/statusbar/notification/data/repository/ZenModeRepositoryTest.kt
index dfc4c0a..89d4a5f 100644
--- a/packages/SettingsLib/tests/integ/src/com/android/settingslib/statusbar/notification/data/repository/NotificationsSoundPolicyRepositoryTest.kt
+++ b/packages/SettingsLib/tests/integ/src/com/android/settingslib/statusbar/notification/data/repository/ZenModeRepositoryTest.kt
@@ -23,7 +23,6 @@
 import android.provider.Settings.Global
 import androidx.test.ext.junit.runners.AndroidJUnit4
 import androidx.test.filters.SmallTest
-import com.android.settingslib.statusbar.notification.data.model.ZenMode
 import com.google.common.truth.Truth.assertThat
 import kotlinx.coroutines.ExperimentalCoroutinesApi
 import kotlinx.coroutines.flow.launchIn
@@ -45,13 +44,18 @@
 @OptIn(ExperimentalCoroutinesApi::class)
 @RunWith(AndroidJUnit4::class)
 @SmallTest
-class NotificationsSoundPolicyRepositoryTest {
+class ZenModeRepositoryTest {
 
-    @Mock private lateinit var context: Context
-    @Mock private lateinit var notificationManager: NotificationManager
-    @Captor private lateinit var receiverCaptor: ArgumentCaptor<BroadcastReceiver>
+    @Mock
+    private lateinit var context: Context
 
-    private lateinit var underTest: NotificationsSoundPolicyRepository
+    @Mock
+    private lateinit var notificationManager: NotificationManager
+
+    @Captor
+    private lateinit var receiverCaptor: ArgumentCaptor<BroadcastReceiver>
+
+    private lateinit var underTest: ZenModeRepository
 
     private val testScope: TestScope = TestScope()
 
@@ -60,7 +64,7 @@
         MockitoAnnotations.initMocks(this)
 
         underTest =
-            NotificationsSoundPolicyRepositoryImpl(
+            ZenModeRepositoryImpl(
                 context,
                 notificationManager,
                 testScope.backgroundScope,
@@ -69,29 +73,30 @@
     }
 
     @Test
-    fun policyChanges_repositoryEmits() {
+    fun consolidatedPolicyChanges_repositoryEmits() {
         testScope.runTest {
             val values = mutableListOf<NotificationManager.Policy?>()
-            `when`(notificationManager.notificationPolicy).thenReturn(testPolicy1)
-            underTest.notificationPolicy.onEach { values.add(it) }.launchIn(backgroundScope)
+            `when`(notificationManager.consolidatedNotificationPolicy).thenReturn(testPolicy1)
+            underTest.consolidatedNotificationPolicy.onEach { values.add(it) }
+                    .launchIn(backgroundScope)
             runCurrent()
 
-            `when`(notificationManager.notificationPolicy).thenReturn(testPolicy2)
+            `when`(notificationManager.consolidatedNotificationPolicy).thenReturn(testPolicy2)
             triggerIntent(NotificationManager.ACTION_NOTIFICATION_POLICY_CHANGED)
             runCurrent()
 
             assertThat(values)
-                .containsExactlyElementsIn(listOf(null, testPolicy1, testPolicy2))
-                .inOrder()
+                    .containsExactlyElementsIn(listOf(null, testPolicy1, testPolicy2))
+                    .inOrder()
         }
     }
 
     @Test
     fun zenModeChanges_repositoryEmits() {
         testScope.runTest {
-            val values = mutableListOf<ZenMode?>()
+            val values = mutableListOf<Int?>()
             `when`(notificationManager.zenMode).thenReturn(Global.ZEN_MODE_OFF)
-            underTest.zenMode.onEach { values.add(it) }.launchIn(backgroundScope)
+            underTest.globalZenMode.onEach { values.add(it) }.launchIn(backgroundScope)
             runCurrent()
 
             `when`(notificationManager.zenMode).thenReturn(Global.ZEN_MODE_ALARMS)
@@ -99,10 +104,10 @@
             runCurrent()
 
             assertThat(values)
-                .containsExactlyElementsIn(
-                    listOf(null, ZenMode(Global.ZEN_MODE_OFF), ZenMode(Global.ZEN_MODE_ALARMS))
-                )
-                .inOrder()
+                    .containsExactlyElementsIn(
+                        listOf(null, Global.ZEN_MODE_OFF, Global.ZEN_MODE_ALARMS)
+                    )
+                    .inOrder()
         }
     }
 
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationsSoundPolicyInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationsSoundPolicyInteractorTest.kt
index 8e765f7..9ef42c3 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationsSoundPolicyInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationsSoundPolicyInteractorTest.kt
@@ -21,13 +21,13 @@
 import android.provider.Settings.Global
 import androidx.test.ext.junit.runners.AndroidJUnit4
 import androidx.test.filters.SmallTest
-import com.android.settingslib.statusbar.notification.data.model.ZenMode
 import com.android.settingslib.statusbar.notification.data.repository.updateNotificationPolicy
 import com.android.settingslib.statusbar.notification.domain.interactor.NotificationsSoundPolicyInteractor
 import com.android.settingslib.volume.shared.model.AudioStream
 import com.android.systemui.SysuiTestCase
 import com.android.systemui.coroutines.collectLastValue
 import com.android.systemui.kosmos.testScope
+import com.android.systemui.statusbar.policy.data.repository.zenModeRepository
 import com.android.systemui.testKosmos
 import com.google.common.truth.Expect
 import com.google.common.truth.Truth.assertThat
@@ -52,24 +52,20 @@
 
     @Before
     fun setup() {
-        with(kosmos) {
-            underTest = NotificationsSoundPolicyInteractor(notificationsSoundPolicyRepository)
-        }
+        with(kosmos) { underTest = NotificationsSoundPolicyInteractor(zenModeRepository) }
     }
 
     @Test
     fun onlyAlarmsCategory_areAlarmsAllowed_isTrue() {
         with(kosmos) {
             testScope.runTest {
-                notificationsSoundPolicyRepository.updateZenMode(ZenMode(Global.ZEN_MODE_OFF))
+                zenModeRepository.updateZenMode(Global.ZEN_MODE_OFF)
                 val expectedByCategory =
                     NotificationManager.Policy.ALL_PRIORITY_CATEGORIES.associateWith {
                         it == NotificationManager.Policy.PRIORITY_CATEGORY_ALARMS
                     }
                 expectedByCategory.forEach { entry ->
-                    notificationsSoundPolicyRepository.updateNotificationPolicy(
-                        priorityCategories = entry.key
-                    )
+                    zenModeRepository.updateNotificationPolicy(priorityCategories = entry.key)
 
                     val areAlarmsAllowed by collectLastValue(underTest.areAlarmsAllowed)
                     runCurrent()
@@ -84,15 +80,13 @@
     fun onlyMediaCategory_areAlarmsAllowed_isTrue() {
         with(kosmos) {
             testScope.runTest {
-                notificationsSoundPolicyRepository.updateZenMode(ZenMode(Global.ZEN_MODE_OFF))
+                zenModeRepository.updateZenMode(Global.ZEN_MODE_OFF)
                 val expectedByCategory =
                     NotificationManager.Policy.ALL_PRIORITY_CATEGORIES.associateWith {
                         it == NotificationManager.Policy.PRIORITY_CATEGORY_MEDIA
                     }
                 expectedByCategory.forEach { entry ->
-                    notificationsSoundPolicyRepository.updateNotificationPolicy(
-                        priorityCategories = entry.key
-                    )
+                    zenModeRepository.updateNotificationPolicy(priorityCategories = entry.key)
 
                     val isMediaAllowed by collectLastValue(underTest.isMediaAllowed)
                     runCurrent()
@@ -108,7 +102,7 @@
         with(kosmos) {
             testScope.runTest {
                 for (category in NotificationManager.Policy.ALL_PRIORITY_CATEGORIES) {
-                    notificationsSoundPolicyRepository.updateNotificationPolicy(
+                    zenModeRepository.updateNotificationPolicy(
                         priorityCategories = category,
                         state = NotificationManager.Policy.STATE_UNSET,
                     )
@@ -126,7 +120,7 @@
     fun allCategoriesAllowed_isRingerAllowed_isTrue() {
         with(kosmos) {
             testScope.runTest {
-                notificationsSoundPolicyRepository.updateNotificationPolicy(
+                zenModeRepository.updateNotificationPolicy(
                     priorityCategories =
                         NotificationManager.Policy.ALL_PRIORITY_CATEGORIES.reduce { acc, value ->
                             acc or value
@@ -146,7 +140,7 @@
     fun noCategoriesAndBlocked_isRingerAllowed_isFalse() {
         with(kosmos) {
             testScope.runTest {
-                notificationsSoundPolicyRepository.updateNotificationPolicy(
+                zenModeRepository.updateNotificationPolicy(
                     priorityCategories = 0,
                     state = NotificationManager.Policy.STATE_PRIORITY_CHANNELS_BLOCKED,
                 )
@@ -163,10 +157,8 @@
     fun zenModeNoInterruptions_allStreams_muted() {
         with(kosmos) {
             testScope.runTest {
-                notificationsSoundPolicyRepository.updateNotificationPolicy()
-                notificationsSoundPolicyRepository.updateZenMode(
-                    ZenMode(Global.ZEN_MODE_NO_INTERRUPTIONS)
-                )
+                zenModeRepository.updateNotificationPolicy()
+                zenModeRepository.updateZenMode(Global.ZEN_MODE_NO_INTERRUPTIONS)
 
                 for (stream in AudioStream.supportedStreamTypes) {
                     val isZenMuted by collectLastValue(underTest.isZenMuted(AudioStream(stream)))
@@ -182,8 +174,8 @@
     fun zenModeOff_allStreams_notMuted() {
         with(kosmos) {
             testScope.runTest {
-                notificationsSoundPolicyRepository.updateNotificationPolicy()
-                notificationsSoundPolicyRepository.updateZenMode(ZenMode(Global.ZEN_MODE_OFF))
+                zenModeRepository.updateNotificationPolicy()
+                zenModeRepository.updateZenMode(Global.ZEN_MODE_OFF)
 
                 for (stream in AudioStream.supportedStreamTypes) {
                     val isZenMuted by collectLastValue(underTest.isZenMuted(AudioStream(stream)))
@@ -205,8 +197,8 @@
                     AudioManager.STREAM_SYSTEM,
                 )
             testScope.runTest {
-                notificationsSoundPolicyRepository.updateNotificationPolicy()
-                notificationsSoundPolicyRepository.updateZenMode(ZenMode(Global.ZEN_MODE_ALARMS))
+                zenModeRepository.updateNotificationPolicy()
+                zenModeRepository.updateZenMode(Global.ZEN_MODE_ALARMS)
 
                 for (stream in AudioStream.supportedStreamTypes) {
                     val isZenMuted by collectLastValue(underTest.isZenMuted(AudioStream(stream)))
@@ -222,10 +214,8 @@
     fun alarms_allowed_notMuted() {
         with(kosmos) {
             testScope.runTest {
-                notificationsSoundPolicyRepository.updateZenMode(
-                    ZenMode(Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS)
-                )
-                notificationsSoundPolicyRepository.updateNotificationPolicy(
+                zenModeRepository.updateZenMode(Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS)
+                zenModeRepository.updateNotificationPolicy(
                     priorityCategories = NotificationManager.Policy.PRIORITY_CATEGORY_ALARMS
                 )
 
@@ -242,10 +232,8 @@
     fun media_allowed_notMuted() {
         with(kosmos) {
             testScope.runTest {
-                notificationsSoundPolicyRepository.updateZenMode(
-                    ZenMode(Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS)
-                )
-                notificationsSoundPolicyRepository.updateNotificationPolicy(
+                zenModeRepository.updateZenMode(Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS)
+                zenModeRepository.updateNotificationPolicy(
                     priorityCategories = NotificationManager.Policy.PRIORITY_CATEGORY_MEDIA
                 )
 
@@ -262,10 +250,8 @@
     fun ringer_allowed_notificationsNotMuted() {
         with(kosmos) {
             testScope.runTest {
-                notificationsSoundPolicyRepository.updateZenMode(
-                    ZenMode(Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS)
-                )
-                notificationsSoundPolicyRepository.updateNotificationPolicy(
+                zenModeRepository.updateZenMode(Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS)
+                zenModeRepository.updateNotificationPolicy(
                     priorityCategories =
                         NotificationManager.Policy.ALL_PRIORITY_CATEGORIES.reduce { acc, value ->
                             acc or value
@@ -288,10 +274,8 @@
     fun ringer_allowed_ringNotMuted() {
         with(kosmos) {
             testScope.runTest {
-                notificationsSoundPolicyRepository.updateZenMode(
-                    ZenMode(Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS)
-                )
-                notificationsSoundPolicyRepository.updateNotificationPolicy(
+                zenModeRepository.updateZenMode(Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS)
+                zenModeRepository.updateNotificationPolicy(
                     priorityCategories =
                         NotificationManager.Policy.ALL_PRIORITY_CATEGORIES.reduce { acc, value ->
                             acc or value
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModelTest.kt
index 9fde116..68e4cda 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModelTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModelTest.kt
@@ -23,6 +23,7 @@
 import android.platform.test.flag.junit.FlagsParameterization
 import android.provider.Settings
 import androidx.test.filters.SmallTest
+import com.android.settingslib.statusbar.notification.data.repository.updateNotificationPolicy
 import com.android.systemui.SysuiTestCase
 import com.android.systemui.coroutines.collectLastValue
 import com.android.systemui.flags.Flags
@@ -56,7 +57,6 @@
 import org.junit.Before
 import org.junit.Test
 import org.junit.runner.RunWith
-import org.mockito.MockitoAnnotations
 import platform.test.runner.parameterized.ParameterizedAndroidJunit4
 import platform.test.runner.parameterized.Parameters
 
@@ -97,7 +97,9 @@
 
     @Before
     fun setUp() {
-        MockitoAnnotations.initMocks(this)
+        // "Why is this not lazily initialised above?" you may ask. There's a simple answer: likely
+        // due to some timing issue with how the flags are getting initialised for parameterization,
+        // some tests start failing when this isn't initialised this way. You can just leave it be.
         underTest = kosmos.notificationListViewModel
     }
 
@@ -258,8 +260,10 @@
         testScope.runTest {
             val hidden by collectLastValue(underTest.areNotificationsHiddenInShade)
 
-            zenModeRepository.setSuppressedVisualEffects(Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST)
-            zenModeRepository.zenMode.value = Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS
+            zenModeRepository.updateNotificationPolicy(
+                suppressedVisualEffects = Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST
+            )
+            zenModeRepository.updateZenMode(Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS)
             runCurrent()
 
             assertThat(hidden).isTrue()
@@ -270,8 +274,10 @@
         testScope.runTest {
             val hidden by collectLastValue(underTest.areNotificationsHiddenInShade)
 
-            zenModeRepository.setSuppressedVisualEffects(Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST)
-            zenModeRepository.zenMode.value = Settings.Global.ZEN_MODE_OFF
+            zenModeRepository.updateNotificationPolicy(
+                suppressedVisualEffects = Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST
+            )
+            zenModeRepository.updateZenMode(Settings.Global.ZEN_MODE_OFF)
             runCurrent()
 
             assertThat(hidden).isFalse()
@@ -528,9 +534,7 @@
                     FakeHeadsUpRowRepository(key = "1"),
                     FakeHeadsUpRowRepository(key = "2"),
                 )
-            headsUpRepository.setNotifications(
-                rows,
-            )
+            headsUpRepository.setNotifications(rows)
             runCurrent()
 
             // THEN the list is empty
@@ -566,7 +570,7 @@
 
             headsUpRepository.setNotifications(
                 FakeHeadsUpRowRepository(key = "0", isPinned = true),
-                FakeHeadsUpRowRepository(key = "1")
+                FakeHeadsUpRowRepository(key = "1"),
             )
             runCurrent()
 
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/domain/interactor/ZenModeInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/domain/interactor/ZenModeInteractorTest.kt
new file mode 100644
index 0000000..f1fed19
--- /dev/null
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/domain/interactor/ZenModeInteractorTest.kt
@@ -0,0 +1,154 @@
+/*
+ * 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.statusbar.policy.domain.interactor
+
+import android.app.NotificationManager.Policy
+import android.provider.Settings
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.SmallTest
+import com.android.settingslib.statusbar.notification.data.repository.updateNotificationPolicy
+import com.android.systemui.SysuiTestCase
+import com.android.systemui.coroutines.collectLastValue
+import com.android.systemui.kosmos.testScope
+import com.android.systemui.statusbar.policy.data.repository.fakeZenModeRepository
+import com.android.systemui.testKosmos
+import com.google.common.truth.Truth.assertThat
+import kotlinx.coroutines.ExperimentalCoroutinesApi
+import kotlinx.coroutines.test.runCurrent
+import kotlinx.coroutines.test.runTest
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@OptIn(ExperimentalCoroutinesApi::class)
+@RunWith(AndroidJUnit4::class)
+@SmallTest
+class ZenModeInteractorTest : SysuiTestCase() {
+    private val kosmos = testKosmos()
+    private val testScope = kosmos.testScope
+    private val repository = kosmos.fakeZenModeRepository
+
+    private val underTest = kosmos.zenModeInteractor
+
+    @Test
+    fun isZenModeEnabled_off() =
+        testScope.runTest {
+            val enabled by collectLastValue(underTest.isZenModeEnabled)
+
+            repository.updateZenMode(Settings.Global.ZEN_MODE_OFF)
+            runCurrent()
+
+            assertThat(enabled).isFalse()
+        }
+
+    @Test
+    fun isZenModeEnabled_alarms() =
+        testScope.runTest {
+            val enabled by collectLastValue(underTest.isZenModeEnabled)
+
+            repository.updateZenMode(Settings.Global.ZEN_MODE_ALARMS)
+            runCurrent()
+
+            assertThat(enabled).isTrue()
+        }
+
+    @Test
+    fun isZenModeEnabled_importantInterruptions() =
+        testScope.runTest {
+            val enabled by collectLastValue(underTest.isZenModeEnabled)
+
+            repository.updateZenMode(Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS)
+            runCurrent()
+
+            assertThat(enabled).isTrue()
+        }
+
+    @Test
+    fun isZenModeEnabled_noInterruptions() =
+        testScope.runTest {
+            val enabled by collectLastValue(underTest.isZenModeEnabled)
+
+            repository.updateZenMode(Settings.Global.ZEN_MODE_NO_INTERRUPTIONS)
+            runCurrent()
+
+            assertThat(enabled).isTrue()
+        }
+
+    @Test
+    fun testIsZenModeEnabled_unknown() =
+        testScope.runTest {
+            val enabled by collectLastValue(underTest.isZenModeEnabled)
+
+            repository.updateZenMode(4) // this should fail if we ever add another zen mode type
+            runCurrent()
+
+            assertThat(enabled).isFalse()
+        }
+
+    @Test
+    fun areNotificationsHiddenInShade_noPolicy() =
+        testScope.runTest {
+            val hidden by collectLastValue(underTest.areNotificationsHiddenInShade)
+
+            repository.updateNotificationPolicy(null)
+            repository.updateZenMode(Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS)
+            runCurrent()
+
+            assertThat(hidden).isFalse()
+        }
+
+    @Test
+    fun areNotificationsHiddenInShade_zenOffShadeSuppressed() =
+        testScope.runTest {
+            val hidden by collectLastValue(underTest.areNotificationsHiddenInShade)
+
+            repository.updateNotificationPolicy(
+                suppressedVisualEffects = Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST
+            )
+            repository.updateZenMode(Settings.Global.ZEN_MODE_OFF)
+            runCurrent()
+
+            assertThat(hidden).isFalse()
+        }
+
+    @Test
+    fun areNotificationsHiddenInShade_zenOnShadeNotSuppressed() =
+        testScope.runTest {
+            val hidden by collectLastValue(underTest.areNotificationsHiddenInShade)
+
+            repository.updateNotificationPolicy(
+                suppressedVisualEffects = Policy.SUPPRESSED_EFFECT_STATUS_BAR
+            )
+            repository.updateZenMode(Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS)
+            runCurrent()
+
+            assertThat(hidden).isFalse()
+        }
+
+    @Test
+    fun areNotificationsHiddenInShade_zenOnShadeSuppressed() =
+        testScope.runTest {
+            val hidden by collectLastValue(underTest.areNotificationsHiddenInShade)
+
+            repository.updateNotificationPolicy(
+                suppressedVisualEffects = Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST
+            )
+            repository.updateZenMode(Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS)
+            runCurrent()
+
+            assertThat(hidden).isTrue()
+        }
+}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/interactor/AudioVolumeInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/interactor/AudioVolumeInteractorTest.kt
index d620639..6e49e43 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/interactor/AudioVolumeInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/interactor/AudioVolumeInteractorTest.kt
@@ -20,7 +20,6 @@
 import android.provider.Settings
 import androidx.test.ext.junit.runners.AndroidJUnit4
 import androidx.test.filters.SmallTest
-import com.android.settingslib.statusbar.notification.data.model.ZenMode
 import com.android.settingslib.statusbar.notification.data.repository.updateNotificationPolicy
 import com.android.settingslib.volume.domain.interactor.AudioVolumeInteractor
 import com.android.settingslib.volume.shared.model.AudioStream
@@ -29,7 +28,7 @@
 import com.android.systemui.coroutines.collectLastValue
 import com.android.systemui.kosmos.testScope
 import com.android.systemui.statusbar.notification.domain.interactor.notificationsSoundPolicyInteractor
-import com.android.systemui.statusbar.notification.domain.interactor.notificationsSoundPolicyRepository
+import com.android.systemui.statusbar.policy.data.repository.zenModeRepository
 import com.android.systemui.testKosmos
 import com.android.systemui.volume.data.repository.audioRepository
 import com.google.common.truth.Truth.assertThat
@@ -104,10 +103,8 @@
     fun zenMuted_cantChange() {
         with(kosmos) {
             testScope.runTest {
-                notificationsSoundPolicyRepository.updateNotificationPolicy()
-                notificationsSoundPolicyRepository.updateZenMode(
-                    ZenMode(Settings.Global.ZEN_MODE_NO_INTERRUPTIONS)
-                )
+                zenModeRepository.updateNotificationPolicy()
+                zenModeRepository.updateZenMode(Settings.Global.ZEN_MODE_NO_INTERRUPTIONS)
 
                 val canChangeVolume by
                     collectLastValue(
@@ -141,9 +138,7 @@
         with(kosmos) {
             testScope.runTest {
                 audioRepository.setLastAudibleVolume(audioStream, 30)
-                notificationsSoundPolicyRepository.updateZenMode(
-                    ZenMode(Settings.Global.ZEN_MODE_NO_INTERRUPTIONS)
-                )
+                zenModeRepository.updateZenMode(Settings.Global.ZEN_MODE_NO_INTERRUPTIONS)
 
                 val model by collectLastValue(underTest.getAudioStream(audioStream))
                 runCurrent()
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java
index 91bb28e..762c9a1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java
@@ -21,8 +21,8 @@
 import android.service.notification.NotificationListenerService;
 
 import com.android.internal.jank.InteractionJankMonitor;
-import com.android.settingslib.statusbar.notification.data.repository.NotificationsSoundPolicyRepository;
-import com.android.settingslib.statusbar.notification.data.repository.NotificationsSoundPolicyRepositoryImpl;
+import com.android.settingslib.statusbar.notification.data.repository.ZenModeRepository;
+import com.android.settingslib.statusbar.notification.data.repository.ZenModeRepositoryImpl;
 import com.android.settingslib.statusbar.notification.domain.interactor.NotificationsSoundPolicyInteractor;
 import com.android.systemui.CoreStartable;
 import com.android.systemui.dagger.SysUISingleton;
@@ -279,19 +279,19 @@
 
     @Provides
     @SysUISingleton
-    public static NotificationsSoundPolicyRepository provideNotificationsSoundPolicyRepository(
+    static ZenModeRepository provideZenModeRepository(
             Context context,
             NotificationManager notificationManager,
             @Application CoroutineScope coroutineScope,
             @Background CoroutineContext coroutineContext) {
-        return new NotificationsSoundPolicyRepositoryImpl(context, notificationManager,
+        return new ZenModeRepositoryImpl(context, notificationManager,
                 coroutineScope, coroutineContext);
     }
 
     @Provides
     @SysUISingleton
-    public static NotificationsSoundPolicyInteractor provideNotificationsSoundPolicyInteractror(
-            NotificationsSoundPolicyRepository repository) {
+    static NotificationsSoundPolicyInteractor provideNotificationsSoundPolicyInteractor(
+            ZenModeRepository repository) {
         return new NotificationsSoundPolicyInteractor(repository);
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeController.java
index ad19729..23e40b2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeController.java
@@ -24,7 +24,14 @@
 import android.service.notification.ZenModeConfig.ZenRule;
 
 import com.android.systemui.statusbar.policy.ZenModeController.Callback;
+import com.android.systemui.statusbar.policy.domain.interactor.ZenModeInteractor;
 
+/**
+ * Callback-based controller for listening to (or making) zen mode changes. Please prefer using the
+ * Flow-based {@link ZenModeInteractor} for new code instead of this.
+ *
+ * TODO(b/308591859): This should eventually be replaced by ZenModeInteractor/ZenModeRepository.
+ */
 public interface ZenModeController extends CallbackController<Callback> {
     void setZen(int zen, Uri conditionId, String reason);
     int getZen();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/dagger/StatusBarPolicyModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/dagger/StatusBarPolicyModule.java
index 15200bd..e08e4d7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/dagger/StatusBarPolicyModule.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/dagger/StatusBarPolicyModule.java
@@ -73,7 +73,6 @@
 import com.android.systemui.statusbar.policy.bluetooth.BluetoothRepository;
 import com.android.systemui.statusbar.policy.bluetooth.BluetoothRepositoryImpl;
 import com.android.systemui.statusbar.policy.data.repository.DeviceProvisioningRepositoryModule;
-import com.android.systemui.statusbar.policy.data.repository.ZenModeRepositoryModule;
 
 import dagger.Binds;
 import dagger.Module;
@@ -84,7 +83,7 @@
 import javax.inject.Named;
 
 /** Dagger Module for code in the statusbar.policy package. */
-@Module(includes = { DeviceProvisioningRepositoryModule.class, ZenModeRepositoryModule.class })
+@Module(includes = {DeviceProvisioningRepositoryModule.class})
 public interface StatusBarPolicyModule {
 
     String DEVICE_STATE_ROTATION_LOCK_DEFAULTS = "DEVICE_STATE_ROTATION_LOCK_DEFAULTS";
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/data/repository/ZenModeRepository.kt b/packages/SystemUI/src/com/android/systemui/statusbar/policy/data/repository/ZenModeRepository.kt
deleted file mode 100644
index 94ab58a..0000000
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/data/repository/ZenModeRepository.kt
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.statusbar.policy.data.repository
-
-import android.app.NotificationManager
-import com.android.systemui.common.coroutine.ConflatedCallbackFlow.conflatedCallbackFlow
-import com.android.systemui.statusbar.policy.ZenModeController
-import dagger.Binds
-import dagger.Module
-import javax.inject.Inject
-import kotlinx.coroutines.channels.awaitClose
-import kotlinx.coroutines.flow.Flow
-
-/**
- * A repository that holds information about the status and configuration of Zen Mode (or Do Not
- * Disturb/DND Mode).
- */
-interface ZenModeRepository {
-    val zenMode: Flow<Int>
-    val consolidatedNotificationPolicy: Flow<NotificationManager.Policy?>
-}
-
-class ZenModeRepositoryImpl
-@Inject
-constructor(
-    private val zenModeController: ZenModeController,
-) : ZenModeRepository {
-    // TODO(b/308591859): ZenModeController should use flows instead of callbacks. The
-    // conflatedCallbackFlows here should be replaced eventually, see:
-    // https://docs.google.com/document/d/1gAiuYupwUAFdbxkDXa29A4aFNu7XoCd7sCIk31WTnHU/edit?resourcekey=0-J4ZBiUhLhhQnNobAcI2vIw
-
-    override val zenMode: Flow<Int> = conflatedCallbackFlow {
-        val callback =
-            object : ZenModeController.Callback {
-                override fun onZenChanged(zen: Int) {
-                    trySend(zen)
-                }
-            }
-        zenModeController.addCallback(callback)
-        trySend(zenModeController.zen)
-
-        awaitClose { zenModeController.removeCallback(callback) }
-    }
-
-    override val consolidatedNotificationPolicy: Flow<NotificationManager.Policy?> =
-        conflatedCallbackFlow {
-            val callback =
-                object : ZenModeController.Callback {
-                    override fun onConsolidatedPolicyChanged(policy: NotificationManager.Policy?) {
-                        trySend(policy)
-                    }
-                }
-            zenModeController.addCallback(callback)
-            trySend(zenModeController.consolidatedPolicy)
-
-            awaitClose { zenModeController.removeCallback(callback) }
-        }
-}
-
-@Module
-interface ZenModeRepositoryModule {
-    @Binds fun bindImpl(impl: ZenModeRepositoryImpl): ZenModeRepository
-}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/domain/interactor/ZenModeInteractor.kt b/packages/SystemUI/src/com/android/systemui/statusbar/policy/domain/interactor/ZenModeInteractor.kt
index ae31851..f5d7d00 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/domain/interactor/ZenModeInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/domain/interactor/ZenModeInteractor.kt
@@ -17,7 +17,7 @@
 package com.android.systemui.statusbar.policy.domain.interactor
 
 import android.provider.Settings
-import com.android.systemui.statusbar.policy.data.repository.ZenModeRepository
+import com.android.settingslib.statusbar.notification.data.repository.ZenModeRepository
 import javax.inject.Inject
 import kotlinx.coroutines.flow.Flow
 import kotlinx.coroutines.flow.combine
@@ -30,9 +30,9 @@
  */
 class ZenModeInteractor @Inject constructor(repository: ZenModeRepository) {
     val isZenModeEnabled: Flow<Boolean> =
-        repository.zenMode
+        repository.globalZenMode
             .map {
-                when (it) {
+                when (it ?: Settings.Global.ZEN_MODE_OFF) {
                     Settings.Global.ZEN_MODE_ALARMS -> true
                     Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS -> true
                     Settings.Global.ZEN_MODE_NO_INTERRUPTIONS -> true
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/data/repository/ZenModeRepositoryImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/data/repository/ZenModeRepositoryImplTest.kt
deleted file mode 100644
index 004f679..0000000
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/data/repository/ZenModeRepositoryImplTest.kt
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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.
- */
-
-@file:OptIn(ExperimentalCoroutinesApi::class)
-
-package com.android.systemui.statusbar.policy.data.repository
-
-import android.app.NotificationManager
-import android.provider.Settings
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import androidx.test.filters.SmallTest
-import com.android.systemui.SysuiTestCase
-import com.android.systemui.coroutines.collectLastValue
-import com.android.systemui.statusbar.policy.ZenModeController
-import com.android.systemui.util.mockito.whenever
-import com.android.systemui.util.mockito.withArgCaptor
-import com.google.common.truth.Truth.assertThat
-import kotlinx.coroutines.ExperimentalCoroutinesApi
-import kotlinx.coroutines.test.runCurrent
-import kotlinx.coroutines.test.runTest
-import org.junit.Before
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.mockito.Mock
-import org.mockito.Mockito
-import org.mockito.MockitoAnnotations
-
-@SmallTest
-@RunWith(AndroidJUnit4::class)
-class ZenModeRepositoryImplTest : SysuiTestCase() {
-    @Mock lateinit var zenModeController: ZenModeController
-
-    lateinit var underTest: ZenModeRepositoryImpl
-
-    private val testPolicy = NotificationManager.Policy(0, 1, 0)
-
-    @Before
-    fun setUp() {
-        MockitoAnnotations.initMocks(this)
-        underTest = ZenModeRepositoryImpl(zenModeController)
-    }
-
-    @Test
-    fun zenMode_reflectsCurrentControllerState() = runTest {
-        whenever(zenModeController.zen).thenReturn(Settings.Global.ZEN_MODE_NO_INTERRUPTIONS)
-        val zenMode by collectLastValue(underTest.zenMode)
-        assertThat(zenMode).isEqualTo(Settings.Global.ZEN_MODE_NO_INTERRUPTIONS)
-    }
-
-    @Test
-    fun zenMode_updatesWhenControllerStateChanges() = runTest {
-        val zenMode by collectLastValue(underTest.zenMode)
-        runCurrent()
-        whenever(zenModeController.zen).thenReturn(Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS)
-        withArgCaptor { Mockito.verify(zenModeController).addCallback(capture()) }
-            .onZenChanged(Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS)
-        assertThat(zenMode).isEqualTo(Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS)
-    }
-
-    @Test
-    fun policy_reflectsCurrentControllerState() {
-        runTest {
-            whenever(zenModeController.consolidatedPolicy).thenReturn(testPolicy)
-            val policy by collectLastValue(underTest.consolidatedNotificationPolicy)
-            assertThat(policy).isEqualTo(testPolicy)
-        }
-    }
-
-    @Test
-    fun policy_updatesWhenControllerStateChanges() = runTest {
-        val policy by collectLastValue(underTest.consolidatedNotificationPolicy)
-        runCurrent()
-        whenever(zenModeController.consolidatedPolicy).thenReturn(testPolicy)
-        withArgCaptor { Mockito.verify(zenModeController).addCallback(capture()) }
-            .onConsolidatedPolicyChanged(testPolicy)
-        assertThat(policy).isEqualTo(testPolicy)
-    }
-}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/domain/interactor/ZenModeInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/domain/interactor/ZenModeInteractorTest.kt
deleted file mode 100644
index 8981009..0000000
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/domain/interactor/ZenModeInteractorTest.kt
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * 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.statusbar.policy.domain.interactor
-
-import android.app.NotificationManager.Policy
-import android.provider.Settings
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import androidx.test.filters.SmallTest
-import com.android.systemui.SysUITestComponent
-import com.android.systemui.SysUITestModule
-import com.android.systemui.SysuiTestCase
-import com.android.systemui.collectLastValue
-import com.android.systemui.dagger.SysUISingleton
-import com.android.systemui.runCurrent
-import com.android.systemui.runTest
-import com.android.systemui.statusbar.policy.data.repository.FakeZenModeRepository
-import com.android.systemui.user.domain.UserDomainLayerModule
-import com.google.common.truth.Truth.assertThat
-import dagger.BindsInstance
-import dagger.Component
-import org.junit.Test
-import org.junit.runner.RunWith
-
-@SmallTest
-@RunWith(AndroidJUnit4::class)
-class ZenModeInteractorTest : SysuiTestCase() {
-    @SysUISingleton
-    @Component(
-        modules =
-            [
-                SysUITestModule::class,
-                UserDomainLayerModule::class,
-            ]
-    )
-    interface TestComponent : SysUITestComponent<ZenModeInteractor> {
-
-        val repository: FakeZenModeRepository
-
-        @Component.Factory
-        interface Factory {
-            fun create(@BindsInstance test: SysuiTestCase): TestComponent
-        }
-    }
-
-    private val testComponent: TestComponent =
-        DaggerZenModeInteractorTest_TestComponent.factory().create(test = this)
-
-    @Test
-    fun testIsZenModeEnabled_off() =
-        testComponent.runTest {
-            val enabled by collectLastValue(underTest.isZenModeEnabled)
-
-            repository.zenMode.value = Settings.Global.ZEN_MODE_OFF
-            runCurrent()
-
-            assertThat(enabled).isFalse()
-        }
-
-    @Test
-    fun testIsZenModeEnabled_alarms() =
-        testComponent.runTest {
-            val enabled by collectLastValue(underTest.isZenModeEnabled)
-
-            repository.zenMode.value = Settings.Global.ZEN_MODE_ALARMS
-            runCurrent()
-
-            assertThat(enabled).isTrue()
-        }
-
-    @Test
-    fun testIsZenModeEnabled_importantInterruptions() =
-        testComponent.runTest {
-            val enabled by collectLastValue(underTest.isZenModeEnabled)
-
-            repository.zenMode.value = Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS
-            runCurrent()
-
-            assertThat(enabled).isTrue()
-        }
-
-    @Test
-    fun testIsZenModeEnabled_noInterruptions() =
-        testComponent.runTest {
-            val enabled by collectLastValue(underTest.isZenModeEnabled)
-
-            repository.zenMode.value = Settings.Global.ZEN_MODE_NO_INTERRUPTIONS
-            runCurrent()
-
-            assertThat(enabled).isTrue()
-        }
-
-    @Test
-    fun testIsZenModeEnabled_unknown() =
-        testComponent.runTest {
-            val enabled by collectLastValue(underTest.isZenModeEnabled)
-
-            repository.zenMode.value = 4 // this should fail if we ever add another zen mode type
-            runCurrent()
-
-            assertThat(enabled).isFalse()
-        }
-
-    @Test
-    fun testAreNotificationsHiddenInShade_noPolicy() =
-        testComponent.runTest {
-            val hidden by collectLastValue(underTest.areNotificationsHiddenInShade)
-
-            repository.consolidatedNotificationPolicy.value = null
-            repository.zenMode.value = Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS
-            runCurrent()
-
-            assertThat(hidden).isFalse()
-        }
-
-    @Test
-    fun testAreNotificationsHiddenInShade_zenOffShadeSuppressed() =
-        testComponent.runTest {
-            val hidden by collectLastValue(underTest.areNotificationsHiddenInShade)
-
-            repository.setSuppressedVisualEffects(Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST)
-            repository.zenMode.value = Settings.Global.ZEN_MODE_OFF
-            runCurrent()
-
-            assertThat(hidden).isFalse()
-        }
-
-    @Test
-    fun testAreNotificationsHiddenInShade_zenOnShadeNotSuppressed() =
-        testComponent.runTest {
-            val hidden by collectLastValue(underTest.areNotificationsHiddenInShade)
-
-            repository.setSuppressedVisualEffects(Policy.SUPPRESSED_EFFECT_STATUS_BAR)
-            repository.zenMode.value = Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS
-            runCurrent()
-
-            assertThat(hidden).isFalse()
-        }
-
-    @Test
-    fun testAreNotificationsHiddenInShade_zenOnShadeSuppressed() =
-        testComponent.runTest {
-            val hidden by collectLastValue(underTest.areNotificationsHiddenInShade)
-
-            repository.setSuppressedVisualEffects(Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST)
-            repository.zenMode.value = Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS
-            runCurrent()
-
-            assertThat(hidden).isTrue()
-        }
-}
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/data/NotificationsDataKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/data/NotificationsDataKosmos.kt
deleted file mode 100644
index a61f7ec..0000000
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/data/NotificationsDataKosmos.kt
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2024 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.statusbar.notification.data
-
-import com.android.settingslib.statusbar.notification.data.repository.FakeNotificationsSoundPolicyRepository
-import com.android.systemui.kosmos.Kosmos
-
-val Kosmos.notificationsSoundPolicyRepository by
-    Kosmos.Fixture { FakeNotificationsSoundPolicyRepository() }
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationsSoundPolicyInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationsSoundPolicyInteractorKosmos.kt
index 0614309..e6ca458 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationsSoundPolicyInteractorKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationsSoundPolicyInteractorKosmos.kt
@@ -16,12 +16,9 @@
 
 package com.android.systemui.statusbar.notification.domain.interactor
 
-import com.android.settingslib.statusbar.notification.data.repository.FakeNotificationsSoundPolicyRepository
 import com.android.settingslib.statusbar.notification.domain.interactor.NotificationsSoundPolicyInteractor
 import com.android.systemui.kosmos.Kosmos
-
-var Kosmos.notificationsSoundPolicyRepository by
-    Kosmos.Fixture { FakeNotificationsSoundPolicyRepository() }
+import com.android.systemui.statusbar.policy.data.repository.zenModeRepository
 
 val Kosmos.notificationsSoundPolicyInteractor: NotificationsSoundPolicyInteractor by
-    Kosmos.Fixture { NotificationsSoundPolicyInteractor(notificationsSoundPolicyRepository) }
+    Kosmos.Fixture { NotificationsSoundPolicyInteractor(zenModeRepository) }
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/policy/data/FakeStatusBarPolicyDataLayerModule.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/policy/data/FakeStatusBarPolicyDataLayerModule.kt
index 16dab40..5aece1b 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/policy/data/FakeStatusBarPolicyDataLayerModule.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/policy/data/FakeStatusBarPolicyDataLayerModule.kt
@@ -16,14 +16,7 @@
 package com.android.systemui.statusbar.policy.data
 
 import com.android.systemui.statusbar.policy.data.repository.FakeDeviceProvisioningRepositoryModule
-import com.android.systemui.statusbar.policy.data.repository.FakeZenModeRepositoryModule
 import dagger.Module
 
-@Module(
-    includes =
-        [
-            FakeDeviceProvisioningRepositoryModule::class,
-            FakeZenModeRepositoryModule::class,
-        ]
-)
+@Module(includes = [FakeDeviceProvisioningRepositoryModule::class])
 object FakeStatusBarPolicyDataLayerModule
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/policy/data/repository/FakeZenModeRepository.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/policy/data/repository/FakeZenModeRepository.kt
deleted file mode 100644
index c4d7867..0000000
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/policy/data/repository/FakeZenModeRepository.kt
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.statusbar.policy.data.repository
-
-import android.app.NotificationManager.Policy
-import android.provider.Settings
-import com.android.systemui.dagger.SysUISingleton
-import dagger.Binds
-import dagger.Module
-import javax.inject.Inject
-import kotlinx.coroutines.flow.MutableStateFlow
-
-@SysUISingleton
-class FakeZenModeRepository @Inject constructor() : ZenModeRepository {
-    override val zenMode: MutableStateFlow<Int> = MutableStateFlow(Settings.Global.ZEN_MODE_OFF)
-    override val consolidatedNotificationPolicy: MutableStateFlow<Policy?> =
-        MutableStateFlow(
-            Policy(
-                /* priorityCategories = */ 0,
-                /* priorityCallSenders = */ 0,
-                /* priorityMessageSenders = */ 0,
-            )
-        )
-
-    fun setSuppressedVisualEffects(suppressedVisualEffects: Int) {
-        consolidatedNotificationPolicy.value =
-            Policy(
-                /* priorityCategories = */ 0,
-                /* priorityCallSenders = */ 0,
-                /* priorityMessageSenders = */ 0,
-                /* suppressedVisualEffects = */ suppressedVisualEffects,
-            )
-    }
-}
-
-@Module
-interface FakeZenModeRepositoryModule {
-    @Binds fun bindFake(fake: FakeZenModeRepository): ZenModeRepository
-}
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/policy/data/repository/ZenModeRepositoryKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/policy/data/repository/ZenModeRepositoryKosmos.kt
index 1ec7511..c7fda54 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/policy/data/repository/ZenModeRepositoryKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/policy/data/repository/ZenModeRepositoryKosmos.kt
@@ -16,6 +16,7 @@
 
 package com.android.systemui.statusbar.policy.data.repository
 
+import com.android.settingslib.statusbar.notification.data.repository.FakeZenModeRepository
 import com.android.systemui.kosmos.Kosmos
 import com.android.systemui.kosmos.Kosmos.Fixture