自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
汽车服务功能控件
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
默认情况下,大多数汽车服务都是强制性的,且始终处于启用状态。不过,您可以将一部分汽车服务指定为“可选”,因为某些功能可能并非在所有汽车上都受支持。
可选功能列表
下表列出了您可以启用和停用的可选汽车控制功能。
汽车控制功能 |
字符串值 |
---|
汽车 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) 或车载硬件抽象层 (VHAL) 这两种方式之一来控制对 build 中功能的支持。
使用 RRO
使用名为 config_allowed_optional_car_features
的资源配置,其中列出了您可以启用的所有可选功能。当汽车首次启动时,系统会记录可能的可选汽车功能,并且如果这些功能未被 VHAL 列入屏蔽名单,系统会启用这些功能。如需详细了解 RRO,请参阅在运行时更改应用资源的值。
使用 VHAL
车载硬件抽象层 (VHAL) 通过作为停用特定可选功能的屏蔽名单来控制功能。名为 DISABLED_OPTIONAL_FEATURES
的 VHAL 属性列出了叠加层中要被停用的可选功能。如果此属性不存在,则 RRO 中列出的可选功能将全部启用。如需详细了解 VHAL,请参阅 VHAL 概览。
使用调试 shell 命令
控制要启用或停用哪些可选功能还有第三种方法,那就是使用一对仅在 user-debug
build 中可用的 shell 命令,这些命令专供开发者使用。可选功能列表部分的表格列出了要用来代替 <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 指定要在 VHAL 属性 DISABLED_OPTIONAL_FEATURES 中停用的功能。 |
mPendingEnabledFeatures |
要在重新启动后启用的功能。 |
mPendingDisabledFeatures |
要在重新启动后停用的功能。 |
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-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"]],["最后更新时间 (UTC):2025-03-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. |"]]