Konfigurowanie środowiska IDE na potrzeby tworzenia SDV

Android Studio for Platform (ASfP) to zalecane zintegrowane środowisko programistyczne (IDE) do tworzenia programowalnej platformy SDV (Software-Defined Vehicle) dla systemu operacyjnego Android Automotive (AAOS). ASfP obsługuje wszystkie języki używane przez platformę AAOS SDV, w tym Rust w przypadku pakietów usług SDV.

Ta strona dotyczy tylko konfiguracji SDV. Więcej informacji o ogólnych funkcjach i przepływach pracy ASfP znajdziesz w artykule Android Studio for Platform.

ASfP działa tylko na 64-bitowym systemie Linux z procesorami x86-64. Możesz zainstalować go na lokalnej lub samodzielnie zarządzanej stacji roboczej z systemem Linux albo uruchomić gotową stację roboczą Androida 17 w chmurze w Google Cloud Workstations, gdzie ASfP (~/Workspace/asfp-project), Cuttlefish, vsidlc i skompilowane cele z 2 maszynami wirtualnymi w ~/Workspace/aaos-26q2 są wstępnie skonfigurowane. Więcej informacji znajdziesz w artykule na temat programowania w chmurze.

Instalowanie ASfP

Domyślny maksymalny rozmiar sterty w ASfP to 30 GB. Indeksowanie platformy wymaga dużej ilości pamięci, zwłaszcza gdy na tej samej maszynie uruchamiasz też urządzenia Cuttlefish z wieloma maszynami wirtualnymi. Ogranicz zakres projektu do katalogów, nad którymi pracujesz, i w razie potrzeby dostosuj maksymalny rozmiar sterty w ustawieniach pamięci ASfP.

ASfP obsługuje automatyczne aktualizacje w IDE. Więcej informacji znajdziesz w artykule Aktualizowanie Androida Studio for Platform. Więcej informacji o pobieraniu i instalowaniu ASfP oraz sprawdzaniu wymagań systemowych znajdziesz w artykule Instalowanie Android Studio for Platform.

Tworzenie projektu SDV

Zanim zaczniesz, zainicjuj, zsynchronizuj i skompiluj proces płatności w AAOS SDV. Więcej informacji o konfigurowaniu procesu płatności znajdziesz w artykułach Lokalizacja kodu oraz Pobieranie, tworzenie i uruchamianie.

