Android Studio for Platform (ASfP) 是 Android Automotive OS (AAOS) 軟體定義車輛 (SDV) 平台開發的建議整合式開發環境 (IDE)。ASfP 支援 AAOS SDV 平台使用的所有語言,包括 SDV 服務套件的 Rust。
本頁僅說明 SDV 專屬設定。如要進一步瞭解一般 ASfP 功能和工作流程,請參閱「Android Studio for Platform」。
ASfP 只能在搭載 x86-64 CPU 的 64 位元 Linux 上執行。您可以將其安裝在本機或自行管理的 Linux 工作站上,或在 Google Cloud Workstations 上啟動預先建構的 Android 17 雲端工作站,其中 ASfP (~/Workspace/asfp-project)、Cuttlefish、vsidlc 和 ~/Workspace/aaos-26q2 的編譯雙 VM 目標已預先設定。詳情請參閱「雲端開發」。
安裝 ASfP
ASfP 預設的堆積大小上限為 30 GB。為平台檢出項目建立索引會耗用大量記憶體,尤其是在同一部機器上執行多 VM Cuttlefish 裝置時。請將專案範圍限定在您處理的目錄,並視需要在 ASfP 記憶體設定中調整堆積大小上限。
ASfP 支援在 IDE 中自動更新。詳情請參閱「更新 Android Studio for Platform」。如要進一步瞭解如何下載及安裝 ASfP,以及查看系統需求,請參閱「安裝 Android Studio for Platform」。
建立 SDV 專案
開始前,請先初始化、同步及建構 AAOS SDV 檢出。如要進一步瞭解如何設定簽出,請參閱「程式碼位置」和「下載、建構及執行」。
如要建立 SDV 專案,請按照下列步驟操作:
- 在 ASfP 中建立新專案,並選取 AAOS SDV 簽出的根目錄做為存放區簽出。如要進一步瞭解精靈步驟,請參閱「建立或匯入專案」。
- ASfP 建立專案後,請依序選取「ASfP」>「Project」>「Open Config」,開啟
.asfp-project檔案。 將檔案內容替換為以下範例,然後將
repo設為檢出路徑 (在 Android 17 上,將aosp_cf_x86_64_sdv_core-aosp_current-userdebug替換為sdv_core_cf-aosp_current-userdebug):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請根據您負責的區域,更新
lunch和directories。為確保索引和同步處理速度,請只加入您會主動修改的目錄。下表列出各版本常見的 SDV 目標和目錄:SDV 開發重點 lunch目標 (Android 17 QPR2 以上版本)lunch目標 (Android 17)推薦 directoriesSDV 服務套裝組合 aosp_cf_x86_64_sdv_core-aosp_current-userdebugsdv_core_cf-aosp_current-userdebugService Catalog 和套裝組合目錄,例如 system/software_defined_vehicle/samplesSDV Core 平台整合 aosp_cf_x86_64_sdv_core-aosp_current-userdebugsdv_core_cf-aosp_current-userdebugsystem/software_defined_vehicle/middleware、system/software_defined_vehicle/automotive_services、device/google/sdvSDV IVI 上的 SDV 閘道 aosp_cf_x86_64_auto_sdv-aosp_current-userdebug(或sdv_ivi_cf-aosp_current-userdebug)sdv_ivi_cf-aosp_current-userdebugsystem/software_defined_vehicle/sdv_gateway、system/software_defined_vehicle/samples/sdv_gateway、packages/services/CarSDV 媒體的品牌安全 aosp_cf_x86_64_sdv_media-aosp_current-userdebugsdv_media_har_cf-aosp_current-userdebugpackages/services/display_safety、device/google/sdv、device/google/sdv_display_safety在 SDV IVI 上顯示安全資訊 aosp_cf_x86_64_auto_sdv-aosp_current-userdebug(或sdv_ivi_cf-aosp_current-userdebug)sdv_ivi_cf_ds-aosp_current-userdebugpackages/apps/Car/DriverUI,packages/services/display_safety/service如要一併瀏覽原生平台程式碼,請將
cpp新增至other_languages。如要進一步瞭解所有設定選項,請參閱「設定參數」。如要套用變更,請依序選取「ASfP」>「Sync」>「Sync Project」。如要進一步瞭解同步模式 (完整同步、部分同步和無建構同步),以及如何匯出或匯入團隊的可共用
.asfp-project範本,請參閱「同步模式和 Soong 工具視窗」和「可共用專案範本 (匯出和匯入)」。
部署 SDV 服務套件
ASfP 包含 SDV 外掛程式,可將含有服務套件的 APEX 直接部署至執行中的 SDV 裝置。外掛程式預設為停用。如要使用,請依序前往「Settings」>「Plugins」啟用 SDV 外掛程式。如要進一步瞭解 APEX 封裝,請參閱「建構及部署服務套件」。
部署方式取決於裝置上是否已有 APEX:
- 如果已安裝 APEX,您可以直接從 ASfP 部署變更 (ASfP APEX 會部署更新預先安裝的
/product/apex/套件)。 - 如果 APEX 是新的,請先使用
adb remount -R推送 (Android 17 QPR2 以上版本),重新建構並重新啟動系統映像檔,或使用預先安裝用於簽署 APEX 金鑰的系統映像檔。之後,您就可以從 ASfP 部署。
如要部署服務套件 APEX,請按照下列步驟操作:
- 使用 Cuttlefish 外掛程式啟動 SDV 裝置。詳情請參閱「在 Cuttlefish 上執行 SDV 裝置」。
- 開啟包含服務套件
apex模組的Android.bp檔案 (Android 17 QPR2 以上版本為generated/apex/<apex_name>/Android.bp,Android 17 為apex/Android.bp),然後按一下apex {區塊旁裝訂邊中的「Run」圖示。 - 在開啟的選單中,選取「Run 'Deploy APEX_NAME'」。您 也可以在不部署的情況下建構 APEX,或從同一個選單變更執行 設定。
在 Cuttlefish 上執行 SDV 裝置
ASfP 包含 Cuttlefish 外掛程式,可建立及執行本機 Cuttlefish 裝置。外掛程式需要 Cuttlefish 主機自動化調度管理工具。如果主機自動調度管理工具無法使用,ASfP 會顯示設定操作說明。
如要建立 SDV 裝置,請按照下列步驟操作:
- 依序選取「Tools」>「裝置管理工具」,按一下「+」,然後選取「Create Cuttlefish Device」。
- 如要建立多 VM 設定,請選取「From canonical configuration」(從標準設定),然後建立或匯入設定,例如 SDV Core 搭配 SDV IVI,或 SDV Media 搭配 SDV IVI for Display Safety。如要建立單一 VM,請改為選取「From local Android source tree checkout」。
如要在單一畫面上查看所有 VM 螢幕,並存取其他裝置選項,請使用 Cuttlefish 工具視窗。如要開啟,請選取側邊面板中的「...」圖示,然後選取「Cuttlefish」,或在「Help」>「Find Action」中搜尋「Cuttlefish」。您也可以在「Running Devices」中查看個別螢幕。由於 SDV Core 執行時不會顯示畫面,請使用 Logcat 和終端機檢查。
偵錯和測試
ASfP 內建 LLDB 偵錯工具,可用於 C++ 和 Rust 程式碼。如要進一步瞭解如何在 ASfP 中偵錯及測試,請參閱「對平台程式碼偵錯」、「對 Rust 程式碼偵錯」、「使用 atest 測試平台程式碼」和「在 LLDB 下對 cc_test 和 rust_test 目標偵錯」。
將偵錯工具附加至服務套件時,請附加至託管該套件的程序。處理程序名稱採用 <bundle_name>:<instance_name> 格式,例如 OrchestratorSampleRustServiceBundle:sample-main-no-conditions。下列指令會列出相符的程序及其程序 ID:
adb shell ps -A | grep <bundle_name>
如要進一步瞭解 SDV 偵錯工作流程,例如連線至多部裝置及查看記錄,請參閱「偵錯 SDV」。
編輯 VSIDL 檔案
ASfP 包含 VSIDL 語言伺服器 (vsidl-lsp),可檢查 system/software_defined_vehicle/vsidl/language/src/protos/sdv/vsidl/v1/ (syntax.proto),自動偵測檢查項目的 VSIDL 文法。在 Android 17 QPR2 以上版本中,vsidl-lsp 除了驗證 service_bundle 定義外,還會驗證 apex 和 host (包括巢狀 vm、orchestration 和 service_bundle_instance health 和 qos) 系統圖區塊。如要進一步瞭解如何設定目錄和系統圖,請參閱「自動目錄更新和 LSP 整合」和「定義系統圖」。如果目錄包含 CATALOG_UPDATE 檔案,編輯器會為 VSIDL 檔案提供下列功能:
- 即時驗證:編輯器會醒目顯示 VSIDL 關鍵字,並在「Problems」視窗中顯示語法錯誤、未解析的類型和 VSIDLC 驗證錯誤。如要進一步瞭解驗證規則和錯誤代碼,請參閱語言規格。
- 自動完成和說明文件:按下 Ctrl+Space 鍵,即可查看關鍵字、訊息、服務、主題和管道建議,按下 Ctrl+Q 鍵則可查看說明文件註解。
- 導覽和格式設定:您可以按下 Ctrl+B 前往
.vsidl或.proto定義、按下 Alt+Shift+F7 尋找參照、按下 Ctrl+F12 查看檔案結構,以及按下 Ctrl+Alt+L 設定檔案格式。
新增 AI 助理的 SDV 情境
ASfP 包含 Android Studio 中的 AI,以及內建代理,可使用 Soong 建構和 atest 工具。由於 AGENTS.md 檔案與原始碼一起存放在版本管控中,因此您可以在 ASfP 的內建代理,以及讀取 AGENTS.md 的指令列或容器式程式設計代理之間,共用相同的 SDV 規則。在
ASfP 中開啟檔案並提交提示時,代理會從該檔案的目錄和上層目錄載入 AGENTS.md 檔案 (除非同一目錄中的 GEMINI.md
檔案優先),您可以在對話面板的「Context」導覽匣中,查看「AGENTS.md Files」底下的有效檔案
。詳情請參閱「認識 Android Studio for Platform」和「使用 AGENTS.md 檔案自訂代理」。
下列範本可做為建立 SDV 專案中工作流程的起點。
SDV 服務套裝組合
將與 Android 版本相符的 AGENTS.md 檔案,放在 .asfp-project 內含的套件目錄中,該目錄包含目錄、產生的程式碼和服務程式碼資料夾。詳情請參閱「定義系統圖」、「產生中介軟體」、「建構及部署服務套件」、「編寫 SOME/IP 對應檔案」和「SDV 通訊授權總覽」。
Android 17 QPR2 以上版本
# 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
SDV IVI 上的 SDV 閘道
將這個 AGENTS.md 檔案放在 IVI 用戶端模組目錄或 system/software_defined_vehicle/sdv_gateway/ 中。詳情請參閱「在 IVI 上使用 SDV Gateway」。
# 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)
顯示安全
將這個 AGENTS.md 檔案放在 packages/services/display_safety/ 或儀表板應用程式目錄中。詳情請參閱「開始使用 Display Safety」、「HAR 平台抽象層」、「安全設計工具鍊」和「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