如果系統包含符記共用程式庫的原始設備製造商 (OEM) 實作項目,則必須將系統設為在應用程式類別後載入共用程式庫。如要這樣做,請在系統的 config_sharedLibrariesLoadedAfterApp 設定中加入程式庫名稱 (com.android.oem.tokens)。如果您有權存取 Google Automotive Services (GAS),則必須遵守這項規定。
<!-- The OEM token shared library will be loaded after app classes -->
<string-array name="config_sharedLibrariesLoadedAfterApp" translatable="false">
<item>com.android.oem.tokens</item>
</string-array>
[[["容易理解","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"]],["上次更新時間:2025-08-08 (世界標準時間)。"],[],[],null,["# OEM design tokens are an Android Automotive OS (AAOS) implementation of the\n[Material Design](https://m3.material.io/foundations/design-tokens/overview)\nsystem. Unlike the algorithmic or user selection approach for token values on mobile, OEMs designate\ndesign token values. Design tokens represent the small, repeated design decisions that make up a\ndesign system's visual style and replace static values with self-explanatory names. Tokens are\nanalogous to those defined by the Material Design system.\n\nOEM token library\n-----------------\n\nOEM design tokens are referenced through the OEM token library, which consists of the three\ncomponents illustrated in Figure 1.\n\n**Figure 1.** OEM token library components.\n\n### Static library\n\nThe static library component of the OEM token library facilitates access to token values as\nfollows.\n\n- Provides APIs to access OEM values for tokens.\n- Enables opt-in overriding of token references in theme with OEM values.\n\n### Shared library\n\nThe shared library component is responsible for defining the following:\n\n- Library name.\n- Boolean opt-in for enabling for OEM token values.\n- Style that provides OEM token values.\n\nTo accommodate OEM ownership of this shared library component, including an OEM-defined package\nname, OEMs can create an override of the shared library implementation.\n\n**Figure 2.** Override a shared library implementation.\n\n### OEM shared library\n\nOEM overrides of the shared library component allow for OEM ownership of the library while\nmaintaining compatibility with other components in the OEM token library by providing a means for\nthe package name and signature to be set by OEMs while leaving implementation of the shared\nlibrary otherwise unmodified.\n\nOverrides for a shared library can be defined as shown below: \n\n```transact-sql\noverride_android_app {\n name: \"[OEM]-token-shared-lib\",\n base: \"token-shared-lib\",\n package_name: \"com.[OEM].sharedlib\",\n rename_resources_package: false,\n certificate: ...\n}\n```\n\nTo set token values, see [Specify OEM token values](#token-values).\n| **Important:**Shared libraries MUST be preinstalled on a system image.\n\n### OEM shared library customizations\n\nTo support varied schemes for token values (for example, model or drive mode differentiation),\nOEMs can provide dynamic values for tokens by targeting the OEM shared library with Runtime\nResource Overlays (RROs). To learn more, see\n[Change the value of an app's resources at runtime](/docs/core/runtime/rros).\n\nTo set token values, see [Specify OEM token values](#token-values).\n\nSpecify OEM token values\n------------------------\n\nTo specify token values, set the corresponding attribute in the style `OemStyle` to\nthe required value. \n\n```text\n\u003cresources\u003e\n \u003cstyle name=\"OemStyle\"\u003e\n \u003citem name=\"colorPrimary\"\u003e#B0C5FF\u003c/item\u003e\n \u003citem name=\"colorOnPrimary\"\u003e#002B76\u003c/item\u003e\n \u003citem name=\"colorPrimaryContainer\"\u003e#003FA4\u003c/item\u003e\n \u003citem name=\"colorOnPrimaryContainer\"\u003e#D9E2FF\u003c/item\u003e\n …\n \u003c/style\u003e\n\u003c/resources\u003e\n```\n\n### Opt in to OEM values\n\nSo that apps can access OEM-provided token values, OEMs must first opt in to overriding default\ntoken values by configuring the `enable_oem_tokens` boolean to be `true`.\n\n### RRO token values\n\nSimilarly to how token values are set in `OemStyle`, RROs can be used to modify the\nstyle to provide alternate token values. \n\n```text\n\u003cresources\u003e\n \u003cstyle name=\"OemStyle\"\u003e\n \u003citem name=\"com.android.oem.tokens:colorPrimary\"\u003e#B0C5FF\u003c/item\u003e\n \u003citem name=\"com.android.oem.tokens:colorOnPrimary\"\u003e#002B76\u003c/item\u003e\n \u003citem name=\"com.android.oem.tokens:colorPrimaryContainer\"\u003e#003FA4\u003c/item\u003e\n \u003citem name=\"com.android.oem.tokens:colorOnPrimaryContainer\"\u003e#D9E2FF\u003c/item\u003e\n …\n \u003c/style\u003e\n\u003c/resources\u003e\n```\n\nRROs should set the shared library attributes on the style by specifying the shared library\nname.\n\nConfigure load last\n-------------------\n\nSystems that include an OEM implementation of a token shared library must configure the system\nto load the shared library after the app classes. To do so, include the library name\n(`com.android.oem.tokens`) in the `config_sharedLibrariesLoadedAfterApp`\nconfig on the system. If you have access to Google Automotive Services (GAS), this is enforced as a\nrequirement. \n\n```\n\u003c!-- The OEM token shared library will be loaded after app classes --\u003e\n\u003cstring-array name=\"config_sharedLibrariesLoadedAfterApp\" translatable=\"false\"\u003e\n \u003citem\u003ecom.android.oem.tokens\u003c/item\u003e\n\u003c/string-array\u003e\n```\n\nBest practices\n--------------\n\nBest practices for the OEM token library are described below.\n\n### Enable a flexible update strategy\n\nSee the strategies below to ensure you build in flexibility with respect to updates.\n\n#### OEM shared library\n\nAs system-shared libraries are required to be preinstalled on system images, devices must either\nship with the library or the library must be added as part of an Over-the-Air (OTA) update (to learn\nmore, see [OTA Updates](/docs/core/ota)).\nHowever, including a stub implementation of an OEM override of an OEM token shared library on a\nsystem image allows for an update to a full working implementation to be pushed to devices at a\nlater date without necessitating an OTA.\n\n#### Shared library RROs\n\nAlthough there is no requirement for RROs to be installed as system apps, doing so provides some\nupdate behavior that might be desired.\n\n- Automatic updates of apps when users aren't signed in.\n- Can't be uninstalled by the user (users can only **uninstall updates**)."]]