Starting in Android 13, media controls in System UI contain updates to action buttons and remote playback. These changes support a more polished media control experience on phones and tablets, and offer seamless media transfers across devices.
Updates to media controls
This section describes the updates made to media controls in Android 13 for action buttons and remote playback.
Action button changes
To ensure that users can access a rich set of media controls for apps playing
media, action buttons on media controls for Android 13
are derived from the PlaybackState
action states.
With this change, the function MediaDataManager#createActionsFromState
generates action button information based on the PlaybackState
action state.
This aligns with how media controls are rendered in other Android platforms such
as Auto, Assistant, and Wear.
In contrast, in Android 12, the action buttons on media
controls were determined by notification actions
added to a MediaStyle
notification.
For a summary of the app-compatible changes for the action button updates, see
StatusBarManager
.
Remote playback API
To deliver a cohesive media experience across a variety of surfaces, starting
with Android 13, a new system API Notification#setRemotePlaybackInfo
is added to mark media notifications on the media control System UI for remote
playback. This API lets system apps that post the notifications do the
following:
- Provide information and functionality for media originating on a remote device to the default output switcher on the media control.
- Replace the output switcher affordance if necessary.
System apps that use this notification must have the MEDIA_CONTENT_CONTROL
permission.
The Notification#setRemotePlaybackInfo
API also adds the
following extras
to determine the name, icon, and intent of the remote playback device:
Notification#EXTRA_MEDIA_REMOTE_DEVICE
Notification#EXTRA_MEDIA_REMOTE_ICON
Notification#EXTRA_MEDIA_REMOTE_INTENT
With this information, System UI can replace the default output switcher chip device information and add the media control for remote playback to the end of the list of local media controls.
Implementation of media control
OEMs must be aware of this change to default behavior, because it affects how media controls for apps are generated. OEMs must also ensure that the new system API works as applicable in their output switcher affordance.
OEMs aren't required to make any changes and can use the default implementation in AOSP.
Customization of remote playback
In cases where the OEM has a system app that posts remote media playback
notifications, the app can optionally call setRemotePlaybackInfo
for
notification as long as it has been granted the MEDIA_CONTENT_CONTROL
permission. However, this isn't a requirement and the partner can choose not to
customize.
Validation of media control
To test media control in System UI, run a manual test to validate the following:
- The buttons function as intended while playing media from an app.
- The output switcher displays the correct device information.
Use the following tests to validate the remote playback API:
- CTS tests in
NotificationManagerTest
, such astestMediaStyleRemotePlayback_noPermission
andtestMediaStyleRemotePlayback_hasPermission
. - Unit tests under
com.android.systemui.media
.
Refer to the new CDD requirement [3.8.3.1/H-1-SR] for recommendations.