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

Commit 98a0d855 authored by Fabián Kozynski's avatar Fabián Kozynski
Browse files

Don't draw QS if not visible

When QS changes visibility state (particularly in the lock screen),
there's a frame where the state of the clipping and the drawing of the
ComposeView are out of sync. In order to address this, as we know that
nothing from QS should show when qs is not visible, just don't draw it.

Test: manual, open/close shade in lockscreen
Test: manual, open split shade
Fixes: 404575233
Flag: com.android.systemui.qs_ui_refactor_compose_fragment
Change-Id: I61566431d02330585e2057b2dcd518ac86e58d7e
parent c4757391
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -472,6 +472,7 @@ constructor(
    }

    override fun setQsVisible(qsVisible: Boolean) {
        containerView?.qsVisible = qsVisible
        viewModel.isQsVisible = qsVisible
    }

@@ -1154,6 +1155,14 @@ private class FrameLayoutTouchPassthrough(
            }
        }

    var qsVisible: Boolean = false
        set(value) {
            if (value != field) {
                field = value
                invalidate()
            }
        }

    private var dirtyClipData = false

    private val clipEnabled
@@ -1192,8 +1201,14 @@ private class FrameLayoutTouchPassthrough(
            canvas.clipOutPath(currentClippingPath)
            canvas.translate(0f, translationY)
        }
        if (qsVisible) {
            // If QS should not be visible, there's no need to draw this tree at all. We do this
            // in the view (instead of in compose) so it's completely synchronized with the clip.
            // As this FrameLayout doesn't have any content, and the ComposeView is the only child,
            // this is equivalent to blocking the draw in `drawChild`.
            super.dispatchDraw(canvas)
        }
    }

    override fun isTransformedTouchPointInView(
        x: Float,