Aby utworzyć projekt SDV, wykonaj te czynności:

  1. Utwórz nowy projekt w ASfP i wybierz katalog główny kasy AAOS SDV jako kasę repozytorium. Więcej informacji o krokach kreatora znajdziesz w artykule Tworzenie i importowanie projektu.
  2. Gdy ASfP utworzy projekt, wybierz ASfP > Project > Open Config (ASfP > Projekt > Otwórz konfigurację), aby otworzyć plik .asfp-project.
  3. Zastąp zawartość pliku tym przykładem, a następnie ustaw repo na ścieżkę do kasy (zastąp aosp_cf_x86_64_sdv_core-aosp_current-userdebug przez sdv_core_cf-aosp_current-userdebug na Androidzie 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. Zaktualizuj dane (lunch i directories) dotyczące obszaru, nad którym pracujesz. Aby indeksowanie i synchronizacja przebiegały szybko, uwzględnij tylko te katalogi, które aktywnie modyfikujesz. W tabeli poniżej znajdziesz typowe cele i katalogi SDV według wersji:

    SDV development focus lunch (Android 17 QPR2 i nowsze wersje) lunch target (Android 17) Zalecane: directories
    Pakiety usług SDV aosp_cf_x86_64_sdv_core-aosp_current-userdebug sdv_core_cf-aosp_current-userdebug Katalog usług i katalog pakietów, np. system/software_defined_vehicle/samples
    Integracja z platformą 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
    Brama SDV w samochodowym systemie multimedialnym SDV aosp_cf_x86_64_auto_sdv-aosp_current-userdebug (lub 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
    Wyświetlanie informacji o bezpieczeństwie na ekranie 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
    Wyświetlanie informacji o bezpieczeństwie w samochodowym systemie multimedialnym SDV aosp_cf_x86_64_auto_sdv-aosp_current-userdebug (lub sdv_ivi_cf-aosp_current-userdebug) sdv_ivi_cf_ds-aosp_current-userdebug packages/apps/Car/DriverUI, packages/services/display_safety/service

    Aby przeglądać też kod platformy natywnej, dodaj cpp do other_languages. Więcej informacji o wszystkich opcjach konfiguracji znajdziesz w artykule Parametry konfiguracji.

  5. Aby zastosować zmiany, wybierz ASfP > Sync > Sync Project (ASfP > Synchronizuj > Synchronizuj projekt). Więcej informacji o trybach synchronizacji (pełna, częściowa i bez kompilacji) oraz eksportowaniu i importowaniu szablonów .asfp-project, które można udostępniać zespołowi, znajdziesz w artykułach Tryby synchronizacji i okno narzędzia Soong oraz Szablony projektów, które można udostępniać (eksportowanie i importowanie).

Wdrażanie pakietów usług SDV

ASfP zawiera wtyczkę SDV, która wdraża APEX zawierający pakiety usług bezpośrednio na działającym urządzeniu SDV. Wtyczka jest domyślnie wyłączona. Aby go użyć, włącz wtyczkę SDV w sekcji Ustawienia > Wtyczki. Więcej informacji o pakowaniu APEX znajdziesz w artykule Tworzenie i wdrażanie pakietów usług.

Sposób wdrażania zależy od tego, czy plik APEX jest już na urządzeniu:

  • Jeśli pakiet APEX jest już zainstalowany, możesz wdrożyć zmiany bezpośrednio z ASfP (wdrożenia APEX w ASfP aktualizują wstępnie zainstalowane pakiety /product/apex/).
  • Jeśli APEX jest nowy, najpierw prześlij go za pomocą adb remount -R (na Androidzie 17 QPR2 lub nowszym), ponownie utwórz i uruchom obraz systemu lub użyj obrazu systemu, który wstępnie instaluje klucz używany do podpisywania APEX. Po tym czasie możesz wdrożyć usługę z ASfP.

Aby wdrożyć pakiet APEX pakietu usług, wykonaj te czynności:

  1. Uruchom urządzenie SDV z wtyczką Cuttlefish. Więcej informacji znajdziesz w artykule Uruchamianie urządzeń SDV na Cuttlefish (w języku angielskim).
  2. Otwórz plik Android.bp zawierający moduł apex pakietu usług (generated/apex/<apex_name>/Android.bp na Androidzie 17 QPR2 i nowszych lub apex/Android.bp na Androidzie 17) i kliknij ikonę Uruchom w rynience obok bloku apex {.
  3. W menu, które się otworzy, wybierz Run 'Deploy APEX_NAME' (Uruchom „Wdróż”). W tym samym menu możesz też skompilować APEX bez wdrażania lub zmienić konfigurację uruchamiania.

Uruchamianie urządzeń SDV na Cuttlefish

ASfP zawiera wtyczkę Cuttlefish, która tworzy i uruchamia lokalne urządzenia Cuttlefish. Wtyczka wymaga koordynatora hosta Cuttlefish. Jeśli koordynator hosta jest niedostępny, ASfP wyświetla instrukcje jego konfiguracji.

Aby utworzyć urządzenie SDV, wykonaj te czynności:

  1. Wybierz Narzędzia > Menedżer urządzeń, kliknij + i wybierz Utwórz urządzenie Cuttlefish.
  2. Aby utworzyć konfigurację z wieloma maszynami wirtualnymi, wybierz Z konfiguracji kanonicznej i utwórz lub zaimportuj konfigurację, np. SDV Core z SDV IVI lub SDV Media z SDV IVI na potrzeby Display Safety. Aby utworzyć pojedynczą maszynę wirtualną, wybierz Z lokalnego wyewidencjonowania drzewa źródeł Androida.

Aby wyświetlić wszystkie wyświetlacze maszyn wirtualnych na jednym ekranie i uzyskać dostęp do dodatkowych opcji urządzenia, użyj okna narzędzia Cuttlefish. Aby go otworzyć, kliknij ikonę … w panelu bocznym i wybierz Cuttlefish lub wyszukaj Cuttlefish w sekcji Pomoc > Znajdź działanie. Możesz też wyświetlić poszczególne wyświetlacze w sekcji Działające urządzenia. SDV Core działa bez wyświetlacza, więc do jego sprawdzania używaj Logcata i terminala.

Debugowanie i testowanie

ASfP zawiera wbudowany debuger LLDB do kodu w językach C++ i Rust. Więcej informacji o debugowaniu i testowaniu w ASfP znajdziesz w artykułach Debugowanie kodu platformy, Debugowanie kodu w Rust, Testowanie kodu platformy za pomocą atest i Debugowanie obiektów docelowych cc_test i rust_test w LLDB.

Gdy dołączasz debuger do pakietu usług, dołącz go do procesu, który go hostuje. Nazwy procesów mają format <bundle_name>:<instance_name>, np. OrchestratorSampleRustServiceBundle:sample-main-no-conditions. To polecenie wyświetla listę pasujących procesów i ich identyfikatorów procesów:

adb shell ps -A | grep <bundle_name>

Więcej informacji o procesach debugowania SDV, takich jak łączenie się z wieloma urządzeniami i wyświetlanie dzienników, znajdziesz w artykule Debugowanie SDV.

Edytowanie plików VSIDL

ASfP zawiera serwer języka VSIDL (vsidl-lsp), który sprawdza system/software_defined_vehicle/vsidl/language/src/protos/sdv/vsidl/v1/ (syntax.proto), aby automatycznie wykrywać gramatykę VSIDL kasy. Na Androidzie 17 QPR2 i nowszych vsidl-lsp sprawdza poprawność bloków wykresu systemowego apex i host (w tym zagnieżdżonych vm, orchestration i service_bundle_instance health i qos) oraz definicji service_bundle. Więcej informacji o konfigurowaniu katalogu i wykresu systemu znajdziesz w artykułach Automatyczne aktualizacje katalogu i integracja z LSP oraz Definiowanie wykresu systemu. Gdy katalog zawiera plik CATALOG_UPDATE, edytor udostępnia te funkcje dotyczące plików VSIDL:

  • Weryfikacja na żywo: edytor wyróżnia słowa kluczowe VSIDL i wyświetla błędy składni, nierozwiązane typy i błędy weryfikacji VSIDLC w oknie Problemy. Więcej informacji o regułach weryfikacji i kodach błędów znajdziesz w specyfikacji języka.
  • Autouzupełnianie i dokumentacja: możesz nacisnąć Ctrl + Spacja, aby wyświetlić sugestie dotyczące słów kluczowych, komunikatów, usług, tematów i kanałów, oraz Ctrl + Q, aby wyświetlić komentarze do dokumentacji.
  • Nawigacja i formatowanie: możesz nacisnąć Ctrl + B, aby przejść do definicji .vsidl lub .proto, Alt + Shift + F7, aby znaleźć odwołania, Ctrl + F12, aby wyświetlić strukturę pliku, i Ctrl + Alt + L, aby sformatować plik.

Dodawanie kontekstu SDV dla asystentów AI

ASfP obejmuje AI w Android Studio i wbudowanego agenta z narzędziami do kompilacji Soong i atest. Pliki AGENTS.md znajdują się obok kodu źródłowego w systemie kontroli wersji, więc możesz udostępniać te same reguły SDV wbudowanemu agentowi ASfP oraz agentom kodowania opartym na wierszu poleceń lub kontenerach, które odczytują pliki AGENTS.md. Gdy prześlesz prompta z plikiem otwartym w ASfP, agent wczyta pliki AGENTS.md z katalogu tego pliku i jego katalogów nadrzędnych (chyba że plik GEMINI.md w tym samym katalogu ma pierwszeństwo). Aktywne pliki możesz sprawdzić w panelu czatu w szufladzie Kontekst w sekcji Pliki AGENTS.md. Więcej informacji znajdziesz w artykułach Android Studio for Platform i Dostosowywanie agenta za pomocą plików AGENTS.md.

Te szablony stanowią punkt wyjścia do przepływów pracy opisanych w artykule Tworzenie projektu SDV.

Pakiety usług SDV

Umieść plik AGENTS.md odpowiadający wersji Androida w katalogu pakietu zawartym w .asfp-project, który zawiera foldery z kodem katalogu, wygenerowanym i usługi. Więcej informacji znajdziesz w artykułach Definiowanie grafu systemu, Generowanie oprogramowania pośredniczącego, Tworzenie i wdrażanie pakietów usług, Zapisywanie pliku mapowania SOME/IP i Omówienie autoryzacji komunikacji SDV.

Android 17 QPR2 lub nowszy,

# 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

Brama SDV w samochodowym systemie multimedialnym SDV

Umieść ten plik AGENTS.md w katalogu modułu klienta IVI lub system/software_defined_vehicle/sdv_gateway/. Więcej informacji znajdziesz w artykule Korzystanie z bramy SDV w samochodowym systemie multimedialnym.

# 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)

Bezpieczeństwo wyświetlania

Umieść ten plik AGENTS.md w packages/services/display_safety/ lub w katalogu aplikacji tablicy wskaźników. Więcej informacji znajdziesz w artykułach Pierwsze kroki z Display Safety, Warstwa abstrakcji platformy HAR, Łańcuch narzędzi do projektowania bezpieczeństwa i 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