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

Commit 1cc196a9 authored by Matt Pietal's avatar Matt Pietal
Browse files

Optimize animation flows

As more code uses keyguard transition animations, more and more
continuations are piling up on the main thread, with that vast
majority of them rerunning the same Flow over and over.

This introduces intermediate SharedFlows in
KeyguardTransitionAnimationFlow. Each transition is an Edge in the
graph, and each Edge now has a dedicated SharedFlow object on which
they can collect very specific events.

Bug: 318582599
Test: atest com.android.systemui.keyguard.ui
Flag: N/A - Fixes baseline jank issues

Change-Id: I5f9ec5f52e36e86b640f21924c874c7d0e70fc55
parent a5dcf9e3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ class AlternateBouncerToAodTransitionViewModelTest : SysuiTestCase() {
                testScope,
            )

            assertThat(values.size).isEqualTo(5)
            assertThat(values.size).isEqualTo(6)
            values.forEach { assertThat(it).isIn(Range.closed(0f, 1f)) }
        }

+3 −3
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() {
                testScope,
            )

            assertThat(values.size).isEqualTo(6)
            assertThat(values.size).isEqualTo(7)
            values.forEach { assertThat(it).isIn(Range.closed(0f, 100f)) }
        }

@@ -117,7 +117,7 @@ class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() {
                testScope,
            )

            assertThat(values.size).isEqualTo(3)
            assertThat(values.size).isEqualTo(4)
            values.forEach { assertThat(it).isIn(Range.closed(0f, 1f)) }
        }

@@ -232,7 +232,7 @@ class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() {
                testScope,
            )

            assertThat(values.size).isEqualTo(4)
            assertThat(values.size).isEqualTo(5)
            values.forEach { assertThat(it).isIn(Range.closed(-100f, 0f)) }
        }

+3 −3
Original line number Diff line number Diff line
@@ -59,9 +59,9 @@ class GoneToDreamingTransitionViewModelTest : SysuiTestCase() {
                testScope,
            )

            // Only three values should be present, since the dream overlay runs for a small
            // Only five values should be present, since the dream overlay runs for a small
            // fraction of the overall animation time
            assertThat(values.size).isEqualTo(4)
            assertThat(values.size).isEqualTo(5)
            values.forEach { assertThat(it).isIn(Range.closed(0f, 1f)) }
        }

@@ -84,7 +84,7 @@ class GoneToDreamingTransitionViewModelTest : SysuiTestCase() {
                testScope,
            )

            assertThat(values.size).isEqualTo(4)
            assertThat(values.size).isEqualTo(5)
            values.forEach { assertThat(it).isIn(Range.closed(0f, 100f)) }
        }

+4 −4
Original line number Diff line number Diff line
@@ -73,9 +73,9 @@ class LockscreenToDreamingTransitionViewModelTest : SysuiTestCase() {
                testScope = testScope,
            )

            // Only three values should be present, since the dream overlay runs for a small
            // Only five values should be present, since the dream overlay runs for a small
            // fraction of the overall animation time
            assertThat(values.size).isEqualTo(4)
            assertThat(values.size).isEqualTo(5)
            values.forEach { assertThat(it).isIn(Range.closed(0f, 1f)) }
        }

@@ -98,10 +98,10 @@ class LockscreenToDreamingTransitionViewModelTest : SysuiTestCase() {
                testScope = testScope,
            )

            assertThat(values.size).isEqualTo(5)
            assertThat(values.size).isEqualTo(6)
            values.forEach { assertThat(it).isIn(Range.closed(0f, 100f)) }
            // Validate finished value
            assertThat(values[4]).isEqualTo(0f)
            assertThat(values[5]).isEqualTo(0f)
        }

    @Test
+2 −2
Original line number Diff line number Diff line
@@ -74,9 +74,9 @@ class LockscreenToOccludedTransitionViewModelTest : SysuiTestCase() {
                    ),
                testScope = testScope,
            )
            // Only 3 values should be present, since the dream overlay runs for a small fraction
            // Only 5 values should be present, since the dream overlay runs for a small fraction
            // of the overall animation time
            assertThat(values.size).isEqualTo(4)
            assertThat(values.size).isEqualTo(5)
            values.forEach { assertThat(it).isIn(Range.closed(0f, 1f)) }
        }

Loading