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

Commit fd2e2c28 authored by Michael Mikhail's avatar Michael Mikhail
Browse files

Show QS footer background when QS starts to show.

Fading in the QS footer starts at the end of QS expansion animation.
This makes the UMO flick. Adjusting the delay of showing the QS footer
background to start after the QS starts to show fixes the issue and
avoids the occurance of b/240563302.

Flag: NONE
Bug: 300369748
Test: atest FooterActionsViewModelTest.
Test: Checked UI, make sure the flicks effects doesn't show and we avoid b/240563302 as well.
Change-Id: I4abe6517f4ed52f0e85d0d03b532920482cd1b5c
parent a1766937
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -88,9 +88,9 @@ class FooterActionsViewModel(
    /** Called when the expansion of the Quick Settings changed. */
    fun onQuickSettingsExpansionChanged(expansion: Float, isInSplitShade: Boolean) {
        if (isInSplitShade) {
            // In split shade, we want to fade in the background only at the very end (see
            // b/240563302).
            val delay = 0.99f
            // In split shade, we want to fade in the background when the QS background starts to
            // show.
            val delay = 0.15f
            _alpha.value = expansion
            _backgroundAlpha.value = max(0f, expansion - delay) / (1f - delay)
        } else {
+5 −5
Original line number Diff line number Diff line
@@ -393,23 +393,23 @@ class FooterActionsViewModelTest : SysuiTestCase() {
    }

    @Test
    fun backgroundAlpha_inSplitShade_followsExpansion_with_0_99_delay() {
    fun backgroundAlpha_inSplitShade_followsExpansion_with_0_15_delay() {
        val underTest = utils.footerActionsViewModel()
        val floatTolerance = 0.01f

        underTest.onQuickSettingsExpansionChanged(0f, isInSplitShade = true)
        assertThat(underTest.backgroundAlpha.value).isEqualTo(0f)

        underTest.onQuickSettingsExpansionChanged(0.5f, isInSplitShade = true)
        underTest.onQuickSettingsExpansionChanged(0.1f, isInSplitShade = true)
        assertThat(underTest.backgroundAlpha.value).isEqualTo(0f)

        underTest.onQuickSettingsExpansionChanged(0.9f, isInSplitShade = true)
        underTest.onQuickSettingsExpansionChanged(0.14f, isInSplitShade = true)
        assertThat(underTest.backgroundAlpha.value).isEqualTo(0f)

        underTest.onQuickSettingsExpansionChanged(0.991f, isInSplitShade = true)
        underTest.onQuickSettingsExpansionChanged(0.235f, isInSplitShade = true)
        assertThat(underTest.backgroundAlpha.value).isWithin(floatTolerance).of(0.1f)

        underTest.onQuickSettingsExpansionChanged(0.995f, isInSplitShade = true)
        underTest.onQuickSettingsExpansionChanged(0.575f, isInSplitShade = true)
        assertThat(underTest.backgroundAlpha.value).isWithin(floatTolerance).of(0.5f)

        underTest.onQuickSettingsExpansionChanged(1f, isInSplitShade = true)