[[["เข้าใจง่าย","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,["# AOSP host integration guide\n\nThe Android Open Source Project (AOSP) Automotive App Host is a part of the Car App Library\nused by third-party (3P) developers to enable apps for Android Automotive. The App Host is a system\napp that allows 3P car apps to render OEM-styled user interface (UI) components on its behalf.\n\nTo run 3P apps, both the 3P app and the AOSP Automotive App Host must be\ninstalled:\n\n- Automotive App Host provides 3P apps with a a set of UI templates and components optimized for vehicles, including capabilities like usability and safety.\n- OEMs can style these UI templates and components.\n- **The result?** 3P apps are visually well-integrated into the infotainment system of the OEM.\n\nThis page explains how to generate the AOSP Automotive App Host from the Gradle project in the\n`ub-automotive` branch and then how to integrate the AOSP Automotive App Host into car\ntargets.\n\nCheck out the code\n------------------\n\nTo check out the unbundled code:\n\n1. Run the following command: \n\n ```text\n repo init -u https://android.googlesource.com/platform/manifest -b ub-automotive-master\n repo sync -j4\n ```\n2. To learn more about working with AOSP source code, see\n [Initialize a Repo client](/docs/setup/download/downloading#initializing-a-repo-client).\n\n3. Install [Android Studio](https://developer.android.com/studio).\n\nCreate the AOSP host APK\n------------------------\n\n1. Check out `ub-automotive` and then open the Gradle project under `packages/apps/Car/Templates/Host`.\n2. To configure the project with the Android SDK, configure your project's `local.properties` file. You can find the path under Android SDK Settings in Android Studio. \n\n ```genshi\n sdk.dir=${path_to_android_sdk_location}\n ```\n3. Create the host APK as a typical Gradle project. For example, run the `gradle` command: \n\n ```text\n ./gradlew :app:assembleDebug\n ```\n\n The APK file is located in:\n\n ```carbon\n packages/apps/Car/Templates/Host/app/build/outputs/apk/debug/app-debug.apk\n ```\n\nEmbed the AOSP host\n-------------------\n\n1. Create a new `Android.mk` file to include the following content: \n\n ```carbon\n LOCAL_PATH := $(my-dir)\n ################## Start of AOSPHost target ##################\n include $(CLEAR_VARS)\n LOCAL_MODULE := CarAOSPHost\n LOCAL_LICENSE_KINDS := legacy_notice\n LOCAL_LICENSE_CONDITIONS := notice\n LOCAL_MODULE_OWNER := google\n LOCAL_SRC_FILES := AOSPHost.apk\n LOCAL_MODULE_CLASS := APPS\n LOCAL_MODULE_TAGS := optional\n LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)\n LOCAL_BUILT_MODULE_STEM := package.apk\n LOCAL_CERTIFICATE := PRESIGNED\n LOCAL_PRIVILEGED_MODULE := true\n LOCAL_PRODUCT_MODULE := true\n LOCAL_DEX_PREOPT := false\n include $(BUILD_PREBUILT)\n ```\n2. Rename the `app-debug.apk` to `AOSPHost.apk` and put the APK in the same folder as `Android.mk`.\n3. Add the `CarAOSPHost` module to your targets as `PRODUCT_PACKAGES`: \n\n ```scdoc\n PRODUCT_PACKAGES += \\\n CarAOSPHost \\\n ```\n\nAdd the permissions config\n--------------------------\n\n1. Create a file called `com.android.car.templates.host.xml` to contain the following: \n\n ```carbon\n \u003cpermissions\u003e\n \u003c!-- Rename the package to com.android.car.templates.host --\u003e\n \u003cprivapp-permissions package=\"com.android.car.templates.host\"\u003e\n \u003c!-- To be able to display activities in the cluster --\u003e\n \u003cpermission name=\"android.car.permission.CAR_DISPLAY_IN_CLUSTER\" /\u003e\n\n \u003c!-- To be able to show navigation state (turn by turn directions) in the cluster.--\u003e\n \u003cpermission name=\"android.car.permission.CAR_NAVIGATION_MANAGER\" /\u003e\n\n \u003c!-- To be considered a system-approved host --\u003e\n \u003cpermission name=\"android.car.permission.TEMPLATE_RENDERER\" /\u003e\n \u003c/privapp-permissions\u003e\n\n \u003c!-- Declare support for templated applications. --\u003e\n \u003cfeature name=\"android.software.car.templates_host\" /\u003e\n \u003c/permissions\u003e\n ```\n2. In your target, add the config file to your targets: \n\n ```makefile\n PRODUCT_COPY_FILES += \\\n \u003cthe file root\u003e/com.android.car.templates.host.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/com.android.car.templates.host.xml\n ```\n\nBuild the target\n----------------\n\nWhen you build the target, the host is installed and permission is granted:\n\n```component-pascal\n ...\n android.car.permission.CAR_NAVIGATION_MANAGER: granted=true\n android.car.permission.CAR_DISPLAY_IN_CLUSTER: granted=true\n android.car.permission.TEMPLATE_RENDERER: granted=true\n ...\n```\n| **Note:** The permission `android.car.permission.TEMPLATE_RENDERER` is *only* available after Android API level 32.\n\nTest the integration\n--------------------\n\nTo build and install the samples, see this GitHub project,\n[car-samples/car_app_library](https://github.com/android/car-samples/tree/main/car_app_library)."]]