Configura un IDE para el desarrollo de SDV

Android Studio for Platform (ASfP) es el entorno de desarrollo integrado (IDE) recomendado para el desarrollo de la plataforma de vehículos definidos por software (SDV) del SO Android Automotive (AAOS). ASfP admite todos los lenguajes que usa la plataforma de SDV de AAOS, incluido Rust para los paquetes de servicios de SDV.

En esta página, solo se explica la configuración específica de SDV. Para obtener más información sobre las funciones y los flujos de trabajo generales de ASfP, consulta Android Studio for Platform.

ASfP solo se ejecuta en Linux de 64 bits con CPUs x86-64. Puedes instalarlo en una estación de trabajo de Linux local o administrada por el cliente, o iniciar una estación de trabajo en la nube de Android 17 compilada previamente en Google Cloud Workstations, donde ASfP (~/Workspace/asfp-project), Cuttlefish, vsidlc y los destinos de VM doble compilados en ~/Workspace/aaos-26q2 vienen preconfigurados. Para obtener más información, consulta Desarrollo en la nube.

Instala ASfP

ASfP tiene un tamaño de montón máximo predeterminado de 30 GB. La indexación de una confirmación de la plataforma usa mucha memoria, en especial cuando también ejecutas dispositivos Cuttlefish con varias VMs en la misma máquina. Mantén el alcance del proyecto en los directorios en los que trabajas y, si es necesario, ajusta el tamaño máximo del montón en la configuración de memoria de ASfP.

ASfP admite actualizaciones automáticas en el IDE. Para obtener más información, consulta Cómo actualizar Android Studio para la plataforma. Para obtener más información sobre cómo descargar e instalar ASfP y verificar los requisitos del sistema, consulta Cómo instalar Android Studio for Platform.

Crea un proyecto de SDV

Inicializa, sincroniza y compila tu confirmación de compra de SDV de AAOS antes de comenzar. Para obtener más información sobre cómo configurar la confirmación de la compra, consulta Ubicación del código y Descarga, compila y ejecuta.

Para crear un proyecto de SDV, sigue estos pasos:

  1. Crea un proyecto nuevo en ASfP y selecciona la raíz de tu implementación de AAOS SDV como la implementación del repositorio. Para obtener más información sobre los pasos del asistente, consulta Cómo crear o importar un proyecto.
  2. Después de que ASfP cree el proyecto, selecciona ASfP > Project > Open Config para abrir el archivo .asfp-project.
  3. Reemplaza el contenido del archivo por el siguiente ejemplo y, luego, establece repo en la ruta de acceso de tu confirmación de compra (reemplaza aosp_cf_x86_64_sdv_core-aosp_current-userdebug por sdv_core_cf-aosp_current-userdebug en Android 17):

    repo: /path/to/sdv_source
    lunch: aosp_cf_x86_64_sdv_core-aosp_current-userdebug
    directories:
      include:
        -   system/software_defined_vehicle/samples
    other_languages:
      -   rust
    
  4. Actualiza lunch y directories para el área en la que trabajas. Para que la indexación y la sincronización sean rápidas, incluye solo los directorios que modificas de forma activa. En la siguiente tabla, se enumeran los destinos y directorios comunes de SDV por versión:

    Enfoque de desarrollo de SDV Destino lunch (Android 17 QPR2 y versiones posteriores) Orientación a lunch (Android 17) Recomendación: directories
    Paquetes de servicios de SDV aosp_cf_x86_64_sdv_core-aosp_current-userdebug sdv_core_cf-aosp_current-userdebug Tu catálogo de servicios y directorio de paquetes, como system/software_defined_vehicle/samples
    Integración de la plataforma principal de SDV aosp_cf_x86_64_sdv_core-aosp_current-userdebug sdv_core_cf-aosp_current-userdebug system/software_defined_vehicle/middleware, system/software_defined_vehicle/automotive_services, device/google/sdv
    Puerta de enlace de SDV en IVI de SDV aosp_cf_x86_64_auto_sdv-aosp_current-userdebug (o sdv_ivi_cf-aosp_current-userdebug) sdv_ivi_cf-aosp_current-userdebug system/software_defined_vehicle/sdv_gateway, system/software_defined_vehicle/samples/sdv_gateway, packages/services/Car
    Seguridad de la pantalla en el contenido multimedia de SDV aosp_cf_x86_64_sdv_media-aosp_current-userdebug sdv_media_har_cf-aosp_current-userdebug packages/services/display_safety, device/google/sdv, device/google/sdv_display_safety
    Seguridad de la pantalla en el IVI de SDV aosp_cf_x86_64_auto_sdv-aosp_current-userdebug (o sdv_ivi_cf-aosp_current-userdebug) sdv_ivi_cf_ds-aosp_current-userdebug packages/apps/Car/DriverUI, packages/services/display_safety/service

    Para explorar también el código de la plataforma nativa, agrega cpp a other_languages. Para obtener más información sobre todas las opciones de configuración, consulta Parámetros de configuración.

  5. Para aplicar los cambios, selecciona ASfP > Sync > Sync Project. Para obtener más información sobre los modos de sincronización (Full Sync, Partial Sync y No-Build Sync) y la exportación o importación de plantillas de .asfp-project que se pueden compartir para tu equipo, consulta Modos de sincronización y ventana de herramientas de Soong y Plantillas de proyectos que se pueden compartir (exportación e importación).

