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

Commit a11528ec authored by Matt Pietal's avatar Matt Pietal
Browse files

Fix race condition with notif alpha

Sometimes when unlocking via bouncer and not expanding
the shade, the alpha is left at 0f which will prevent
HUN from being visible.

Fixes: 353717873
Test: atest PrimaryBouncerToGoneTransitionViewModelTest
Flag: com.android.systemui.migrate_clocks_to_blueprint
Change-Id: I3dc9a8ce33514be168300298307ddfc24bb22188
parent da8375e5
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -159,8 +159,9 @@ class PrimaryBouncerToGoneTransitionViewModelTest : SysuiTestCase() {
            )

            assertThat(values[0]).isEqualTo(1f)
            // Should fade to zero between here
            assertThat(values[1]).isEqualTo(0f)
            // Should always finish with 1f to show HUNs
            assertThat(values[2]).isEqualTo(1f)
        }

    @Test
@@ -177,7 +178,7 @@ class PrimaryBouncerToGoneTransitionViewModelTest : SysuiTestCase() {
                testScope,
            )

            assertThat(values.size).isEqualTo(2)
            assertThat(values.size).isEqualTo(3)
            // Shade stays open, and alpha should remain visible
            values.forEach { assertThat(it).isEqualTo(1f) }
        }
+6 −4
Original line number Diff line number Diff line
@@ -1096,7 +1096,8 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S
                )
            )
            runCurrent()
            assertThat(alpha).isEqualTo(0f)
            // Resets to 1f after communal scene is hidden
            assertThat(alpha).isEqualTo(1f)
        }

    @Test
@@ -1151,7 +1152,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S
                )
            )
            runCurrent()
            assertThat(alpha).isEqualTo(0f)
            assertThat(alpha).isEqualTo(1f)
        }

    @Test
@@ -1208,7 +1209,8 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S
                )
            )
            runCurrent()
            assertThat(alpha).isEqualTo(0f)
            // Resets to 1f after communal scene is hidden
            assertThat(alpha).isEqualTo(1f)
        }

    @Test
@@ -1263,7 +1265,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S
                )
            )
            runCurrent()
            assertThat(alpha).isEqualTo(0f)
            assertThat(alpha).isEqualTo(1f)
        }

    private suspend fun TestScope.showLockscreen() {
+1 −0
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@ constructor(
                    MathUtils.lerp(startAlpha, 0f, it)
                }
            },
            onFinish = { 1f },
        )
    }

+1 −0
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ constructor(
                    1f - it
                }
            },
            onFinish = { 1f },
        )

    /** Bouncer container alpha */