從 AAOS 26Q2 遷移至 26Q4

本頁說明如何將 Android Automotive OS (AAOS) 軟體定義車輛 (SDV) 原始碼檢出、Cuttlefish 建構和刷寫指令碼、Health Monitor 設定,以及服務套件,從 Android 17 (AAOS 26Q2) 升級至 Android 17 QPR2 (AAOS 26Q4)。如要進一步瞭解這個版本的新功能,請參閱「Android Automotive 26Q4」。

查看結帳版本

從 AOSP 簽出根目錄執行下列指令,確認工作區指定 Android 17 QPR2 或 Android 17:

PROTO=system/software_defined_vehicle/vsidl/language/src/protos/sdv/vsidl/v1/syntax.proto
if [ ! -f "$PROTO" ]; then
  echo "syntax.proto not found; run from your AOSP checkout root" >&2
  false
elif grep -Eq "repeated[[:space:]]+Apex[[:space:]]+apex" "$PROTO"; then
  echo "26Q4 or higher"
else
  echo "26Q2"
fi

如果 syntax.proto 在 VsidlEntry 上定義 repeated Apex apex (以及 Host 系統圖欄位),則您的簽出作業會包含 Android 17 QPR2 VSIDL 系統圖和平台更新。

現有套裝組合的回溯相容性

使用 Android.bp、sdv_service_bundles_manifest.textproto、permissions.textproto、health_config.proto textproto 檔案,以及產生的 libsdv_mw_clientlib 中介軟體,為 Android 17 手動編寫的服務套件,在 Android 17 QPR2 上編譯及執行時不會有任何變更。原始設備製造商 (OEM) 和一級供應商可以先升級 OS 和 Cuttlefish 基準,然後依服務套件逐步採用 VSIDL 系統圖。

在 Android 17 QPR2 上執行現有套件前,請先確認下列執行階段和 SDK 變更:

  • 預設 PermissionsOnly 授權:執行階段通訊授權預設為 PermissionsOnly,而非 Lenient。除非您在遷移期間封裝有效的 permissions.textproto 檔案或設定 sdv.authz.enable=acls_only,否則缺少政策檔案或僅限舊版 ACL 設定的服務套件會在執行階段遭到拒絕。詳情請參閱「SDV 通訊授權總覽」。
  • APEX 符號連結邊界和 SPIFFE 前置字元檢查:服務套件驗證會無條件拒絕逸出 Android Pony EXpress (APEX) 根目錄的符號連結。啟用預設停用的 com.android.sdv.middleware.flags.spiffe_id aconfig 旗標時,SPIFFE 身分驗證也會拒絕所有已驗證服務套件中保留的 com.android.sdv.sys. 和 sui. 套件前置字元。詳情請參閱「服務套件身分」。
  • IVI 遙測權限旗標:在車用資訊娛樂系統 (IVI) 目標上,只有在啟用預設停用的 com.android.sdv.telemetry.flags.telemetry_permission_enabled aconfig 旗標時,SDV 遙測才會強制執行 com.android.sdv.telemetry.permission.USE_SDV_TELEMETRY_SERVICE 權限。SDV Core 服務套裝組合不受影響。詳情請參閱「AAOS SDV 遙測總覽」。
  • 低階 C++ libsdv_comms_cpp SDK 更新:libsdv_comms_cpp 的直接 C++ 呼叫端必須從 Context::CreateForTest (傳回 Context) 遷移至 Context::Create(fqin) (傳回 SdvResult<Context>)。請將 <sdv/sd_lookup.hpp> 和靜態 dt/sd 工廠方法替換為 <sdv/sdv_comms.hpp> 中的 sdv_comms::SdvComms 和 GetSdvComms(fqin)。移除對已刪除 Async 和 Future C++ 包裝函式的呼叫。使用產生的 VSIDL 中介軟體 (libsdv_mw_clientlib) 的服務套件不受影響。

強制更新 OS 和建構指令碼

將建構管道、Cuttlefish 啟動指令碼和系統映像檔從 Android 17 移至 Android 17 QPR2 時,請更新產品目標、自訂分區路徑、代理程式路徑和 Health Monitor 啟動逾時屬性,如下表所示。

