自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
偵錯 VHAL
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
您可以使用下列指令轉儲 VHAL 偵錯資訊。這會呼叫 VHAL 介面中的 dump()
方法,該方法並未列於介面中,但會為所有 AIDL 服務隱含繼承,並提供指令中提供的所有額外引數。
adb root && adb shell dumpsys android.hardware.automotive.vehicle.IVehicle/default
使用下列指令列出參考 VHAL 支援的偵錯指令:
adb root && adb shell dumpsys android.hardware.automotive.vehicle.IVehicle/default --help
舉例來說,參考 VHAL 支援透過以下方式讀取屬性值 (例如 INFO_VIN
):
adb root && adb shell dumpsys android.hardware.automotive.vehicle.IVehicle/default --get INFO_VIN
或
adb root && adb shell dumpsys android.hardware.automotive.vehicle.IVehicle/default --get 0x11100100
如要設定屬性值,請使用 --set
,例如將區域 ID ROW_1_LEFT
的 SEAT_MEMORY_SELECT
設為 1
值:
adb root && adb shell dumpsys android.hardware.automotive.vehicle.IVehicle/default --set SEAT_MEMORY_SELECT -a ROW_1_LEFT -i 1
針對 HIDL VHAL,請使用:
adb root && adb shell lshal debug android.hardware.automotive.vehicle@2.0::IVehicle/default
您也可以使用 VTS 測試 (VtsHalAutomotiveVehicle_TargetTest
) 驗證 VHAL 導入作業。如果無法使用特定後端,系統會略過 useAidlBackend
或 useHidlBackend
測試案例。如果後端不支援這項功能,您也可以略過 AIDL 或 HIDL 後端的部分測試。
VTS 測試會驗證所有支援的系統屬性是否有正確的設定。並驗證支援屬性的基本 VHAL 作業。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-26 (世界標準時間)。"],[],[],null,["# Debug VHAL\n\nYou can use the following instructions to dump VHAL debug information. This calls the\n`dump()` method in the VHAL interface, which isn't listed in the interface but is\nimplicitly inherited for all AIDL services, with all the additional arguments provided in the\ncommand. \n\n```\nadb root && adb shell dumpsys android.hardware.automotive.vehicle.IVehicle/default\n```\n\nUse the following command to list the supported debug commands for the reference VHAL: \n\n```\nadb root && adb shell dumpsys android.hardware.automotive.vehicle.IVehicle/default --help\n```\n\nFor example, the reference VHAL supports reading a property value\n(such as `INFO_VIN`) through: \n\n```\nadb root && adb shell dumpsys android.hardware.automotive.vehicle.IVehicle/default --get INFO_VIN\n```\nor \n\n```\nadb root && adb shell dumpsys android.hardware.automotive.vehicle.IVehicle/default --get 0x11100100\n```\n\nTo set a property value, use `--set`, for example, to set `SEAT_MEMORY_SELECT`\nfor the area ID: `ROW_1_LEFT` to value `1`: \n\n```\nadb root && adb shell dumpsys android.hardware.automotive.vehicle.IVehicle/default --set SEAT_MEMORY_SELECT -a ROW_1_LEFT -i 1\n```\n\nFor the HIDL VHAL, use: \n\n```\nadb root && adb shell lshal debug android.hardware.automotive.vehicle@2.0::IVehicle/default\n```\n\nYou can also use the VTS test,\n[`VtsHalAutomotiveVehicle_TargetTest`](https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/android16-release/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp),\nto verify your VHAL implementation. Either test case, `useAidlBackend` or\n`useHidlBackend`, is skipped if the specific backend isn't available. Some tests\ncan also be skipped for the AIDL or HIDL backend if the backend doesn't support this feature.\n\nThe VTS test verifies all supported system properties has correct configurations. It also\nverifies basic VHAL operations for supported properties."]]