Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 52302249 authored by Selim Cinek's avatar Selim Cinek
Browse files

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
parent f630a829
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -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,9 +151,16 @@ class MediaCarouselController @Inject constructor(
        mediaManager.addListener(object : MediaDataManager.Listener {
            override fun onMediaDataLoaded(key: String, oldKey: String?, data: MediaData) {
                oldKey?.let { mediaData.remove(it) }
                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) {
                mediaData.remove(key)
+3 −8
Original line number Diff line number Diff line
@@ -150,16 +150,11 @@ class TransitionLayout @JvmOverloads constructor(
    }

    override fun dispatchDraw(canvas: Canvas?) {
        val clip = !boundsRect.isEmpty
        if (clip) {
        canvas?.save()
        canvas?.clipRect(boundsRect)
        }
        super.dispatchDraw(canvas)
        if (clip) {
        canvas?.restore()
    }
    }

    private fun updateBounds() {
        val layoutLeft = left