• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..25-May-2024-

common/H25-May-2024-197131

receiver/H25-May-2024-886603

sender/H25-May-2024-906552

MediaTttCommandLineHelper.ktH A D25-May-20247.1 KiB196150

MediaTttFlags.ktH A D25-May-20241.3 KiB3411

README.mdH A D25-May-20242.7 KiB4637

README.md

1# Media Tap-To-Transfer
2
3## Overview
4This package (and child packages) include code for the media tap-to-transfer feature, which
5allows users to easily transfer playing media between devices.
6
7In media transfer, there are two devices: the **sender** and the **receiver**. The sender device
8will start and stop media casts to the receiver device. On both devices, System UI will display a
9chip informing the user about the media cast occurring.
10
11**Important**: System UI is **not responsible** for performing the media transfer. System UI
12**only** displays an informational chip; external clients are responsible for performing the media
13transfer and informing System UI about the transfer status.
14
15## Information flow
16External clients notify System UI about the transfer status by calling `@SystemApi`s in
17`StatusBarManager`. For the sender device, use the `updateMediaTapToTransferSenderDisplay` API; for
18the receiver, use the `updateMediaTapToTransferReceiverDisplay` API. The APIs eventually flow into
19SystemUI's `CommandQueue`, which then notifies callbacks about the new state.
20`MediaTttChipControllerSender` implements the sender callback, and `MediaTttChipControllerReceiver`
21implements the receiver callback. These controllers will then show or hide the tap-to-transfer chip
22(depending on what information was sent in the API).
23
24## Architecture
25This package is structured so that the sender code is in the `sender` package, the receiver code is
26in the `receiver` package, and code that's shared between them is in the `common` package.
27
28* The `ChipStateSender` and `ChipStateReceiver` classes are enums that describe all the possible
29  transfer states (transfer started, transfer succeeded, etc.) and include relevant parameters for
30  each state.
31* The `ChipSenderInfo` and `ChipReceiverInfo` classes are simple data classes that contain all the
32  information needed to display a chip. They include the transfer state, information about the media
33  being transferred, etc.
34* The `MediaTttChipControllerSender` and `MediaTttChipControllerReceiver` classes are responsible
35  for showing or hiding the chip and updating the chip view based on information from the
36  `ChipInfo`. `MediaTttChipControllerCommon` has all the common logic for adding and removing the
37  view to the window and also includes any display logic that can be shared between the sender and
38  receiver. The sender and receiver controller subclasses have the display logic that's specific to
39  just the sender or just the receiver.
40
41## Testing
42If you want to test out the tap-to-transfer chip without using the `@SystemApi`s, you can use adb
43commands instead. Refer to `MediaTttCommandLineHelper` for information about adb commands.
44
45TODO(b/245610654): Update this page once the chipbar migration is complete.
46