自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
車輛系統隔離
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
為確保車輛系統完整性,Android Automotive 會在以下層級保護傳入的資料:
圖 1. 系統服務架構
- 應用程式:系統會驗證應用程式是否有權與 Car 子系統通訊。
- 明確定義的 API。通用 API 不接受任意資料 Blob (API 必須明確定義)。
- 汽車服務。僅允許透過 OTA (或 USB) 進行更新,並採用全磁碟加密和驗證啟動功能。無法側載。
- 車輛 HAL。驗證是否允許特定訊息。
應用程式和 API
Android Automotive 是建構於 Android 之上,可直接與許多攸關安全性的子系統互動。此外,不同車輛可能會提供不同的介面,並向 Android 公開不同的功能。為確保這些功能安全且順暢,我們將這些功能隔離在抽象層中,與 Android 的其他部分分開。只有明確定義的 API 可與車輛 HAL 通訊,這些 API 會對透過車內網路傳送的訊息進行嚴格格式設定。這可為 Android 開發人員提供可預測的介面,並提供與車輛其他部分的安全互動。
車輛 HAL 訊息會經過兩個層級的篩選:
- 應用程式層級:非系統應用程式可透過具備適當權限的車輛服務存取車輛 HAL。
- 車輛 HAL 層級。可提供額外一層防護,確保傳送至車輛子系統的訊息來自合法來源。也可以用來限制訊息傳送頻率,防止惡意應用程式大量傳送訊息,進而干擾車輛子系統。
車輛 HAL
Vehicle HAL 是與車輛互動的較低層,可透過驅動程式輸入/輸出控制 (ioctl) 呼叫,與車內網路和其他車輛硬體通訊。
車輛 HAL 是 Android Automotive 中唯一連線至 IVI 系統的元件,可透過直接應用程式處理器/微控制器連線,或透過 VMCU 限制。車輛 HAL 的存取權應限制在使用 SELinux 規則和核心介面適當權限的系統應用程式。
SELinux 政策
Android Automotive 會擴充 SELinux,用於篩選驅動程式存取權,包括開啟、關閉、讀取、寫入和 ioctl 呼叫。使用 ioctl 篩選 (以及其他 SELinux 功能) 可限制 Vehicle HAL 允許及接受的 CAN 訊息類型,大幅減少攻擊面。如要進一步瞭解 SELinux,請參閱「Android 中的安全增強式 Linux」。
此外,汽車用途包括應隔離及控管的新類型敏感資料。機密資料有獨立的權限;其他功能 (例如 HVAC 控制和視窗調整) 則應只提供給系統應用程式。汽車專屬 SELinux 政策範例:
<permission-group
android:name=”android.support.car.permission.CAR_MONITORING />
<permission
android:name=”android.support.car.permission.CAR_MILEAGE”
android:protectionLevel=”signature|privileged” />
<permission
android:name=”android.support.car.permission.CAR_SPEED”
android:permissionGroup=”android.permission-group.LOCATION”
android:protectionLevel=”dangerous” />
<permission
android:name=”android.support.car.permission.CAR_VENDOR_EXTENSION”
android:permissionGroup=”android.support.car.permission.CAR_INFORMATION”
android:protectionLevel=”signature|privileged” />
CAR_MONITORING
權限群組是為了汽車相關權限而建立。目前的速度可能屬於私密資訊。因此,CAR_SPEED
權限的防護等級為「危險」。這表示資訊屬於私密和敏感資訊。權限 CAR_VENDOR_EXTENSION
是使用系統或簽章層級權限建立,適用於明確授予此權限的系統應用程式或已簽署的應用程式。
應用程式和活動封鎖功能
為減少駕駛時分心,Android Automotive 提供額外控制項 (許可清單),確保車輛行駛時無法使用側載應用程式。這些應用程式在車輛停車或停止時仍可運作。
許可清單會指定車輛行駛時可使用的應用程式。只有可信任的系統應用程式可以更新許可清單。雖然更新可透過網路進行,但不應視為可靠的更新。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","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-27 (世界標準時間)。"],[],[],null,["# Vehicle system isolation\n\nTo ensure car system integrity, Android Automotive protects incoming data at these levels:\n\n**Figure 1.** System Service Architecture\n\n- **Apps.** System verifies an app has permission to talk to Car subsystems.\n- **Well-defined APIs.** Generic APIs do not accept arbitrary data blobs (APIs must be well defined).\n- **Car Service.** Updates allowed only through OTA (or USB), with full-disk encryption and verified boot. Can't be sideloaded.\n- **Vehicle HAL.** Verifies specific messages are allowed.\n\n### Apps and APIs\n\nAndroid Automotive is built on Android and interacts directly with numerous safety-critical\nsubsystems. In addition, different vehicles may have different interfaces with different\nfunctionalities exposed to Android. To make these functionalities safe and streamlined, they are\nisolated in an abstraction layer, separate from the rest of Android. Only *well-defined* APIs\nwith strict formatting on messages sent through in-vehicle networks can communicate with the Vehicle\nHAL. This provides a predictable interface for Android developers and provides a secure interaction\nwith the rest of the vehicle.\n\nVehicle HAL messages are filtered at two levels:\n\n- **App level.** Non-system apps can access vehicle HAL through car service with proper permissions.\n- **Vehicle HAL level.** Allows for an additional layer of protection and assurance that messages sent to vehicle subsystems originate from a legitimate source. Can also be used to rate limit messages, preventing malicious apps from flooding the CAN bus and potentially interfering with vehicle subsystems.\n\n### Vehicle HAL\n\nVehicle HAL is a lower layer that interacts with the vehicle, communicating with in-vehicle\nnetworks and other vehicular hardware through driver input/output control (ioctl) calls.\n\nThe vehicle HAL is the only component in Android Automotive connected to the IVI system, either\nthrough direct app processor/MicroController connection or gated through a VMCU. Access to the\nVehicle HAL should be restricted to system apps using SELinux rules and proper permissions\non kernel interfaces.\n\n### SELinux policies\n\nAndroid Automotive extends SELinux to filter driver access including open, close, read, write,\nand ioctl calls. Using ioctl filtering (along with other SELinux functionality) limits the type of\nCAN messages allowed and accepted by the Vehicle HAL, drastically reducing the attack surface. For\ndetails on SELinux, see\n[Security-Enhanced Linux in Android](/security/selinux).\n\nAdditionally, automotive use cases include new types of sensitive data that should be isolated\nand controlled. Sensitive data has separate permissions; other capabilities such as HVAC controls\nand window adjustment should be given only to system apps. Example of an Automotive-specific\nSELinux policy: \n\n```\n\u003cpermission-group\n android:name=”android.support.car.permission.CAR_MONITORING /\u003e\n\n\u003cpermission\n android:name=”android.support.car.permission.CAR_MILEAGE”\n android:protectionLevel=”signature|privileged” /\u003e\n\u003cpermission\n android:name=”android.support.car.permission.CAR_SPEED”\n android:permissionGroup=”android.permission-group.LOCATION”\n android:protectionLevel=”dangerous” /\u003e\n\u003cpermission\n android:name=”android.support.car.permission.CAR_VENDOR_EXTENSION”\n android:permissionGroup=”android.support.car.permission.CAR_INFORMATION”\n android:protectionLevel=”signature|privileged” /\u003e\n```\n\nThe `CAR_MONITORING` permission group was created for automotive-related permissions.\nCurrent speed can be regarded as sensitive information. Therefore, `CAR_SPEED`\npermissions were created with a protection level of *dangerous* . This level means the\ninformation is private and sensitive. The permission `CAR_VENDOR_EXTENSION` was created\nwith the system- or signature-level permission, which is used for system apps or signed apps that\nare explicitly granted this permission.\n\n### App and activity blocking\n\nTo reduce distracted driving, Android Automotive provides additional controls (a allowlist) to\nensure sideloaded apps can't be used when the vehicle is in motion. These apps can still\nrun when a vehicle is parked or stopped.\n\nThe allowlist specifies apps that can be used when the vehicle is moving. Only trusted\nsystem apps can update the allowlist. While updates can occur over the network, updates should not\nbe considered reliable."]]