如何在 android Automotive VHAL 中创建自定义车辆属性?
如何生成 PropertyID 以及如何从 CarPropertyManager 访问它?
我在下面找到了参考,但对此我不清楚:
https://source.android.com/devices/automotive/properties#prop_custom][1]
如何在 android Automotive VHAL 中创建自定义车辆属性?
如何生成 PropertyID 以及如何从 CarPropertyManager 访问它?
我在下面找到了参考,但对此我不清楚:
https://source.android.com/devices/automotive/properties#prop_custom][1]
使用以下属性自定义车辆属性:
EXAMPLE_PROPERTY = (
0xXXXX
| VehiclePropertyGroup:VENDOR
| VehiclePropertyType:STRING
| VehicleArea:GLOBAL),
可以通过 CarPropertyManager 访问自定义属性。我们只为所有供应商属性定义了一项权限:Car.PERMISSION_VENDOR_EXTENDSION (Android 10)
检查这个https://source.android.com/devices/automotive/vhal/properties#handling-custom-properties
在 Android 11 上,车辆 hal 支持通过 SUPPORT_CUSTOMIZE_VENDOR_PERMISSION 自定义供应商权限功能
/**
* Support customize permissions for vendor properties
*
* Implement this property if vehicle hal support customize vendor permissions feature.
* VehiclePropConfig.configArray is used to indicate vendor properties and permissions
* which selected for this vendor property. The permission must be one of enum in
* VehicleVendorPermission.
* The configArray is set as follows:
* configArray[n] = propId : property ID for the vendor property
* configArray[n+1] = one of enums in VehicleVendorPermission. It indicates the permission
* for reading value of the property.
* configArray[n+2] = one of enums in VehicleVendorPermission. It indicates the permission
* for writing value of the property.
*
* For example:
* configArray = {
* vendor_prop_1, PERMISSION_VENDOR_SEAT_READ, PERMISSION_VENDOR_SEAT_WRITE,
* vendor_prop_2, PERMISSION_VENDOR_INFO, PERMISSION_NOT_ACCESSIBLE,
* }
* If vendor properties are not in this array, they will have the default vendor permission.
* If vendor chose PERMISSION_NOT_ACCESSIBLE, android will not have access to the property. In
* the example, Android can not write value for vendor_prop_2.
*
* @change_mode VehiclePropertyChangeMode:STATIC
* @access VehiclePropertyAccess:READ
*/
SUPPORT_CUSTOMIZE_VENDOR_PERMISSION = (
0x0F05
| VehiclePropertyGroup:SYSTEM
| VehiclePropertyType:BOOLEAN
| VehicleArea:GLOBAL),
附注
Vendors are allowed to extend this enum with their own properties
In this case they must use VehiclePropertyGroup:VENDOR flag when property is
declared.
您必须扩展枚举 VehicleProperty,然后通过 CarPropertyManager 使其可用,并且可以通过 CarPropertyValue 获得价值