自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
附录 C:Car UI Plugin API 的最低兼容版本
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
原始设备制造商 (OEM) 应尽快切换到最新版本的 car-ui-lib-plugin-apis
(1.2.0 或更高版本)。理想情况下,OEM 不应推出任何使用较低版本的插件。
为何应用此更新?
之前的 Android 版本通过 Java 8+ API 脱糖支持实现了对 Java 8+ API 的支持。系统会将缺失 API 的实现编译到应用中,并重写 APK 的字节码以引用这些实现(而不是平台上的库)。
如要从车载设备界面库插件加载界面组件的 OEM 实现,需要引用由 car-ui-lib-plugin-apis
接口定义的方法。这些方法引用是在运行时从应用中对车载设备界面库插件进行的,并且应用和插件实现中的方法签名应该完全相同。
某些构建系统因特定最低 SDK 级别的要求而始终启用 API 脱糖。car-ui-lib-plugin-apis
接口的脱糖方法签名可能与未脱糖的 OEM 插件实现中的签名不同,这会导致插件无法加载。
因此,使用内部 Google 构建系统编译的某些 GAS 应用与车载设备界面库插件不兼容。因此,我们移除了对需要脱糖的 Java 8(及更高版本)API 的所有依赖项。此更改需要更新由 car-ui-lib-plugin-apis
定义的接口的 API。
针对 OEM 插件需要执行的步骤
请按照以下步骤更新您的 API:
更新插件实现以使用最新版 car-ui-lib-plugin-apis
。如需获取最新版本(1.2.0 或更高版本),请参阅 Google 的 Maven 制品库。
更新插件实现以实现 PluginFactoryOEMV4
接口。如果某个组件是由 OEM 插件实现的,此更改需要执行以下步骤。更新以下组件的 OEM 实现:
工具栏,用于实现 ToolbarControllerOEMV2
。
内容列表项,用于扩展 ContentListItemOEMV2
。
IME 搜索结果处理,用于扩展 ImeSearchInterfaceOEMV2
。
更新应用以使用最新版本的车载设备界面库。
如果未应用此更新,会出现什么情况?
如果为针对 OEM 插件完成本页上提供的步骤,脱糖应用(如 Google 汽车服务 [GAS])将无法加载车载设备界面库插件的实现,并且 OEM 自定义不会进行通过插件机制应用。
车载设备界面库的现有 RRO 自定义设置不受此问题影响,会继续照常运行。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-26。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-03-26。"],[],[],null,["# Appendix C, minimum compatible version for Car UI Plugin API\n\nOEMs are expected to switch to the newest version of `car-ui-lib-plugin-apis`\n(1.2.0 or higher) as soon as possible. Ideally, OEMs shouldn't ship any plugin\nthat uses an older version.\n\nWhy this update?\n----------------\n\n[Java 8+](https://developer.android.com/studio/write/java8-support-table) APIs\nare supported for previous versions of Android through [Java 8+ API desugaring\nsupport](https://developer.android.com/studio/write/java8-support#library-desugaring).\nImplementations of missing APIs are compiled into apps and the byte code of APKs\nare rewritten to reference the implementations instead of the libraries on the\nplatform.\n\nLoading OEM implementations of UI components from a Car UI Library plugin\nrequires the referencing of methods defined by `car-ui-lib-plugin-apis`\ninterfaces. These method references are made from apps to Car UI Library plugins\nat runtime with the expectation that method signatures are identical in app and\nplugin implementations.\n\nSome build systems enable API desugaring at all times due to requirements of a\nspecific minimum SDK level. Desugared method signatures for\n`car-ui-lib-plugin-apis` interfaces may not match those in an OEM plugin\nimplementation that has not been desugared, which results in plugins failing to\nload.\n\nAs a result, some GAS apps compiled with the internal Google build system are\nincompatible with the Car UI Library plugin. Therefore, we've removed all\ndependencies on Java 8 (and higher) APIs that require desugaring. This change\nrequires updates to the API of the interfaces defined by\n`car-ui-lib-plugin-apis`.\n\nRequired steps for OEM plugins\n------------------------------\n\nFollow these steps to update your API:\n\n1. Update the plugin implementation to use the latest version of\n `car-ui-lib-plugin-apis`. To get the latest version of (1.2.0 or higher),\n see [Google's Maven\n Repository](https://maven.google.com/web/index.html#com.android.car.ui:car-ui-lib-plugin-apis).\n\n2. Update the plugin implementation to implement the `PluginFactoryOEMV4`\n interface. This change requires the following steps when a component is\n implemented by the OEM plugin. Update the OEM implementation of:\n\n 1. Toolbar, to implement `ToolbarControllerOEMV2`.\n\n 2. Content list items, to extend `ContentListItemOEMV2`.\n\n 3. IME search results handing, to extend `ImeSearchInterfaceOEMV2`.\n\n3. Update the app to use the latest version of the Car UI Library.\n\nWhat happens if this update is not applied?\n-------------------------------------------\n\nIf the steps provided on this page aren't completed for an OEM plugin, desugared\napps, such as the Google Automotive Services (GAS), fail to load implementations\nof the Car UI Library plugin and no OEM customizations are applied through the\nplugin mechanism.\n\nExisting RRO customizations for the Car UI Library are not affected by this\nissue and continue to perform as usual."]]