Fix cliping when the media player is fully clipped off
Previously we didn't clip when at height 0, but we still need to as very often the view ill have height 0. The clipRect should always be up to date. Also, removing inactive players when resumption is off to avoid this completely Fixes: 159414197 Test: turn off resumption, swipe away media, observe no weird clipping Change-Id: I30a2fa4fe19d142c8a6472f8368d64e6ac4074d8
This commit is contained in:
@@ -15,6 +15,7 @@ import com.android.systemui.plugins.FalsingManager
|
||||
import com.android.systemui.qs.PageIndicator
|
||||
import com.android.systemui.statusbar.notification.VisualStabilityManager
|
||||
import com.android.systemui.statusbar.policy.ConfigurationController
|
||||
import com.android.systemui.util.Utils
|
||||
import com.android.systemui.util.animation.UniqueObjectHostView
|
||||
import com.android.systemui.util.animation.requiresRemeasuring
|
||||
import com.android.systemui.util.concurrency.DelayableExecutor
|
||||
@@ -150,8 +151,15 @@ class MediaCarouselController @Inject constructor(
|
||||
mediaManager.addListener(object : MediaDataManager.Listener {
|
||||
override fun onMediaDataLoaded(key: String, oldKey: String?, data: MediaData) {
|
||||
oldKey?.let { mediaData.remove(it) }
|
||||
mediaData.put(key, data)
|
||||
addOrUpdatePlayer(key, oldKey, data)
|
||||
if (!data.active && !Utils.useMediaResumption(context)) {
|
||||
// This view is inactive, let's remove this! This happens e.g when dismissing /
|
||||
// timing out a view. We still have the data around because resumption could
|
||||
// be on, but we should save the resources and release this.
|
||||
onMediaDataRemoved(key)
|
||||
} else {
|
||||
mediaData.put(key, data)
|
||||
addOrUpdatePlayer(key, oldKey, data)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onMediaDataRemoved(key: String) {
|
||||
|
||||
@@ -150,15 +150,10 @@ class TransitionLayout @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
override fun dispatchDraw(canvas: Canvas?) {
|
||||
val clip = !boundsRect.isEmpty
|
||||
if (clip) {
|
||||
canvas?.save()
|
||||
canvas?.clipRect(boundsRect)
|
||||
}
|
||||
canvas?.save()
|
||||
canvas?.clipRect(boundsRect)
|
||||
super.dispatchDraw(canvas)
|
||||
if (clip) {
|
||||
canvas?.restore()
|
||||
}
|
||||
canvas?.restore()
|
||||
}
|
||||
|
||||
private fun updateBounds() {
|
||||
|
||||
Reference in New Issue
Block a user