Media - Don't clear unless active flag is false

Previously, paused players without the resumption setting would've
removed the player. Don't do it unlesss it is also inactive, due to
timeout or swiping.

Fixes: 169311198
Test: Manual, set resumption off and pause a player
Change-Id: I6d8ec2533528017cfb28e30028b975452df808c7
(cherry picked from commit 24993c6ee7)
This commit is contained in:
Matt Pietal
2020-09-24 08:17:16 -04:00
parent 3b6bdffa44
commit 4895f71528

View File

@@ -174,7 +174,7 @@ class MediaCarouselController @Inject constructor(
mediaManager.addListener(object : MediaDataManager.Listener {
override fun onMediaDataLoaded(key: String, oldKey: String?, data: MediaData) {
addOrUpdatePlayer(key, oldKey, data)
val canRemove = data.isPlaying?.let { !it } ?: data.isClearable
val canRemove = data.isPlaying?.let { !it } ?: data.isClearable && !data.active
if (canRemove && !Utils.useMediaResumption(context)) {
// This view isn't playing, let's remove this! This happens e.g when
// dismissing/timing out a view. We still have the data around because