The broadcast radio stack consists of the components illustrated in Figure 1.
Radio reference app
For details about how to implement radio control, see Radio control implementation.
A sample Java radio app (packages/apps/Car/Radio
) serves as a reference
implementation. When the app service starts, it requests Radio Manager to open a Radio Tuner. Then,
the app can send requests to the Radio Tuner, such as tuning to a specific radio station, frequency,
or to seek the next available radio station. The app receives updates from the Radio Manager and
Radio Tuner in Radio, such as current program information, radio program lists, configurations, and
vendor-defined parameters. The reference Radio app only supports AM and FM radio. OEMs can modify or
replace the Radio app as desired.
Radio Manager
When the app requests Radio Manager to open a tuner, the Radio Manager
(frameworks/base/core/java/android/hardware/radio/RadioManager.java
) requests the
Broadcast Radio Service (BRS) to open a Tuner session and then wraps the session in a Radio Tuner
(frameworks/base/core/java/android/hardware/radio/RadioTuner.java
), which is returned
to the app.
The Radio Tuner defines APIs (such as tune, step, and cancel) that can be called from radio apps
and send requests to BRS. Callback methods (RadioTuner.Callback
) defined in Radio
Tuner send updates about the broadcast radio HAL, such as current program information, program
lists, and vendor-defined parameters, from the BRS to apps.
Broadcast Radio Service
The Broadcast Radio Service
(frameworks/base/services/core/java/com/android/server/broadcastradio
) is the client
service for Broadcast Radio HAL. The BRS coordinates multiple Radio Managers with Broadcast Radio
HALs. The BRS supports
HAL interface definition language (HIDL) and
Android interface definition language (AIDL) broadcast
radio HALs. The BRS links to the AIDL HAL when any AIDL HAL service exists;
otherwise, the service links to the HIDL HAL. The BRS creates a Radio Module
for each available HAL instance (such as AM, FM, and DAB).
Each Radio Manager can request the BRS to create a tuner session on the corresponding Radio Module, based on the type of radio. Each tuner session can call methods, such as tune, step, and cancel (defined in HAL interfaces) to perform operations on the corresponding broadcast radio HAL instance. When one tuner session receives a callback from the HAL instance on a HAL update, such as current program info, program list, configuration flags and, vendor parameters, callbacks about the update are sent to all Radio Tuners linked to the same Radio Module.
Broadcast Radio HAL
To learn more about the HIDL and AIDL interfaces of broadcast radio and the differences between the two, see Broadcast Radio HAL interface.