[SB][Screen Chips] Add view models for share-to-app and cast-to-other.
The MediaProjectionChipInteractor is currently handling two different
kinds of chips (share-to-app and cast-to-other-device), and also has
some UI-specific logic like how to display a dialog when the chip is
tapped (which violates clean architecture principles).
This CL fixes both those issues by adding two new view models:
- ShareToAppChipViewModel
- CastToOtherDeviceViewModel
Each view model listens to MediaProjectionChipInteractor, and handles
the display for *only* their type of chip. This solves our clean
architecture problem and helps distinguish these two cases in code more
clearly.
Note that this does create a diamond in our flow graph:
ShareToAppVM
MediaProjIntr ---< >-- OngoingActivityChipsVM
CastToOtherVM
I don't think this will be a problem because only one branch can ever be
active at once.
This will also be useful later, because the cast-to-other-device events
can come from two different sources (MediaProjection and MediaRouter).
Splitting cast-to-other-device into its own class up now will make it
easier to add in the MediaRouter datasource later.
Future CLs will add view models for the call chip and screen record
chip so the structure is the same for all chip types.
Bug: 332662551
Flag: com.android.systemui.status_bar_screen_sharing_chips
Test: verify share-to-app chip still works
Test: verify cast-to-other-device chip still works
Test: all tests in statusbar.chips
Change-Id: I1bd2cc89447b76421fb4126d054beaecc278a81e
Loading
Please register or sign in to comment