summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Beth Thibodeau <ethibodeau@google.com> 2020-06-02 16:41:42 -0400
committer Beth Thibodeau <ethibodeau@google.com> 2020-06-02 16:41:42 -0400
commit4335c023ca1298245edcfd9448d4e681eccd46fb (patch)
tree91cd4ef48cd78543ec1b1575bc24a9bba4969323
parent005ce7cae6c6f2fe97858eecd39092f16a92765b (diff)
Fix CME in MediaDataCombineListener
Same issue as in ag/11604129 Fixes: 157858313 Test: atest SystemUITests Change-Id: I301e22c322050605d12a2dcd2452a63fbc841f06
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/MediaDataCombineLatest.kt6
1 files changed, 4 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaDataCombineLatest.kt b/packages/SystemUI/src/com/android/systemui/media/MediaDataCombineLatest.kt
index cce9838bb8e2..67cf21ae10b9 100644
--- a/packages/SystemUI/src/com/android/systemui/media/MediaDataCombineLatest.kt
+++ b/packages/SystemUI/src/com/android/systemui/media/MediaDataCombineLatest.kt
@@ -65,7 +65,8 @@ class MediaDataCombineLatest @Inject constructor(
val (entry, device) = entries[key] ?: null to null
if (entry != null && device != null) {
val data = entry.copy(device = device)
- listeners.forEach {
+ val listenersCopy = listeners.toSet()
+ listenersCopy.forEach {
it.onMediaDataLoaded(key, data)
}
}
@@ -73,7 +74,8 @@ class MediaDataCombineLatest @Inject constructor(
private fun remove(key: String) {
entries.remove(key)?.let {
- listeners.forEach {
+ val listenersCopy = listeners.toSet()
+ listenersCopy.forEach {
it.onMediaDataRemoved(key)
}
}