The Radio UI is implemented as an independent application. Instructions on how to integrate a Radio UI to the radio hardware can be found at Implementing Radio.
The following section describes how to integrate Radio UI with Media to provide users with a seamless experience that enables users to interact with media sources and radio as if they were a single application.
Media source switching user flow
The following diagram illustrates how the reference implementation of Radio and Media implements the application switching user flow.
Figure 1. Media source switching user flow
To provide a seamless transition between Radio and other apps in Media, the
car-media-common library defines Android intents that can be used to launch a media
source selector. In AOSP, this selector is implemented in the App Launcher, presenting the same UI
for launching apps but filtered to display only media sources.
OEMs can opt to take the current App Launcher implementation as is, or implement a customized media source selector.
The selector can act in two modes:
- Normal flow. After using the selector, the selected source is displayed in Media so the user can browse its content.
- As a switch. A selector is used to switch sources, but the media is not displayed to the user. This is true of the Selector icon on the Home Page. After selecting a source, the most recent previous screen is displayed to the user (in this case, the Home page).
The intent used to switch between media sources can be obtained from the
MediaSource#getSourceSelectorIntent() method, which accepts a
Boolean that returns an intent to launch each of the flows described above.
The actual intents are defined at
customize this configuration, use build-time overlays.
Replacing the Radio app
Given that the Radio app implements Media Browse and Media Session, Radio is displayed in the App launcher. To prevent launching Media when a user clicks the icon, two elements are required. Radio must:
- Have a launcher activity.
- Be declared as a custom source. To do so, add the component name to the
UX driving restrictions
Media must observe all UX driving distraction restrictions. To do so, Media must listen to the CarUXRestrictionManager and implement all its policies.
- Media must connect to the Car library and get an instance of CarUXRestrictionManager.
- Media must subscribe to updates in the list of CarUxRestrictions and implement them as documented.
- Particularly important for Media are: