Configurar um ambiente de desenvolvimento integrado para desenvolvimento de SDV

O Android Studio for Platform (ASfP) é o ambiente de desenvolvimento integrado (IDE) recomendado para o desenvolvimento de plataformas de veículos definidos por software (SDV) do Android Automotive OS (AAOS). O ASfP é compatível com todos os idiomas usados pela plataforma de SDV do AAOS, incluindo Rust para pacotes de serviços de SDV.

Esta página aborda apenas a configuração específica do SDV. Para mais informações sobre recursos e fluxos de trabalho gerais do ASfP, consulte Android Studio for Platform.

O ASfP é executado apenas no Linux de 64 bits com CPUs x86-64. É possível instalá-lo em uma estação de trabalho Linux local ou autogerenciada ou iniciar uma estação de trabalho em nuvem pré-criada do Android 17 no Google Cloud Workstations, em que o ASfP (~/Workspace/asfp-project), o Cuttlefish, o vsidlc e os destinos de VM dupla compilados em ~/Workspace/aaos-26q2 vêm pré-configurados. Para mais informações, consulte Desenvolvimento na nuvem.

Instalar o ASfP

O ASfP usa como padrão um tamanho máximo de heap de 30 GB. A indexação de um checkout de plataforma usa muita memória, especialmente quando você também executa dispositivos Cuttlefish com várias VMs na mesma máquina. Mantenha o projeto limitado aos diretórios em que você trabalha e ajuste o tamanho máximo do heap nas configurações de memória do ASfP, se necessário.

O ASfP oferece suporte a atualizações automáticas no ambiente de desenvolvimento integrado. Para mais informações, consulte Atualizar o Android Studio para plataforma. Para mais informações sobre como baixar e instalar o ASfP e verificar os requisitos do sistema, consulte Instalar o Android Studio for Platform.

Criar um projeto de SDV

Inicialize, sincronize e crie seu checkout de SDV do AAOS antes de começar. Para mais informações sobre como configurar o checkout, consulte Local do código e Fazer o download, criar e executar.

Para criar um projeto de SDV, siga estas etapas:

  1. Crie um novo projeto no ASfP e selecione a raiz do checkout do SDV do AAOS como o checkout do repositório. Para mais informações sobre as etapas do assistente, consulte Criar ou importar um projeto.
  2. Depois que o ASfP criar o projeto, selecione ASfP > Project > Open Config para abrir o arquivo .asfp-project.
  3. Substitua o conteúdo do arquivo pelo exemplo a seguir e defina repo como o caminho do seu checkout (substitua aosp_cf_x86_64_sdv_core-aosp_current-userdebug por sdv_core_cf-aosp_current-userdebug no 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. Atualize lunch e directories para a área em que você trabalha. Para manter a indexação e a sincronização rápidas, inclua apenas os diretórios que você modifica ativamente. A tabela a seguir lista os destinos e diretórios comuns de SDV por versão:

    Foco no desenvolvimento de SDVs Destino lunch (Android 17 QPR2 e versões mais recentes) Destino lunch (Android 17) Recomendação: directories
    Pacotes de serviços de SDV aosp_cf_x86_64_sdv_core-aosp_current-userdebug sdv_core_cf-aosp_current-userdebug Seu catálogo de serviços e diretório de pacotes, como system/software_defined_vehicle/samples
    Integração com a plataforma SDV Core 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
    Gateway de SDV no IVI de SDV aosp_cf_x86_64_auto_sdv-aosp_current-userdebug (ou 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
    Segurança da tela em mídia 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
    Segurança da tela no IVI do SDV aosp_cf_x86_64_auto_sdv-aosp_current-userdebug (ou sdv_ivi_cf-aosp_current-userdebug) sdv_ivi_cf_ds-aosp_current-userdebug packages/apps/Car/DriverUI, packages/services/display_safety/service

    Para navegar também pelo código da plataforma nativa, adicione cpp a other_languages. Para mais informações sobre todas as opções de configuração, consulte Parâmetros de configuração.

  5. Para aplicar as mudanças, selecione ASfP > Sync > Sync Project. Para mais informações sobre os modos de sincronização (completa, parcial e sem build) e como exportar ou importar modelos compartilháveis do .asfp-project para sua equipe, consulte Modos de sincronização e janela de ferramentas do Soong e Modelos de projeto compartilháveis (exportação e importação).

Implantar pacotes de serviços de SDV

O ASfP inclui um plug-in de SDV que implanta um APEX com seus pacotes de serviço diretamente em um dispositivo SDV em execução. O plug-in fica desativado por padrão. Para usá-lo, ative o plug-in do SDV em Configurações > Plug-ins. Para mais informações sobre o empacotamento APEX, consulte Criar e implantar pacotes de serviços.

A implantação depende se o APEX já está no dispositivo:

  • Se o APEX já estiver instalado, você poderá implantar as mudanças diretamente do ASfP (as implantações do APEX do ASfP atualizam os pacotes /product/apex/ pré-instalados).
  • Se o APEX for novo, envie-o primeiro com adb remount -R (no Android 17 QPR2 e versões mais recentes), recrie e reinicie a imagem do sistema ou use uma imagem do sistema que pré-instale a chave usada para assinar o APEX. Depois disso, você poderá implantar usando o ASfP.

Para implantar um APEX de pacote de serviços, siga estas etapas:

  1. Inicie o dispositivo SDV com o plug-in do Cuttlefish. Para mais informações, consulte Executar dispositivos SDV no Cuttlefish.
  2. Abra o arquivo Android.bp que contém o módulo apex do pacote de serviços (generated/apex/<apex_name>/Android.bp no Android 17 QPR2 e versões mais recentes ou apex/Android.bp no Android 17) e clique no ícone Run no espaçamento entre colunas ao lado do bloco apex {.
  3. No menu que é aberto, selecione Run 'Deploy APEX_NAME'. Você também pode criar o APEX sem implantá-lo ou mudar a configuração de execução no mesmo menu.

Executar dispositivos SDV no Cuttlefish

O ASfP inclui um plug-in do Cuttlefish que cria e executa dispositivos locais do Cuttlefish. O plug-in precisa do orquestrador de host do Cuttlefish. Se o orquestrador de host não estiver disponível, o ASfP vai mostrar instruções para configurá-lo.

Para criar um dispositivo SDV, siga estas etapas:

  1. Selecione Ferramentas > Gerenciador de dispositivos, clique em + e selecione Create Cuttlefish Device.
  2. Para criar uma configuração de várias VMs, selecione Da configuração canônica e crie ou importe uma configuração, como SDV Core com SDV IVI ou SDV Media com SDV IVI para segurança de exibição. Para criar uma única VM, selecione Do checkout da árvore de origem local do Android.

Para ver todas as telas de VM em uma única tela e acessar outras opções de dispositivo, use a janela de ferramentas do Cuttlefish. Para abrir, selecione o ícone ... no painel lateral e selecione Cuttlefish ou pesquise Cuttlefish em Help > Find Action. Também é possível conferir telas individuais em Dispositivos em execução. Como o SDV Core é executado sem uma tela, use o Logcat e o Terminal para inspecioná-lo.

Depurar e testar

O ASfP inclui um depurador LLDB integrado para código C++ e Rust. Para mais informações sobre depuração e testes no ASfP, consulte Depurar código da plataforma, Depurar código Rust, Testar código da plataforma com o atest e Depurar destinos cc_test e rust_test no LLDB.

Ao anexar o depurador a um pacote de serviços, anexe-o ao processo que o hospeda. Os nomes de processos usam o formato <bundle_name>:<instance_name>, como OrchestratorSampleRustServiceBundle:sample-main-no-conditions. O comando a seguir lista os processos correspondentes e os IDs de processo deles:

adb shell ps -A | grep <bundle_name>

Para mais informações sobre fluxos de trabalho de depuração de SDV, como conexão com vários dispositivos e visualização de registros, consulte Depurar SDV.

Editar arquivos VSIDL

O ASfP inclui o servidor de linguagem VSIDL (vsidl-lsp), que inspeciona system/software_defined_vehicle/vsidl/language/src/protos/sdv/vsidl/v1/ (syntax.proto) para detectar automaticamente a gramática VSIDL do seu checkout. No Android 17 QPR2 e versões mais recentes, o vsidl-lsp valida os blocos de gráfico do sistema apex e host (incluindo vm, orchestration e service_bundle_instance health e qos aninhados), além das definições de service_bundle. Para mais informações sobre como configurar o catálogo e o gráfico do sistema, consulte Atualizações automáticas do catálogo e integração com o LSP e Definir o gráfico do sistema. Quando o catálogo inclui um arquivo CATALOG_UPDATE, o editor fornece os seguintes recursos para arquivos VSIDL:

  • Validação em tempo real: o editor destaca as palavras-chave do VSIDL e mostra erros de sintaxe, tipos não resolvidos e erros de validação do VSIDLC na janela Problemas. Para mais informações sobre as regras de validação e os códigos do erro, consulte Especificação de linguagem.
  • Preenchimento automático e documentação: pressione Ctrl+Espaço para sugestões de palavras-chave, mensagens, serviços, tópicos e canais e pressione Ctrl+Q para ver os comentários da documentação.
  • Navegação e formatação: pressione Ctrl+B para acessar as definições de .vsidl ou .proto, Alt+Shift+F7 para encontrar referências, Ctrl+F12 para conferir a estrutura do arquivo e Ctrl+Alt+L para formatar o arquivo.

Adicionar contexto de SDV para assistentes de IA

O ASfP inclui IA no Android Studio e um agente integrado com o build do Soong e as ferramentas atest. Como os arquivos AGENTS.md ficam ao lado do código-fonte no controle de versões, é possível compartilhar as mesmas regras de SDV entre o agente integrado do ASfP e os agentes de programação baseados em contêiner ou linha de comando que leem AGENTS.md. Quando você envia um comando com um arquivo aberto no ASfP, o agente carrega arquivos AGENTS.md do diretório desse arquivo e dos diretórios pai (a menos que um arquivo GEMINI.md no mesmo diretório tenha precedência). É possível verificar os arquivos ativos no painel Contexto do painel de conversa em Arquivos AGENTS.md. Para mais informações, consulte Conheça o Android Studio para Plataforma e Personalizar o agente usando arquivos AGENTS.md.

Os modelos a seguir são pontos de partida para os fluxos de trabalho em Criar um projeto de SDV.

Pacotes de serviços de SDV

Coloque o arquivo AGENTS.md correspondente à sua versão do Android no diretório do pacote incluído em .asfp-project que contém as pastas de código de catálogo, gerado e de serviço. Para mais informações, consulte Definir o gráfico do sistema, Gerar middleware, Criar e implantar pacotes de serviços, Escrever um arquivo de mapeamento SOME/IP e Visão geral da autorização de comunicações do SDV.

Android 17 QPR2 e versões mais recentes

# 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

Gateway de SDV no IVI de SDV

Coloque esse arquivo AGENTS.md no diretório do módulo do cliente IVI ou system/software_defined_vehicle/sdv_gateway/. Para mais informações, consulte Usar o gateway de SDV no 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)

Segurança da tela

Coloque esse arquivo AGENTS.md em packages/services/display_safety/ ou no diretório do app do painel de instrumentos. Para mais informações, consulte Começar a usar o Display Safety, Camada de abstração da plataforma HAR, Conjunto de ferramentas de design de segurança e 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