Implementa paquetes de servicios de SDV

ASfP incluye un complemento de SDV que implementa un APEX que contiene tus paquetes de servicios directamente en un dispositivo SDV en ejecución. El complemento está inhabilitado de forma predeterminada. Para usarlo, habilita el complemento de SDV en Settings > Plugins. Para obtener más información sobre el empaquetado de APEX, consulta Compila e implementa paquetes de servicios.

La forma en que implementes dependerá de si el APEX ya está en el dispositivo:

  • Si el APEX ya está instalado, puedes implementar los cambios directamente desde ASfP (las implementaciones de APEX de ASfP actualizan los paquetes /product/apex/ preinstalados).
  • Si el APEX es nuevo, primero envíalo con adb remount -R (en Android 17 QPR2 y versiones posteriores), vuelve a compilar y a iniciar la imagen del sistema, o bien usa una imagen del sistema que preinstale la clave que se usa para firmar el APEX. Luego, puedes realizar la implementación desde ASfP.

Para implementar un APEX de paquete de servicios, sigue estos pasos:

  1. Inicia tu dispositivo SDV con el complemento de Cuttlefish. Para obtener más información, consulta Cómo ejecutar dispositivos SDV en Cuttlefish.
  2. Abre el archivo Android.bp que contiene el módulo apex de tu paquete de servicios (generated/apex/<apex_name>/Android.bp en Android 17 QPR2 y versiones posteriores, o apex/Android.bp en Android 17) y haz clic en el ícono Run en el margen junto al bloque apex {.
  3. En el menú que se abre, selecciona Run 'Deploy APEX_NAME'. También puedes compilar el APEX sin implementarlo o cambiar la configuración de ejecución desde el mismo menú.

Cómo ejecutar dispositivos SDV en Cuttlefish

ASfP incluye un complemento de Cuttlefish que crea y ejecuta dispositivos locales de Cuttlefish. El complemento necesita el organizador de hosts de Cuttlefish. Si el organizador de hosts no está disponible, ASfP muestra instrucciones para configurarlo.

Para crear un dispositivo SDV, sigue estos pasos:

  1. Selecciona Herramientas > Administrador de dispositivos, haz clic en + y selecciona Crear dispositivo Cuttlefish.
  2. Para crear una configuración de varias VMs, selecciona From canonical configuration y crea o importa una configuración para tu configuración, como SDV Core con SDV IVI o SDV Media con SDV IVI para Display Safety. Para crear una sola VM, selecciona From local Android source tree checkout.

Para ver todas las pantallas de VM en una sola pantalla y acceder a opciones adicionales del dispositivo, usa la ventana de herramientas de Cuttlefish. Para abrirlo, selecciona el ícono ... en el panel lateral y selecciona Cuttlefish, o busca Cuttlefish en Help > Find Action. También puedes ver pantallas individuales en Running Devices. Como SDV Core se ejecuta sin una pantalla, usa Logcat y la Terminal para inspeccionarlo.

Depura y prueba

ASfP incluye un depurador LLDB integrado para código C++ y Rust. Para obtener más información sobre la depuración y las pruebas en ASfP, consulta Cómo depurar código de la plataforma, Cómo depurar código de Rust, Cómo probar código de la plataforma con atest y Cómo depurar destinos cc_test y rust_test en LLDB.

Cuando adjuntes el depurador a un paquete de servicios, adjúntalo al proceso que lo aloja. Los nombres de los procesos usan el formato <bundle_name>:<instance_name>, como OrchestratorSampleRustServiceBundle:sample-main-no-conditions. Con el siguiente comando, se enumeran los procesos que coinciden y sus ID de proceso:

adb shell ps -A | grep <bundle_name>

Para obtener más información sobre los flujos de trabajo de depuración de SDV, como la conexión a varios dispositivos y la visualización de registros, consulta Depura SDV.

Editar archivos VSIDL

ASfP incluye el servidor de lenguaje VSIDL (vsidl-lsp), que inspecciona system/software_defined_vehicle/vsidl/language/src/protos/sdv/vsidl/v1/ (syntax.proto) para detectar automáticamente la gramática de VSIDL de tu confirmación de la compra. En Android 17 QPR2 y versiones posteriores, vsidl-lsp valida los bloques de gráficos del sistema apex y host (incluidos los vm, orchestration y service_bundle_instance anidados, health y qos), además de las definiciones de service_bundle. Para obtener más información sobre cómo configurar tu catálogo y el gráfico del sistema, consulta Actualizaciones automáticas del catálogo y la integración de LSP y Define el gráfico del sistema. Cuando tu catálogo incluye un archivo CATALOG_UPDATE, el editor proporciona las siguientes funciones para los archivos VSIDL:

  • Validación en vivo: El editor destaca las palabras clave de VSIDL y muestra errores de sintaxis, tipos sin resolver y errores de validación de VSIDLC en la ventana Problems. Para obtener más información sobre las reglas de validación y sus códigos de error, consulta la especificación del lenguaje.
  • Autocompletado y documentación: Puedes presionar Ctrl + barra espaciadora para obtener sugerencias de palabras clave, mensajes, servicios, temas y canales, y presionar Ctrl + Q para ver los comentarios de la documentación.
  • Navegación y formato: Puedes presionar Ctrl + B para ir a las definiciones de .vsidl o .proto, Alt + Mayúsculas + F7 para buscar referencias, Ctrl + F12 para ver la estructura del archivo y Ctrl + Alt + L para darle formato al archivo.

Agrega contexto de SDV para los asistentes de IA

ASfP incluye IA en Android Studio y un agente integrado con herramientas de compilación de Soong y atest. Debido a que los archivos AGENTS.md se encuentran junto con tu código fuente en el control de versiones, puedes compartir las mismas reglas de SDV en el agente integrado de ASfP y en los agentes de programación basados en contenedores o en la línea de comandos que leen AGENTS.md. Cuando envías una instrucción con un archivo abierto en ASfP, el agente carga los archivos AGENTS.md desde el directorio de ese archivo y sus directorios superiores (a menos que un archivo GEMINI.md en el mismo directorio tenga prioridad), y puedes verificar los archivos activos en el panel Contexto del panel de chat en Archivos AGENTS.md. Para obtener más información, consulta Conoce Android Studio for Platform y Personaliza el agente con archivos AGENTS.md.

Las siguientes plantillas proporcionan puntos de partida para los flujos de trabajo en Crea un proyecto de SDV.

Paquetes de servicios de SDV

Coloca el archivo AGENTS.md que coincida con tu versión de Android en el directorio del paquete incluido en .asfp-project que contiene las carpetas de código de catálogo, generado y de servicio. Para obtener más información, consulta Define el gráfico del sistema, Genera middleware, Compila e implementa paquetes de servicios, Escribe un archivo de asignación de SOME/IP y Descripción general de la autorización de comunicaciones de SDV.

Android 17 QPR2 y versiones posteriores

# AAOS SDV service bundle and VSIDL system graph rules

## Source checkout, build, and test
- Sync public AOSP from `-b android-latest-release` (`repo init` syncs all SDV
  repos automatically; pass `-g default,swcar` only when filtering manifest
  groups with `-g`, and never pass `-b main` on public AOSP because `main`
  omits SDV repos)
- Always use 3-part `lunch` targets with `-aosp_current-userdebug` (never 2-part
  `lunch`): `aosp_cf_x86_64_sdv_core-aosp_current-userdebug` or
  `aosp_cf_arm64_sdv_core-aosp_current-userdebug` (`_perf` omits sample
  bundles; `aosp_cf_x86_64_sdv_core_tiny` is the minimal variant)
- Export a distinct `OUT_DIR` per VM terminal before `source build/envsetup.sh`
  and `lunch` when building multiple VMs from one checkout, build modules
  incrementally with Soong (`m <module_name>`, without regenerating
  `super.img`), and run tests with `atest <TestModuleName>` (`rust_test`,
  `rust_test_host`, `cc_test`, or `python_test_host`), without creating
  `Cargo.toml` files or running `cargo`
- In catalog `Android.bp` files, avoid `defaults` on `rust_protobuf` modules
  (`vsidlc` uses a regex parser), include each `.proto` file in at most one
  `rust_protobuf` target, and cover all catalog files in the first `filegroup`
  (`srcs: ["**/*"]`)

## Protobuf, VSIDL system graph, and SOME/IP mapping conventions
- Keep `.proto` files limited to `message`, `enum`, and RPC `service` schemas
  with `sdv/vsidl/v1/annotations.proto` bounds (`variable_type_max_size` on
  `string`/`bytes` and `repeated_field_max_count` on `repeated` fields; `E511`)
- Write VSIDL files in TextProto `VsidlEntry` syntax against
  `system/software_defined_vehicle/vsidl/language/src/protos/sdv/vsidl/v1/syntax.proto`
  (confirm `repeated Apex apex` is present to verify a 26Q4+ checkout):
  declare `service_bundle`, `apex` (`service_bundle_manifest`, plus
  `native_library: "lib<so>"` for C++ `cc_library_shared` bundles), and `host`
  (containing `vm` blocks with `orchestration` and `service_bundle_instance`
  entries for `health` and `qos`) so `vsidlc` generates APEX packaging,
  orchestration, and least-privilege `permissions.textproto` policies
  automatically; isolate `some_ip_mapping` or `vhal_mapping` rules in dedicated
  VSIDL files
- Use `PascalCase` for `service_bundle` names, `snake_case` for
  `build_cfg.target_name`, a globally unique lowercase `package` with at least
  four segments (`com.<org>.sdv.<domain>`; never reuse `com.android.sdv.*` or
  `com.sdv.*`), lowercase dash-case starting with a letter for `topic`,
  `channel`, and instance names, and an even `capacity >= 2` on every
  `publisher`

## Code generation, runtime security, and inner-loop deployment
- Run `vsidlc -c <catalog_dir> -o <output_dir> --services` (or `vsidlc -r <dir>`
  for recursive `CATALOG_UPDATE` regeneration; inspect `E100`-`E700` codes with
  `vsidlc --explain <CODE>`): genrule mode is enabled by default (pass
  `--no-genrule` for static Rust files), Soong rules write under
  `<output_dir>/generated/{rust,apex,vm,services}` (with the main genrule
  `Android.bp` at `<output_dir>/generated/rust/Android.bp`, producing generated
  configs such as `permissions.textproto`, `someip-config.binpb`, and
  `vsidl-config.binpb` at build time), and modifiable handwritten Rust code is
  isolated under `--hwc <path>` (default
  `<output_dir>/hwc/services/<package_path>/<ServiceBundleName>/src/main.rs`) so
  `vsidlc -p` updates `<output_dir>/generated/` without overwriting `hwc/`
- Core SDV agents reside on `/system` (`/system/bin/...`; the SOME/IP broker
  runs as `user system_ext_sdv_someip`, and both `sdv_someip_broker_agent` and
  `sdv_someip_stack_agent` live in `init.aosp_cf_x86_64_sdv_core.rc` or
  `init.aosp_cf_arm64_sdv_core.rc`, with the stack started on
  `dev.bootcomplete=1 && ro.boot.sdv.someip.enable=true`). Default Cuttlefish
  authorization (`sdv-cf` `-z=permissions_only`) is `PermissionsOnly`: bundles
  missing `permissions.textproto` are denied at run time unless
  `sdv.authz.enable=acls_only` is set. Health Monitor VM configuration
  (`HealthMonitorConfiguration` from `ro.sdv.health_monitor.config_path` or
  `persist.sdv.health_monitor.config_path`) sets per-agent `binder_timeout_ms`
  inside `monitored_agent`
  (`ro.boot.sdv.health_monitor.agent_startup_timeout_sec` was removed). OEM A/B
  custom partitions (`oem_ab/Android.bp`) pass non-sparse
  `$OUT/oem_ab_a.img;$OUT/oem_ab_b.img;$OUT/oem_ab_metadata.img` to
  `cvd create --custom_partition_path`
- In Rust bundles, wait for publisher or RPC server availability before
  creating subscribers or clients, stop active tasks in `on_stop`, and run
  blocking work in `tokio::spawn_blocking`
- Fast CLI inner-loop deployment on `userdebug`/`eng` builds (without bumping
  `apex_manifest.json` `version`): run `adb root && adb remount -R &&
  adb wait-for-device && adb root && adb remount` once on a fresh VM, then on
  each edit run `m <apex_module> &&
  adb push $OUT/product/apex/<apex_module>.apex /product/apex/ && adb reboot`.
  ASfP gutter deploy updates preinstalled `/product/apex/` bundles (new bundles
  require `adb remount -R` or a full image build first). Launch Cuttlefish with
  `sdv-cf create --instance_name=instance1` (or
  `cvd create --config=sdv_core_instance1`) when running sample bundles, and use
  `/data/mydir/` plus `sdv_update_manager_client` when verifying staged OTA
  updates

Android 17

# AAOS SDV service bundle and VSIDL rules (Android 17 (26Q2))

## Build and test
- Pin Android 17 (26Q2) checkouts with `-b android17-release` (or
  `android-17.0.0_r1`). When running outside ASfP, export a distinct `OUT_DIR`
  per VM terminal before `source build/envsetup.sh` and
  `lunch sdv_core_cf-aosp_current-userdebug` when building multiple VM targets
  from one checkout, build modules incrementally with Soong (`m <module_name>`,
  which writes only that module's artifact under `$OUT` without regenerating
  `super.img`), and run tests with `atest <TestModuleName>` (`rust_test`,
  `rust_test_host`, `cc_test`, or `python_test_host`), without creating
  `Cargo.toml` files or running `cargo`
- In catalog `Android.bp` files, avoid `defaults` on `rust_protobuf` modules
  (`vsidlc` uses a regex parser), include each `.proto` file in at most one
  `rust_protobuf` target, and cover all catalog files in the first `filegroup`
  (`srcs: ["**/*"]`)

## Protobuf, VSIDL, and AUTOSAR SOME/IP mapping conventions
- Keep `.proto` files limited to `message`, `enum`, and RPC `service` schemas
  (using `sdv/vsidl/v1/annotations.proto` only for field size bounds), without
  topic names, channel names, or queue capacities
- Write `.vsidl` files in TextProto `VsidlEntry` syntax (`package: "..."`,
  `service_bundle { name: "..." }`, `publisher` or `subscriber` with `message`
  and `topic`, and `server` or `client` with `service` and `channel`, without
  `import` statements; RPCs support unary, client-streaming, and
  server-streaming methods, not bidirectional streaming), and isolate
  `some_ip_mapping` (`sdv_type_mapping` and `someip_service_mapping` for
  AUTOSAR electronic control unit (ECU) `ARXML` or `vsomeip` IDs) or
  `vhal_mapping` rules in dedicated `.vsidl` mapping files so core bundles stay
  transport-independent
- Use `PascalCase` for `service_bundle` names (avoiding Rust, C++, and Java
  keywords), `snake_case` for `build_cfg.target_name`, a globally unique
  lowercase `package` with at least four segments (`com.<org>.sdv.<domain>`;
  never reuse platform-reserved `com.android.sdv.*` or sample `com.sdv.*`
  names), and lowercase dash-case starting with a letter (no consecutive or
  trailing hyphens, underscores, or slashes) for `topic`, `channel`, and
  instance names
- Set `capacity` on every `publisher` to an even integer greater than or equal
  to 2, and pair every `subscriber` and RPC `client` with a matching
  `publisher` or `server` in the catalog or its `-d` dependency catalogs

## Code generation, authorization, and APEX packaging
- Export `ANDROID_BUILD_TOP`, check `CATALOG_UPDATE` for catalog-relative
  `output_path` (such as `".."`), `dependency_catalog_paths` (`-d`), and
  `vsidlc_gen_args`, and run `vsidlc -c <catalog_dir> -o <output_dir>`; omit
  `--services` from `vsidlc_gen_args` and avoid `-p` (`--purge`) or
  `regenerator` when `output_path` holds handwritten `services/` code
- Leave generated files in `generated_rs/`, `apex/`, and `configs/` unmodified
  (except when incrementing `version` in `apex/apex_manifest.json` for iterative
  updates or adding manual authorization policies), and implement Rust logic in
  `services/<ServiceBundleName>/src/main.rs` (even though the initial
  `vsidlc --services` skeleton header says not to edit; C++ bundles do not use
  `vsidlc` C++ codegen and instead use `libsdv_lifecycle_client_cpp`,
  `libsdv_comms_cpp`, and `sdv_service_bundle_metadata` with
  `native_library_path: "lib64/lib<so>.so"` in
  `sdv_service_bundles_manifest.textproto`)
- Keep communications authorization `.textproto` policies in `configs/` aligned
  with every `publisher`, `subscriber`, `server`, and `client` unit (omitting
  `capacity` inside manual authorization `.textproto` `publisher` entries)
  because Soong skips `.textproto` validation at build time and failures surface
  only at runtime
- In Rust bundles, wait for publisher or RPC server availability before
  creating subscribers or clients, stop active tasks in `on_stop`, and run
  blocking work in `tokio::spawn_blocking`
- Generate Rust service bundle APEXes with `vsidlc --apex` (`updatable: true`,
  `min_sdk_version: "35"`, and `product_specific: true` in `apex/Android.bp`,
  never `vendor: true` or `soc_specific: true`, with matching unique `name` and
  `version` >= 1 in `apex_manifest.json`), stage iterative CLI updates on
  `sdv_core_cf` by incrementing `version`, building `m <apex_module>`, running
  `adb root` (passing `-s 0.0.0.0:6520` when multiple VMs run), pushing the
  APEX to `/data/mydir/`, and invoking `sdv_update_manager_client` from
  `/apex/com.android.sdv.sample.update_manager.client/bin/`
  (`prepare service-bundle`, `activate`, `adb reboot`, `status`, `commit`),
  flush writes with `adb reboot` before `cvd stop` and resume stopped VMs with
  the matching `cvd start` or `sdv-cf start --instance_name=instance1` (through
  `instance3`) command (running `cvd remove` before `cvd create` when resetting
  overlays), and do not set `supportsRebootlessUpdate: true` or run
  `adb install --force-non-staged` because SDV APEX updates require a reboot

Puerta de enlace de SDV en IVI de SDV

Coloca este archivo AGENTS.md en el directorio del módulo del cliente de IVI o en system/software_defined_vehicle/sdv_gateway/. Para obtener más información, consulta Usa la puerta de enlace de SDV en IVI.

# AAOS SDV Gateway on SDV IVI rules

- When running outside ASfP, export a distinct `OUT_DIR` per VM terminal before
  `source build/envsetup.sh` and
  `lunch aosp_cf_x86_64_auto_sdv-aosp_current-userdebug` (or
  `sdv_ivi_cf-aosp_current-userdebug` on Android 17 QPR2 (26Q4), where
  `ENABLE_SDV_INTEGRATION` and Display Safety are enabled by default; on
  Android 17 (26Q2), use `sdv_ivi_cf-aosp_current-userdebug`) when building
  alongside SDV Core (`aosp_cf_x86_64_sdv_core-aosp_current-userdebug`, or
  `sdv_core_cf-aosp_current-userdebug` on Android 17 (26Q2)), build IVI modules
  incrementally with Soong (`m <module_name>`, staging updatable IVI APEXes such
  as `com.oem.sdv.authz` with `adb install --staged` and `adb reboot`, passing
  `-s 0.0.0.0:6521` when a second VM runs alongside `0.0.0.0:6520`, or running
  `m` when updating partition files), resume stopped Cuttlefish VMs with the
  matching `cvd start` (with `--group_name` when multiple groups exist) or
  `sdv-cf start --instance_name=instance2` command after flushing writes with
  `adb reboot`, and run verification with `atest <TestModuleName>`
- On `android-latest-release` (Android 17 QPR2 (26Q4) and higher),
  `libsdvgatewayclient` connects directly to SDV agents without a separate
  `sdv_gateway` daemon. For native C or C++ IVI clients (including vehicle
  hardware abstraction layer (VHAL) integrations), link `libsdvgatewayclient`
  (`#include "libsdvgatewayclient.h"`); for in-tree system Java or Kotlin
  clients, use `libsdvgatewayclient-java`, `libsdvgatewayclient-java-sdk.stubs`,
  `libsdvgatewayclient-java-sdk`, and `com.android.sdv.gateway.client`, and
  declare
  `<uses-library android:name="libsdvgatewayclient-java-sdk" android:required="true" />`
  in `AndroidManifest.xml`
- Start the Binder thread pool before calling `ASDVGateway_Client_new`, and
  call `ASDVGateway_Client_initComms` (or `SdvGatewayClient.initComms`) before
  any service discovery, data tunnel, or RPC calls
- Check `ASDVGateway_Client_isRpcAvailable` or
  `ASDVGateway_Client_isProcessBoundToSdvRpcNetworkInterface` before opening
  RPC sockets on early boot, treat `ASDVGateway_StatusCode_OK` with null
  `ASDVGateway_RpcCredentials_t` as insecure `UNLOCKED` boot mode, and free
  non-null credentials with `ASDVGateway_Client_deleteRpcCredentials`
- Grant `sdv_gateway_client_domain(<domain>)` in SELinux (do not add
  `binder_use` on `/vendor` daemons, which violates Treble `neverallow`; add
  `group inet` on native init services, and `INTERNET` plus
  `CONNECTIVITY_USE_RESTRICTED_NETWORKS` privapp permissions for system Java
  RPC clients)

Seguridad de la pantalla

Coloca este archivo AGENTS.md en packages/services/display_safety/ o en el directorio de la app del tablero de instrumentos. Para obtener más información, consulta Cómo comenzar a usar Display Safety, Capa de abstracción de la plataforma de HAR, Cadena de herramientas de diseño de seguridad y DriverUI.

# AAOS Display Safety partner integration rules

- Display Safety spans two guest VMs with separate `lunch` targets: keep
  safety-critical telltales, gauges, camera views, chimes, and early-boot or
  fallback placeholders in the Rust high availability renderer (HAR) and safety
  monitor on SDV Media (`aosp_cf_x86_64_sdv_media-aosp_current-userdebug` on
  `android-latest-release`, or `sdv_media_har_cf-aosp_current-userdebug` on
  Android 17 (26Q2)), and build non-safety cluster UI on SDV IVI
  (`aosp_cf_x86_64_auto_sdv-aosp_current-userdebug`, or
  `sdv_ivi_cf-aosp_current-userdebug` on Android 17 QPR2 (26Q4), where Display
  Safety is included by default; use `sdv_ivi_cf_ds-aosp_current-userdebug` on
  Android 17 (26Q2)) using `ClusterHomeManager` (`Cluster2` rather than legacy
  `Cluster1`)
- Implement target OS and hardware subsystems (display, graphics, exterior view
  system (EVS) cameras, audio, user input, and vehicle signals) in a dedicated
  `har-platform-<target>` platform abstraction layer (PAL) crate implementing
  `har-platform-api` traits rather than modifying core `harry` framework crates,
  and verify PAL crates against the HAR platform test suite with `atest`
- Generate safety monitor configurations and telltale inspection artifacts from
  the compiled `.dcf` document and safety configuration JSON
  (`safety-config.json`, specifying top-level `document_id` and `displays`
  entries with `root_node_id` and `states` telltale node mappings) by running
  `/apex/com.google.sdv.display_safety.har/bin/har_design_compiler` with `-c`
  (`--config-file-path`), `-o` (`--artifacts-output-dir`), `--documents-path`,
  and `--fonts-path`, pulling artifacts into
  `packages/services/display_safety/service/harry-prebuilt/data/assets/common/artifacts/`
  rather than hardcoding telltale pixel coordinates
- Because the HAR display plane composites above Android IVI, ensure HAR clears
  the cluster viewport region to `alpha = 0.0` while valid `HeartbeatRequest`
  gRPC messages arrive from IVI, and set opaque pixels in custom HAR OpenGL ES
  surfaces to `alpha = 1.0` (`0xFF`)
- When running outside ASfP, export a distinct `OUT_DIR` per VM terminal
  (`export OUT_DIR=out-media` and `export OUT_DIR=out-ivi`) before
  `source build/envsetup.sh` and `lunch`: on `android-latest-release`, launch
  both VMs directly with `ds_toolkit launch -mb
  $ANDROID_BUILD_TOP/out-media/target/product/aosp_cf_x86_64_sdv_media -ib
  $ANDROID_BUILD_TOP/out-ivi/target/product/sdv_ivi_cf -ht
  $ANDROID_BUILD_TOP/out-media/host/linux-x86` (on Android 17 (26Q2), where
  `ds_toolkit launch` lacks `-ht`, launch VMs individually with `cvd create` or
  run `ds_toolkit gen_config` with `-mb .../target/product/sdv_har_cf` and
  `-ib .../target/product/sdv_ivi_cf`, set `common.host_package`, and run
  `cvd load`), integrate prebuilt cluster APKs through `DriverUIPrebuilt`
  (`overrides: ["DriverUIStubApp"]`), use `adb reboot` for clean VM restarts and
  pass matching `--extra_bootconfig_args` (plus `--display1` on IVI and
  `--group_name` selectors from `cvd fleet`) when resuming stopped VMs with
  `cvd start`, pass `--user 0` to `adb shell am` cluster commands, and note
  that `adb shell dumpsys SurfaceFlinger` on SDV IVI inspects only Android
  layers rather than the overlying HAR plane