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

Skip to content
Commit 76a10167 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[SB][Screen Chips] Always maintain media projection callback order.

This fixes b/352483752. In this bug, an #onRecordingSessionSet event
came in, and then an #onStop event came in very soon after. Because
onRecordingSessionSet has to do some background work before emitting but
onStop doesn't, the repository was actually emitting the stopped event
*first* and the session event *second*, even though the callback events
came in the opposite order.

This CL instead has all callback events immediately emit, and then uses
a `mapLatest` to perform that extra background work for
onRecordingSessionSet. The `mapLatest` will ensure that if an onStop
event comes in while we're still performing background work for
onRecordingSessionSet, that background work will get cancelled and only
the stop event will be emitted.

Fixes: 352483752
Bug: 332662551

Flag: com.android.systemui.status_bar_screen_sharing_chips
Flag: com.android.systemui.pss_task_switcher

(Note on flag stanzas: This repository is used by two features, each
guarded by one of those flags)

Test: atest MediaProjectionManagerRepositoryTest (verified new test
failed before changes, and passes after)

Change-Id: I15d09beec744515c09a49122d4ece37cc4007ca9
parent 5df43f2f
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