Merge "notificationBroadcasts shouldn't be a StateFlow" into main
diff --git a/packages/SettingsLib/src/com/android/settingslib/notification/data/repository/ZenModeRepository.kt b/packages/SettingsLib/src/com/android/settingslib/notification/data/repository/ZenModeRepository.kt
index 26b5741..b2fcb5f 100644
--- a/packages/SettingsLib/src/com/android/settingslib/notification/data/repository/ZenModeRepository.kt
+++ b/packages/SettingsLib/src/com/android/settingslib/notification/data/repository/ZenModeRepository.kt
@@ -16,6 +16,7 @@
 
 package com.android.settingslib.notification.data.repository
 
+import android.annotation.SuppressLint
 import android.app.NotificationManager
 import android.app.NotificationManager.EXTRA_NOTIFICATION_POLICY
 import android.content.BroadcastReceiver
@@ -58,6 +59,7 @@
     val modes: Flow<List<ZenMode>>
 }
 
+@SuppressLint("SharedFlowCreation")
 class ZenModeRepositoryImpl(
     private val context: Context,
     private val notificationManager: NotificationManager,
@@ -100,12 +102,11 @@
             }
             .let {
                 if (Flags.volumePanelBroadcastFix()) {
+                    // Share the flow to avoid having multiple broadcasts.
                     it.flowOn(backgroundCoroutineContext)
+                        .shareIn(started = SharingStarted.WhileSubscribed(), scope = scope)
                 } else {
-                    it.shareIn(
-                        started = SharingStarted.WhileSubscribed(),
-                        scope = scope,
-                    )
+                    it.shareIn(started = SharingStarted.WhileSubscribed(), scope = scope)
                 }
             }
     }