自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
概览
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
“Media”提供了一个平台,让开发者可在其上构建媒体应用,以便在每辆支持 Android 的汽车中提供安全、无缝的互联信息娱乐体验。作为一款 Android 系统应用,Media 旨在为媒体应用提供经过防分心优化 (DO) 的播放和浏览体验。Android 开源项目 (AOSP) 中包含功能齐全的 Media 实现。
图 1. Media 屏幕实现示例。
如需了解 Media,请参阅以下页面:
- 系统组件和用户体验流程。
详细了解与 Media 互动的组件以及最常见的用户体验流程。
- 用媒体实现电台功能。
介绍了如何将电台界面与 Media 集成,以便让用户能够与多个媒体来源和电台互动,就像它们都是同一个应用一样。
- 自定义媒体。
了解如何使用 AOSP 结构中不同级别所定义的样式和资源。
- 实现媒体卡片。
实现媒体卡片以显示媒体元数据,例如标题、专辑封面等。媒体卡片还可以显示媒体文件队列,例如播放列表。
术语
本部分中使用了以下术语。
媒体来源
实现 Android MediaBrowserService API 以公开其媒体内容目录的播放控制和浏览功能的 Android 应用。
媒体文件
媒体来源目录中的一个元素。媒体文件可为以下任一项:
- 可播放媒体文件。可由系统播放的音频片段,例如歌曲、书籍章节和各集播客
- 可浏览媒体文件。一种组织性元素,用于整理可播放媒体文件或其他可浏览媒体文件,包括歌曲类别、近期播放歌曲文件夹,以及按音乐人、作者或受众群体排序的播客和其他可播放媒体文件。
Media 提供以下功能。
驾车时 |
停车时 |
---|
播放控制:
目录浏览:
|
“驾车时”下列出的所有功能,以及:
|
Tasks
下表说明了各方的任务。
车辆制造商 (vOEM) |
Google |
应用开发者 |
---|
- 使用 Android Automotive 构建完全符合要求的 Android CDD 信息娱乐系统。
- 在 MediaSession 和 Browser API 以及与 Media 的互操作性方面,达到应该满足的所有要求:
- 遵守浏览结构。
- 遵守自定义操作的要求。
- 将登录、设置等操作委派给应用。
- 遵循 API 明确支持的应用品牌宣传元素。例如,应用名称。
|
- 定义并改进 Media API。
- 在 AOSP 中提供 Media 实现。
- 定义在 Play 商店中发布媒体应用的应用审核流程。
- 提供有关 API、自定义、审核和认证流程等元素的文档。
|
- 实现 Media API:
- 为整体媒体浏览结构提供适当的内容。
- 酌情提供自定义操作。
- 向系统提供播放状态信息。
- 提供品牌宣传元素,例如应用名称。
- 根据需要实现登录、注册、设置和错误解决流程。
- 构建车用 APK 并将其发布到 Play 商店。
|
自定义准则
AOSP 中包含的 Media 实现使用车载设备界面库进行自定义并提供基本主题和结构,可以按原样采用,也可以按照以下限制条件对其进行修改。下表介绍了 OEM 在 Media 自定义方面的责任。
Media 自定义 |
说明 |
---|
应当有 |
调整整体主题和样式,包括调色板和大小调整。 |
5 月 |
修改 Media 的大体结构(例如,标签页放置位置)。 |
不得使用 |
修改 Media API 协定(包括应用品牌宣传方面):
- MediaSession 和 MediaBrowser 互操作性
- 媒体来源名称、图标
修改以下方面的信息架构:
|
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Overview\n\n*Media* provides a platform on which to build media apps that provide safe,\nseamless, and connected infotainment experiences in every Android-enabled car.\nMedia is an Android system application designed to provide a\n[Distraction Optimized (DO)](/docs/automotive/driver_distraction/guidelines) playback\nand browse experience for media apps. A fully functional implementation of Media is included with\n[Android Open Source Project (AOSP)](/).\n\n\n\u003cbr /\u003e\n\n\n**Figure 1.** Media screen sample implementations.\n\nTo learn about Media, see the following pages:\n\n- **[System components and user flows](/docs/automotive/hmi/media/technical_details).** Learn more about the components that interact with Media, as well as the most common user flows.\n- **[Implement radio with media](/docs/automotive/hmi/media/radio).** Read how to integrate the Radio UI with Media to provide enable users to interact with media sources and radio as if they were a single application.\n- **[Customize media](/docs/automotive/hmi/media/customization).** Learn how to work with styles and assets defined at different levels in the AOSP structure.\n- **[Implement a media card](/docs/automotive/hmi/media/media-card).** Implement a media card to display media metadata such as titles, album art, and more. A media card can also display a queue of media items, such as a playlist.\n\nTerminology\n-----------\n\nThese terms are used in this section.\nMedia Source An Android app that implements the Android [MediaBrowserService API](https://developer.android.com/guide/topics/media-apps/audio-app/building-an-audio-app) to expose playback control and browsing of its catalog of media items. Media Item An element in the Media Source catalog. Media items can be either:\n\n- Playable Media items. Audio segments that can be played by the system such as songs, chapters of books, and episodes of podcasts\n- Browsable Media items. Organizational elements used to group playable or other browseable media items such as song categories, a recent songs folder, as well as podcasts and playable media items sorted by artist, author, or audience.\n\nMedia features\n--------------\n\nMedia provides these features.\n\n| While driving | While parked |\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Playback control. - Presentation of currently playing media item (for example, a song), including title, album art, duration, description, and current play position. - Execution of standard media actions (for example, play, stop, pause, and skip forward). - Execution of custom media actions (custom actions provided by each media source). - Presentation of the playback queue, if provided by the media app. Catalog browse. - Display of top-level categories. - Drill down into browse-able media items (for example, folders). - Selection of playable media items (for example, songs) including title, album art, and indicators. For example, explicit content and downloaded content. | Everything listed under *While Driving* as well as: - Sign-in. For those media sources that require sign-in, it should be possible to start the sign in flow directly from Media. - Settings. Media source can display a settings UI. - Search, with keyboard. Users can perform a text search on Media. |\n\nTasks\n-----\n\nThis table describes the tasks of each party.\n\n| Vehicle makers (vOEMs) | Google | App developers |\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| - Build a fully-compliant [Android CDD](/docs/compatibility/10/android-10-cdd) infotainment system with Android Automotive. - Fulfill all expectations of MediaSession and Browser APIs and the interoperability with Media: - Respect browse structure. - Respect custom actions. - Delegate to the app for sign-in, settings, and so on. - Respect the app branding elements explicitly supported by the APIs. For example, the app name. | - Define and evolve Media APIs. - Provide Media implementation in AOSP. - Define app review process for publishing of media apps on Play Store. - Provide documentation for elements such as APIs, customizations, review, and certification processes | - Implement Media APIs: - Provide overall media browse structure with appropriate content. - Provide custom actions as appropriate. - Make playback states available to the system. - Provide branding elements, such as app name. - Implement the sign-in, sign-up, settings, and error resolution flows, as needed. - Build and publish car APKs to the Play Store. |\n\nCustomization guidelines\n------------------------\n\nThe Media implementation included in AOSP uses\n[Car UI Library](/docs/automotive/hmi/car_ui) to enable\ncustomization and provides a base theme and structure that can be adopted as is or modified\naccording to the following restrictions. The following table describes OEM responsibilities\nregarding Media customization.\n\n| Media customization | Description |\n|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| SHOULD | Adjust overall theme and styling, including color pallette and sizing. |\n| MAY | Modify the high-level structure of Media (for example, tab placement). |\n| MUST NOT | Modify Media API contracts, including app branding: - MediaSession and MediaBrowser interoperability - Media source name, icon Modify information architecture of: - Playback - Browse - Search |"]]