Fixed a bug where the media entries are invisible after switching users
Because the list was only cleared after notifying the listeners, their checks if we still have active players was using an old state. Bug: 158367094 Test: add media, switch users Change-Id: I524cadfd02967e7bd017ebf4cee2beb5bfaef26d
This commit is contained in:
@@ -193,12 +193,15 @@ class MediaDataManager(
|
||||
private fun clearData() {
|
||||
// Called on user change. Remove all current MediaData objects and inform listeners
|
||||
val listenersCopy = listeners.toSet()
|
||||
mediaEntries.forEach {
|
||||
val keyCopy = mediaEntries.keys.toMutableList()
|
||||
// Clear the list first, to make sure callbacks from listeners if we have any entries
|
||||
// are up to date
|
||||
mediaEntries.clear()
|
||||
keyCopy.forEach {
|
||||
listenersCopy.forEach { listener ->
|
||||
listener.onMediaDataRemoved(it.key)
|
||||
listener.onMediaDataRemoved(it)
|
||||
}
|
||||
}
|
||||
mediaEntries.clear()
|
||||
}
|
||||
|
||||
private fun removeAllForPackage(packageName: String) {
|
||||
|
||||
Reference in New Issue
Block a user