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

Commit dd33be25 authored by András Kurucz's avatar András Kurucz
Browse files

[Flexiglass] Fix FooterView flicker when expanding/collapsing DualShade

During the expansion of the DualShade panel, the height of the stack and
the draw bounds are animated synchronously, but when we reach the
overshoot effect, there is a point where the StackScrollAlgorithm thinks
that there is no space for the FooterView. This is causing a visual
flicker.

Fix this by ignoring _SSA noFooterView_ updates until an expansion is in
progress.

Fixes: 436760595
Test: open DualShade by scrolling, with a fling, fastly, slowly, etc.
Flag: com.android.systemui.scene_container
Change-Id: I869171684bc5c8f0e35c00794048a8c6255d694d
parent 29cad33d
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -1110,6 +1110,21 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() {
        assertThat((footerView.viewState as FooterViewState).hideContent).isTrue()
    }

    @Test
    @EnableSceneContainer
    fun resetViewStates_noSpaceForFooterDuringExpansion_footerShown_withSceneContainer() {
        ambientState.isShadeExpanded = true
        ambientState.isExpansionChanging = true
        ambientState.stackTop = 0f
        ambientState.drawBounds = RectF(0f, 0f, 400f, 100f)
        val footerView = mockFooterView(height = 200) // no space for the footer in the stack
        hostView.addView(footerView)

        stackScrollAlgorithm.resetViewStates(ambientState, 0)

        assertThat((footerView.viewState as FooterViewState).hideContent).isFalse()
    }

    @Test
    fun resetViewStates_clearAllInProgress_hasNonClearableRow_footerVisible() {
        whenever(notificationRow.canViewBeCleared()).thenReturn(false)
+8 −6
Original line number Diff line number Diff line
@@ -714,12 +714,14 @@ public class StackScrollAlgorithm {
        );
        if (view instanceof FooterView) {
            if (SceneContainerFlag.isEnabled()) {
                if (!ambientState.isExpansionChanging()) {
                    final float footerEnd =
                            stackTop + viewState.getYTranslation() + view.getIntrinsicHeight();
                    final boolean noSpaceForFooter = footerEnd > ambientState.getStackCutoff();
                    ((FooterView.FooterViewState) viewState).hideContent =
                            noSpaceForFooter || (ambientState.isClearAllInProgress()
                                    && !hasNonClearableNotifs(algorithmState));
                }
            } else {
                // TODO(b/333445519): shouldBeHidden should reflect whether the shade is closed
                //  already, so we shouldn't need to use ambientState here. However,