A partire dal 27 marzo 2025, ti consigliamo di utilizzare android-latest-release anziché aosp-main per compilare e contribuire ad AOSP. Per ulteriori informazioni, vedi Modifiche ad AOSP.
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Automotive App Host di Android Open Source Project (AOSP) fa parte della raccolta di app per auto
utilizzata dagli sviluppatori di terze parti per attivare le app per Android Automotive. L'app host è un'app di sistema che consente alle app per auto di terze parti di eseguire il rendering per suo conto di componenti dell'interfaccia utente (UI) in stile OEM.
Per eseguire app di terze parti, è necessario installare sia l'app di terze parti sia AOSP Automotive App Host:
Automotive App Host fornisce alle app di terze parti un insieme di componenti e modelli di UI ottimizzati per i veicoli, incluse funzionalità come usabilità e sicurezza.
Gli OEM possono applicare uno stile a questi modelli e componenti dell'interfaccia utente.
Il risultato? Le app di terze parti sono visivamente ben integrate nel sistema di infotainment dell'OEM.
Questa pagina spiega come generare AOSP Automotive App Host dal progetto Gradle nel ramo ub-automotive e come integrarlo nei target auto.
Esegui il check-out di ub-automotive e poi apri il progetto Gradle in packages/apps/Car/Templates/Host.
Per configurare il progetto con l'SDK Android, configura il file local.properties del progetto. Puoi trovare il percorso in Impostazioni SDK Android in Android Studio.
sdk.dir=${path_to_android_sdk_location}
Crea l'APK host come un normale progetto Gradle. Ad esempio, esegui il comando gradle:
I campioni di contenuti e codice in questa pagina sono soggetti alle licenze descritte nella Licenza per i contenuti. Java e OpenJDK sono marchi o marchi registrati di Oracle e/o delle sue società consociate.
Ultimo aggiornamento 2025-07-27 UTC.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 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)."]]