領域 Android 17 (AAOS 26Q2) Android 17 QPR2 (AAOS 26Q4)
SDV Core lunch 目標 sdv_core_cf-aosp_current-userdebug、sdv_core_arm64-aosp_current-userdebug、sdv_core_perf_cf-aosp_current-userdebug、sdv_core_tiny_cf-aosp_current-userdebug aosp_cf_x86_64_sdv_core-aosp_current-userdebug、aosp_cf_arm64_sdv_core-aosp_current-userdebug、aosp_cf_x86_64_sdv_core_perf-aosp_current-userdebug、aosp_cf_x86_64_sdv_core_tiny-aosp_current-userdebug。詳情請參閱「下載、建構及執行」。
SDV 媒體和 HAR lunch 目標 sdv_media_cf-aosp_current-userdebug 和 sdv_media_har_cf-aosp_current-userdebug 分開 (ARM64 上的 sdv_media_arm64 和 sdv_media_har_arm64) 統一為 aosp_cf_x86_64_sdv_media-aosp_current-userdebug 和 aosp_cf_arm64_sdv_media-aosp_current-userdebug,並支援高可用性轉譯器 (HAR)。sdv_media_har_cf 仍是已淘汰的包裝函式,sdv_media_har_arm64 則已移除。詳情請參閱「開始使用 Display Safety」。
SDV IVI lunch 目標 sdv_ivi_cf-aosp_current-userdebug 和獨立的 sdv_ivi_cf_ds-aosp_current-userdebug (ARM64 上的 sdv_ivi_arm64-aosp_current-userdebug 和 sdv_ivi_arm64_ds-aosp_current-userdebug) sdv_ivi_cf-aosp_current-userdebug 和 sdv_ivi_arm64-aosp_current-userdebug 做為主要 IVI 目標,並包含螢幕安全功能。此外,您也可以使用過渡期 aosp_cf_x86_64_auto_sdv 和 aosp_cf_arm64_auto_sdv 別名,而 sdv_ivi_cf_ds 和 sdv_ivi_arm64_ds 仍僅做為已淘汰的包裝函式。
原始設備製造商 (OEM) A/B 分區映像檔 單一稀疏映像檔透過 --custom_partition_path="$OUT/oem_ab.img;$OUT/oem_ab.img;$OUT/oem_ab_metadata.img" 傳遞兩次 兩個非稀疏 64 MiB f2fs 插槽映像檔,加上 1 MiB ext4 中繼資料,透過 --custom_partition_path="$OUT/oem_ab_a.img;$OUT/oem_ab_b.img;$OUT/oem_ab_metadata.img" 傳遞。詳情請參閱「原始設備製造商 (OEM) AB 分區更新」。
IVI 上的 SDV 閘道 libsdvgatewayclient 透過中介 sdv_gateway 守護程序轉送要求 sdv_gateway 守護程序已移除;libsdvgatewayclient 會直接連線至 IVI 通訊代理程式。詳情請參閱「在 IVI 上使用 SDV Gateway」。
核心 SDV 代理分區 安裝在 /system_ext 下的核心 SDV 代理 核心 SDV 代理程式已從 /system_ext 遷移至 /system (sdv_diagnostics_agent 仍位於 /product/bin/ 下方,sdv_someip_stack_agent 仍位於 /vendor/bin/ 下方)。請更新核心代理程式的硬式編碼指令碼、SELinux 或測試二進位檔路徑。
健康狀態監控啟動逾時 全域 ro.boot.sdv.health_monitor.agent_startup_timeout_sec 屬性 (從 androidboot.sdv.health_monitor.agent_startup_timeout_sec 對應) 和 HealthMonitorConfiguration (health_monitor_config.proto) 位於 ro.sdv.health_monitor.config_path 已移除「ro.boot.sdv.health_monitor.agent_startup_timeout_sec」。在 ro.sdv.health_monitor.config_path 的 HealthMonitorConfiguration 中,為 BinderServiceAgent 設定每個代理程式的 binder_timeout_ms (預設為 3,000 毫秒)。詳情請參閱「健康狀態監控」。

Migrate Health Monitor 啟動逾時

如果虛擬機器 (VM) 覆寫代理程式啟動逾時,或在兩個版本中維護共用分支,請比較每個版本的每 VM Health Monitor 設定:

AAOS 26Q4

從 BOARD_BOOTCONFIG 和主機板屬性檔案中移除 androidboot.sdv.health_monitor.agent_startup_timeout_sec (Android init 會將其公開為 ro.boot.sdv.health_monitor.agent_startup_timeout_sec)。在 ro.sdv.health_monitor.config_path 參照的 HealthMonitorConfiguration textproto 檔案 (health_monitor_config.proto) 中,為每個 monitored_agent 設定 binder_timeout_ms (如省略,預設為 3,000 毫秒),或使用 persist.sdv.health_monitor.config_path 動態覆寫:

