Add conflate to the sudio tream flow so it doesn't get overwhelmed by the old
changes
Flag: aconfig new_volume_panel TEAMFOOD
Test: atest AudioInteractorTest
Test: manual on the phone
Bug: 329640818
Change-Id: I1103b87c715aa16d3bfb5d742d233a2d493293d8
diff --git a/packages/SettingsLib/src/com/android/settingslib/volume/data/repository/AudioRepository.kt b/packages/SettingsLib/src/com/android/settingslib/volume/data/repository/AudioRepository.kt
index 21cc9a8..6730aad 100644
--- a/packages/SettingsLib/src/com/android/settingslib/volume/data/repository/AudioRepository.kt
+++ b/packages/SettingsLib/src/com/android/settingslib/volume/data/repository/AudioRepository.kt
@@ -34,6 +34,7 @@
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.callbackFlow
+import kotlinx.coroutines.flow.conflate
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.filterIsInstance
import kotlinx.coroutines.flow.filterNotNull
@@ -134,6 +135,7 @@
}
.map { getCurrentAudioStream(audioStream) }
.onStart { emit(getCurrentAudioStream(audioStream)) }
+ .conflate()
.flowOn(backgroundCoroutineContext)
}