[[["わかりやすい","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-07-27 UTC。"],[],[],null,["# Customize apps\n\nNow that Car UI library components and resources into the apps, in order to customize\nthese apps, OEMs must provide two overlays:\n\n- **Build-time overlay** adds any resources needed for the\n runtime resource overlay (RROs). This includes:\n\n - Drawables\n - Styles (for example, text appearances)\n - Shared resources (for example, colors)\n- The **RRO overlay** folder contains the resources used to generate one RRO per\n target app. These resources can only refer to:\n\n - Values defined within the same RRO (for example, for a color this would be a hexadecimal value).\n - Android framework resources (for example, `@android:color/accent`).\n - A resource defined in the above *build-time overlay.*\n\nGeneral structure\n-----------------\n\n\nThe proposed customization overlay structure is as follows:\n\n- `\u003cpath-to-OEM-overlays\u003e/`\n\n - `overlay/framework/base/core/res/`. Build-time overlay resources\n\n - `rro/`\n\n - `Android.mk`. Makefile used to generate the RROs for each target package\n based on the resources contained in this folder.\n\n - `AndroidManifest.xml`. A manifest file template used by the above\n makefile.\n\n - `res/`. Runtime overlays to apply to all target apps.\n\n\nOEMs may have more than one of these structures, depending on the number of brands they want to\nhandle in a single build target (see\n[Handle multiple brands](/docs/automotive/hmi/car_ui/customize#hmb)).\n\nRuntime resource overlays\n-------------------------\n\n\nRRO folder in the OEM overlay folder should contain resources to be applied to all target apps.\nRROs have limitations affecting their ability to overlay compound resources. In summary, an RRO:\n\n- *Can't* refer to resource *identifiers* defined in the target APK, or in the\n RRO itself. This means that RROs can not add new identifiers such as new drawables, colors, or\n styles.\n\n- *Can* refer to resource *identifiers* defined in the\n framework, whether those resources are defined in `/frameworks/base/core/res` or by means\n of a build-time overlay. These identifiers must be referred using the `android:`\n name-space:\n\n - For *public* DeviceDefault RROs, use **`android`** . \n\n For example, `@android:style/TextAppearance.DeviceDefault.Large`.\n\n - For *all* others (non-public or resources added through\n build-time overlay), ***use* `*android`** . \n\n For example, `@*android/style:TextAppearance.OEM.Brand1.Title`.\n\n\nIn addition to resources, the RRO folder must contain:\n\n- `AndroidManifest.xml`. In the sample below, `RRO_PACKAGE_NAME` and\n `TARGET_PACKAGE_NAME` are placeholders for the makefiles:\n\n ```carbon\n \u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n \u003cmanifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n package=\"{{RRO_PACKAGE_NAME}}\" /\u003e\n \u003capplication android:hasCode=\"false\" /\u003e\n \u003coverlay android:priority=\"10\"\n android:targetPackage=\"{{TARGET_PACKAGE_NAME}}\"\n android:requiredSystemPropertyName=\"ro.product.sku\"\n android:requiredSystemPropertyValue=\"\u003cyour-product-sku\u003e\" /\u003e\n \u003c/manifest\u003e\n ```\n- `Android.mk` in which `oem` in the following makefile defines the prefix that all generated RROs would have. \n\n ```carbon\n LOCAL_PATH := $(call my-dir)\n include $(CLEAR_VARS)\n CAR_UI_RRO_SET_NAME := oem\n CAR_UI_RESOURCE_DIR := $(LOCAL_PATH)/res\n CAR_UI_RRO_TARGETS := $(CAR_UI_RRO_PACKAGE_NAMES)\n include packages/apps/Car/libs/car-ui-lib/generate_rros.mk\n \n ```\n\nConfigure RROs\n--------------\n\n\nA new configuration file is supported, `overlayable.xml`, which you can use to define\naccess controls. For example, you can specify who can overlay resources as well as which resources\ncan be overlaid. As a result, resources can now be grouped in different ways to make them\navailable to be overlaid by different RROs.\n\nTo set up RRO access control:\n\n1. In the `res/values` folder, create `overlayable.xml`.\n2. Create the `\u003coverlayable\u003e` resource tags.\n3. Define the `name` attribute for the `\u003coverlayable\u003e` tag, which must be unique in the package. Each overlay can target *only* one overlayable group.\n4. Define the `\u003cpolicy\u003e` tag inside `\u003coverlayable\u003e`.\n5. Define the groups of resources that can be overlaid. For example: \n\n ```carbon\n \u003cresources\u003e\n \u003coverlayable name=\"OverlayableResources\"\u003e\n \u003cpolicy type=\"public\"\u003e\n \u003citem type=\"string\" name=\"app_title\" /\u003e\n \u003c/policy\u003e\n \u003c/overlayable\u003e\n \u003c/resources\u003e\n \n ```\n\n\nTo apply the following changes to your RRO project:\n\n1. In the `res/xml` folder, create `overlays.xml`. See the entry in the code sample below for `overlay`.\n2. Define the resources to be overridden.\n3. Add `android:resourcesMap=\"@xml/overlays\"` to the `\u003coverlay\u003e` tag in `AndroidManifest.xml`. For example, in the code sample below, see the entry for `\u003coverlay\u003e` .\n4. Set `android:isStatic=\"true\"` for a static overlay. Each overlay can target only one of the groups that can be overlaid.\n\n\nConsider the following example. The first section belongs to `AndroidManifest.xml`\nwhile the second section pertains to `overlays.xml`. \n\n```carbon\n \u003cmanifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n package=\"com.android.car.ui.rro\"\n android:versionCode=\"1\"\n android:versionName=\"1.0\"\u003e\n \u003coverlay android:targetName=\"OverlayableResources\"\n android:resourcesMap=\"@xml/overlays\"\n android:targetPackage=\"com.android.car.ui\"\n android:priority=\"1\"\n android:isStatic=\"false\" /\u003e\n \u003c/manifest\u003e\n \u003coverlay\u003e\n \u003citem target=\"string/app_title\" value=\"@ string/app_title\" /\u003e\n \u003c/overlay\u003e\n \n```\n\n\nWith one caveat, previously existing RROs work in Android 10. The caveat\nbeing that to be installed with the PackageManagerRRO, packages must be either pre-installed or\nsigned with the same key as the target app. In Android 10, layout files can be overlaid. However,\ndoing so requires the use of `requireViewById()` while getting the view instead of\n`findViewById()`. In Android 10, this change has been implemented to car-ui-lib to\nsupport layout overlays.\n\n\nThe next major release of Android will enable you to overlay a layout file and\ndefine new resources in the RRO package and refer to them internally.\n\n### Add OEM-specific resources\n\n\nTo overcome the RRO limitations that prevent OEM resources from being added:\n\n- Extend frameworks/base using a *build-time* overlay, adding any necessary resources.\n- Refer to these resources from the OEM RROs using `*android:` namespacing.\n\n\nFor example, the following is a way to add a OEM specific drawable and use it in an RRO:\n\n- `\u003cpath-to-OEM-overlays\u003e`\n\n - **`overlay/framework/base/core/res/res/drawable/`**\n\n - `oem_background_drawable.xml`\n\n - **`rro/res/values`**\n\n - `drawables.xml`\n\n ```gdscript\n \u003cresources\u003e\n \u003citem type=\"drawable\" name=\"car_ui_toolbar_background\"\u003e\n @*android:drawable/oem_background_drawable\n \u003c/item\u003e\n \u003c/resources\u003e\n ```\n\nHandle multiple brands\n----------------------\n\n\nRRO manifest files have a syntax to allow them be conditionally applied based on system\nproperties. To handle multiple brands in a single system image, OEMs can use this as\nfollows (see [General structure](/docs/automotive/hmi/car_ui/customize#gs)). \n\n```carbon\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003cmanifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n package=\"{{RRO_PACKAGE_NAME}}\"/\u003e\n \u003capplication android:hasCode=\"false\"/\u003e\n \u003coverlay android:priority=\"10\"\n android:targetPackage=\"{{TARGET_PACKAGE_NAME}}\"\n android:requiredSystemPropertyName=\"ro.product.sku\"\n android:requiredSystemPropertyValue=\"\u003cyour-product-sku\u003e\"/\u003e\n\u003c/manifest\u003e\n```\n\n\nThe syntax for `android:requiredSystemPropertyName` and\n`android:requiredSystemPropertyValue` would cause this RRO to be enabled *only*\nif the corresponding system property matches the provided value. OEMs can then define multiple of\nthese RROs, all of them statically enabled, and have only one active at a time.\n\nAdd Car UI library to a target\n------------------------------\n\n\nTo incorporate Car UI library to an Android target, you must include the following code snippet: \n\n```carbon\n# Include build-time overlays\n PRODUCT_PACKAGE_OVERLAYS += \\\n \u003cpath-to-oem-overlays\u003e/overlay\n # Define package names to generate RROs for\n CAR_UI_RRO_PACKAGE_NAMES += \\\n com.android.car.ui.paintbooth \\\n com.android.car.media \\\n com.android.car.dialer \\\n com.android.car.linkviewer \\\n com.android.car.settings \\\n com.android.car.systemupdater \\\n com.google.android.apps.automotive.inputmethod \\\n com.google.android.apps.automotive.templates.host \\\n ...\n # Include generated RROs\n PRODUCT_PACKAGES += \\\n oem-com-android-car-ui-paintbooth \\\n oem-com-android-car-media \\\n oem-com-android-car-dialer \\\n oem-com-android-car-linkviewer \\\n oem-com-android-car-settings \\\n oem-com-android-car-systemupdater \\\n oem-com-google-android-apps-automotive-inputmethod \\\n oem-com-google-android-apps-automotive-templates-host \\\n ...\n```\n| **Note:** The `oem-` prefix must match the `CAR_UI_RRO_SET_NAME` variable defined in RRO `Android.mk`. The above code:\n\n- Causes `\u003cpath-to-OEM-overlays\u003e/rro/Android.mk` generate one RRO for each\n of the packages named in `CAR_UI_RRO_PACKAGE_NAMES`.\n\n- Includes the generated RROs in `PRODUCT_PACKAGES`.\n\n- Includes a build-time overlay in `PRODUCT_PACKAGE_OVERLAYS` to add OEM-specific\n resources.\n\n\nTo learn which packages support `car-ui-lib`, see [List of packages containing car-ui-lib](/docs/automotive/hmi/car_ui/applist)."]]