A partir de 27 de março de 2025, recomendamos usar android-latest-release em vez de aosp-main para criar e contribuir com o AOSP. Para mais informações, consulte Mudanças no AOSP.
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
O Automotive App Host do Android Open Source Project (AOSP) faz parte da biblioteca de apps para carros
usada por desenvolvedores de terceiros (3P) para ativar apps para o Android Automotive. O host de apps é um app
do sistema que permite que apps de carros de terceiros renderizem componentes da interface do usuário (IU) com estilo OEM em nome dele.
Para executar apps de terceiros, o app de terceiros e o host de apps automotivos do AOSP precisam ser
instalados:
O Automotive App Host oferece aos apps de terceiros um conjunto de modelos e componentes de interface
otimizados para veículos, incluindo recursos como usabilidade e segurança.
Os OEMs podem estilizar esses modelos e componentes da interface.
O resultado? Os apps de terceiros são bem integrados visualmente ao
sistema de infoentretenimento do OEM.
Esta página explica como gerar o host de app automotivo do AOSP a partir do projeto do Gradle na
filial ub-automotive e, em seguida, como integrar o host de app automotivo do AOSP a destinos
automotivos.
Confira ub-automotive e abra o projeto do Gradle em
packages/apps/Car/Templates/Host.
Para configurar o projeto com o SDK do Android, configure o arquivo
local.properties do projeto. Você pode encontrar o caminho em "Android SDK Settings" no Android
Studio.
sdk.dir=${path_to_android_sdk_location}
Crie o APK host como um projeto típico do Gradle. Por exemplo, execute o comando gradle:
O conteúdo e os exemplos de código nesta página estão sujeitos às licenças descritas na Licença de conteúdo. Java e OpenJDK são marcas registradas da Oracle e/ou suas afiliadas.
Última atualização 2025-07-27 UTC.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Não contém as informações de que eu preciso","missingTheInformationINeed","thumb-down"],["Muito complicado / etapas demais","tooComplicatedTooManySteps","thumb-down"],["Desatualizado","outOfDate","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Problema com as amostras / o código","samplesCodeIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 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)."]]