自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
車輛服務功能控制
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
根據預設,大多數的汽車服務都是強制啟用,且一律會啟用。不過,您可以將部分車輛服務指定為選用,因為某些功能可能無法在所有車輛上使用。
選用功能清單
下表列出可啟用和停用的選用車輛控制功能。
車輛控制功能 |
字串值 |
---|
車輛 EVS 服務 |
car_evs_service |
汽車實驗性防護鍵服務 |
experimental_car_keyguard_service |
汽車導航服務 |
car_navigation_service |
車輛乘客連線服務 |
car_occupant_connection_service |
汽車遠端存取服務 |
car_remote_access_service |
汽車遠端裝置服務 |
car_remote_device_service |
車輛遙測服務 |
car_telemetry_service |
車輛使用者通知服務 |
com.android.car.user.CarUserNoticeService |
叢集主畫面服務 |
cluster_home_service |
診斷服務 |
diagnostic |
乘客感知服務 |
occupant_awareness |
儲存空間監控服務 |
storage_monitoring |
車輛地圖服務 |
vehicle_map_service |
啟用及停用車輛控制功能
您可以透過兩種方式控制版本中功能的支援情形,包括使用執行階段資源覆蓋層 (RRO) 或透過 Vehicle Hardware Abstraction Layer (VHAL)。
使用 RRO
使用名為 config_allowed_optional_car_features
的資源設定,其中列出可啟用的所有選用功能。汽車首次啟動時,系統會記錄可能的選用車輛功能,並在 VHAL 未將這些功能列入封鎖清單的情況下啟用。如要進一步瞭解 RRO,請參閱「在執行階段變更應用程式資源的值」。
使用 VHAL
車輛硬體抽象層 (VHAL) 會做為封鎖清單,用於停用特定選用功能,藉此控制功能。名為 DISABLED_OPTIONAL_FEATURES
的 VHAL 屬性會列出要停用的疊加層選用功能。如果這個屬性不存在,則系統會啟用 RRO 的選用功能清單。如要進一步瞭解 VHAL,請參閱 VHAL 總覽。
使用偵錯殼層指令
第三種控制啟用或停用選用功能的方式,是使用一組殼層指令,這類指令僅適用於 user-debug
版本,並提供給開發人員使用。「選用功能清單」中的表格包含可用來取代 <FEATURE_STRING_VALUE>
的值。
如要啟用功能,請按照下列步驟操作:
adb root; adb shell cmd car_service enable-feature <FEATURE_STRING_VALUE>; adb reboot
如要停用功能,請按照下列步驟操作:
adb root; adb shell cmd car_service disable-feature <FEATURE_STRING_VALUE>; adb reboot
判斷已啟用的功能
偵錯特定功能相關問題時,建議您先瞭解哪些功能已啟用,以及原因為何。如要轉儲 feature-related
資訊,請執行:
adb shell dumpsys car_service --services CarFeatureController
這個指令會列出下列資訊類型。
值 |
說明 |
---|
mEnabledFeatures |
目前已啟用的功能。 |
mDefaultEnabledFeaturesFromConfig |
config_allowed_optional_car_features 中列出的選用功能。 |
mDisabledFeaturesFromVhal |
在 VHAL 屬性 DISABLED_OPTIONAL_FEATURES 中,由 VHAL 指定要停用的功能。 |
mPendingEnabledFeatures |
重新啟動時要啟用的功能。 |
mPendingDisabledFeatures |
重新啟動後要停用的功能。 |
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。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,["# Car service feature control\n\nBy default, most car services are mandatory and are always enabled. However, you can\ndesignate a subset of car services to be *optional* because some features might not\nbe supported in every car.\n\nList of optional features\n-------------------------\n\nThe optional car control features you can enable and disable are listed in the table below.\n\n| Car control feature | String value |\n|-----------------------------------|---------------------------------------------|\n| Car EVS service | `car_evs_service` |\n| Car experimental keyguard service | `experimental_car_keyguard_service` |\n| Car navigation service | `car_navigation_service` |\n| Car occupant connection service | `car_occupant_connection_service` |\n| Car remote access service | `car_remote_access_service` |\n| Car remote device service | `car_remote_device_service` |\n| Car telemetry service | `car_telemetry_service` |\n| Car user notice service | `com.android.car.user.CarUserNoticeService` |\n| Cluster home service | `cluster_home_service` |\n| Diagnostic service | `diagnostic` |\n| Occupant awareness wervice | `occupant_awareness` |\n| Storage monitoring service | `storage_monitoring` |\n| Vehicle map service | `vehicle_map_service` |\n\nEnable and disable car control features\n---------------------------------------\n\nYou can control support for features in your builds in one of two ways, either with\nruntime resource overlays (RROs) or through the Vehicle Hardware Abstraction Layer (VHAL).\n\n### Use RROs\n\nUse the resource configuration named `config_allowed_optional_car_features`, which\nlists all the optional features you can enable. When a car is first booted up, possible\noptional car features are noted and are enabled if they're not blocklisted by the VHAL.\nTo learn more RROs, see\n[Change the value of an app's resources at runtime.](/docs/core/runtime/rros)\n\n### Use the VHAL\n\nThe Vehicle Hardware Abstraction Layer (VHAL) controls features by serving as a\nblocklist to disable specific optional features. The VHAL property named\n`DISABLED_OPTIONAL_FEATURES` lists the optional features in the overlay that\nare to be disabled. If this property doesn't exist, then the list of optional features from\nthe RROs are all enabled. To learn more about the VHAL, see the\n[VHAL overview](/docs/automotive/vhal).\n\n### Use debug shell commands\n\nA third way to control which optional features to enable or disable is through the use of a\npair of shell commands, which are available only in `user-debug` builds and are\nprovided for use by developers. The table in\n[List of optional features](#list) contains the values to use instead of\n`\u003cFEATURE_STRING_VALUE\u003e`.\n\nTo enable a feature: \n\n```\nadb root; adb shell cmd car_service enable-feature \u003cFEATURE_STRING_VALUE\u003e; adb reboot\n```\n\nTo disable a feature: \n\n```\nadb root; adb shell cmd car_service disable-feature \u003cFEATURE_STRING_VALUE\u003e; adb reboot\n```\n\nDetermine which features are enabled\n------------------------------------\n\nWhen debugging issues related to specific features, it can be helpful to know which features are\nenabled and why. To dump `feature-related` information, run: \n\n```\nadb shell dumpsys car_service --services CarFeatureController\n```\n\nThis command lists the types of information shown below.\n\n| Value | Description |\n|-------------------------------------|---------------------------------------------------------------------------------------------------|\n| `mEnabledFeatures` | Currently enabled features. |\n| `mDefaultEnabledFeaturesFromConfig` | Optional features listed in `config_allowed_optional_car_features`. |\n| `mDisabledFeaturesFromVhal` | Features specified by the VHAL to be disabled in the VHAL property, `DISABLED_OPTIONAL_FEATURES`. |\n| `mPendingEnabledFeatures` | Features to be enabled upon a reboot. |\n| `mPendingDisabledFeatures` | Features to be disabled after a reboot. |"]]