period_ms: 100
monitored_agent {
  agent_name: "sdv_dt_agent"
  binder_interface_name: "google.sdv.data_tunnel.IAgentService/default"
  binder_timeout_ms: 3000
}
monitored_agent {
  agent_name: "sdv_rpc_agent"
  binder_interface_name: "google.sdv.rpc.IRpcAgent/default"
  binder_timeout_ms: 5000
}

AAOS 26Q2

在固定至 Android 17 的分支版本上,保留 ro.sdv.health_monitor.config_path 參照 (或以 persist.sdv.health_monitor.config_path 覆寫) 的 HealthMonitorConfiguration textproto 檔案 (health_monitor_config.proto),並透過 BOARD_BOOTCONFIG 中的 androidboot.sdv.health_monitor.agent_startup_timeout_sec 設定全域啟動逾時 (在執行階段公開為 ro.boot.sdv.health_monitor.agent_startup_timeout_sec):

period_ms: 100
monitored_agent {
  agent_name: "sdv_dt_agent"
  binder_interface_name: "google.sdv.data_tunnel.IAgentService/default"
}
monitored_agent {
  agent_name: "sdv_rpc_agent"
  binder_interface_name: "google.sdv.rpc.IRpcAgent/default"
}

詳情請參閱「健康狀態監控」。

逐步遷移至 VSIDL 系統圖

在 Android 17 QPR2 中,您可以使用 VSIDL 檔案中的宣告式 apex 和 host 區塊,取代手動逐一封裝和設定樣板。vsidlc 編譯系統圖時,會透過 E421 驗證系統圖結構規則 E40F,以及相關的 E1xx、E2xx、E3xx、E5xx 和 E6xx 檢查 (可使用 vsidlc --explain <CODE> 檢查,例如 vsidlc --explain E41F),並在 <output>/generated/ 下寫入產生的 Soong 模組和設定。

下表列出各項 Android 17 手動構件,以及對應的 Android 17 QPR2 系統圖。

工作流程或構件 Android 17 手動工作流程 Android 17 QPR2 VSIDL 系統圖
APEX 封裝和套件資訊清單 手動Android.bp、apex_manifest.json和sdv_service_bundles_manifest.textproto VSIDL 中的 apex { service_bundle_manifest { ... } } 會在 <output>/generated/apex/ 下產生建構目標,並使用 native_library 建立自訂 C++ 或 Rust Soong 目標。詳情請參閱「定義系統圖」和「服務套件中繼資料」。
授權政策 手寫configs/permissions.textproto 系統會根據宣告的 service_bundle 單位,自動生成最小權限 permissions.textproto,並使用 authz { src: "..." } 覆寫自訂政策。詳情請參閱「授權政策」。
生命週期自動化調度管理 手寫的每個套件和每個 VM 自動化調度管理工具 textproto 檔案 VSIDL 中的 host { vm { orchestration { ... } instance { ... } } };自訂模式會繼續使用以 orchestration { src: "..." } 參照的手動檔案。詳情請參閱「設定 Orchestrator」。
健康狀態和 QoS 監控 手寫健康狀況 textproto 檔案 VSIDL 中的 instance { health { ... } qos { ... } };編譯器檢查 E41F 要求含有 instance.health 的套件宣告 com.android.sdv.health.ServiceHeartbeat 發布者。詳情請參閱「健康狀態監控」。
SOME/IP 執行階段設定 vsidl_rc_generator 建構規則與 some_ip_mapping 分開 vsidl_rc_generator 已整合至 vsidlc,並將 someip-config.binpb 和 vsidl-config.binpb 封裝至 APEX。詳情請參閱「整合 SOME/IP 與 SDV」。
手寫 Rust 程式碼 services/<Bundle>/src/main.rs 複製到 vsidlc 輸出目錄外 vsidlc --services 會將可修改的程式碼隔離在 <output>/hwc/services/<package_path>/<Bundle>/src/main.rs (或透過 --hwc <dir> 傳遞的自訂目錄) 中,同時在 <output>/generated/services/ 下寫入產生的規則。詳情請參閱「實作商業邏輯」。
內部迴圈部署 遞增 APEX 版本、推送至 /data/mydir/,並透過 sdv_update_manager_client 暫存 在 aosp_cf_x86_64_sdv_core 和 aosp_cf_arm64_sdv_core userdebug 建構作業中,執行 adb root && adb remount -R 一次,然後將重新建構的 APEX 檔案直接推送至 /product/apex/,並執行 adb reboot 啟用變更,不必透過更新管理工具重新暫存。您也可以直接從 Android Studio for Platform 部署。詳情請參閱「在開發期間快速更新服務套件」和「設定 SDV 開發 IDE」。

如要進一步瞭解如何定義 apex 和 host 區塊,請參閱「定義系統圖」和「建構及部署服務套件」。