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

Skip to content
Commit 584ee44d authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[SB][Screen Chips] Don't let the timers reset on theme change.

b/347726238 was happening because: When the theme changes,
CollapsedStatusBarFragment reattaches its views, which means that
CollapsedStatusBarViewBinder stopped listening to flows and then started
listening to flows again. Because all of the chip-related flows were
`WhileSubscribed`, the flows stopped and then started again. When they
re-started, the ongoing event was re-sent from the repositories and we
re-calculated what the start time should be (because we just use the
current time as the start time).

This CL updates the main chips flow to use `SharingStarted.Lazily`,
which will start the flow once a subscriber appears but then never
_stops_ the flow. That means all the upstream flows also won't stop, so
they won't re-calculate the start time.

This CL also updates each individual chip flow to use `Lazily`. That
isn't strictly necessary (the downstream `chip` flow using `Lazily`
guarantees that the upstream ones are), but it seemed good to protect
the individual flows, and also put the bug reference closer to where the
timer start times are actually created.

Fixes: 347726238
Bug: 332662551
Flag: com.android.systemui.status_bar_screen_sharing_chips

Test: Start a screen recording -> change theme -> verify time in screen
recording chip doesn't reset
Test: atest OngoingActivityChipsViewModelTest

Change-Id: I8ae07863c0f52f3e4c0175e9eb6fbdede4d08d74
parent 247f35ac
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment