Add VUR to VHAL interface.

Add enableVariableUpdateRate to subscribe options and
supportVariableUpdateRate to VehicleAreaConfig. If variable update
rate is enabled, VHAL will only send property change events for
continuous property if the property's value changes. This is for
improving performance and not send duplicate events.

Test: m
Bug: 306754638
Change-Id: Ic0d1ec2ebbf8ed6c26da3f3b820ac85e9c345b2c
This commit is contained in:
Yu Shan
2023-10-20 17:28:37 -07:00
parent e5b20b1926
commit d5fa689e43
5 changed files with 45 additions and 0 deletions

View File

@@ -38,4 +38,5 @@ parcelable SubscribeOptions {
int[] areaIds;
float sampleRate;
float resolution = 0.0f;
boolean enableVariableUpdateRate;
}

View File

@@ -43,4 +43,5 @@ parcelable VehicleAreaConfig {
float maxFloatValue;
@nullable long[] supportedEnumValues;
android.hardware.automotive.vehicle.VehiclePropertyAccess access = android.hardware.automotive.vehicle.VehiclePropertyAccess.NONE;
boolean supportVariableUpdateRate;
}

View File

@@ -49,4 +49,19 @@ parcelable SubscribeOptions {
* 10, VHAL should return a StatusCode::INVALID_ARG.
*/
float resolution = 0.0f;
/**
* Whether to enable variable update rate.
*
* This only applies for continuous property. If variable update rate is
* enabled, for each given areaId, if VHAL supports variable update rate for
* the [propId, areaId], VHAL must ignore duplicate property value events
* and only sends changed value events (a.k.a treat continuous as an
* on-change property).
*
* If VHAL does not support variable update rate for the [propId, areaId],
* indicated by 'supportVariableUpdateRate' in 'VehicleAreaConfig', or if
* this property is not a continuous property, this option must be ignored.
*/
boolean enableVariableUpdateRate;
}

View File

@@ -70,4 +70,31 @@ parcelable VehicleAreaConfig {
* well.
*/
VehiclePropertyAccess access = VehiclePropertyAccess.NONE;
/**
* Whether variable update rate is supported.
*
* This applies for continuous property only.
*
* It is HIGHLY RECOMMENDED to support variable update rate for all non-heartbeat continuous
* properties for better performance.
*
* If variable update rate is supported and 'enableVariableUpdateRate' is true in subscribe
* options, VHAL must only sends property update event when the property's value changes
* (a.k.a treat continuous as an on-change property).
*
* E.g. if the client is subscribing at 5hz at time 0. If the property's value is 0 initially
* and becomes 1 after 1 second.
* If variable update rate is not enabled, VHAL clients will receive 5 property change events
* with value 0 and 5 events with value 1 after 2 seconds.
*
* If variable update rate is enabled, VHAL clients will receive 1 property change event
* with value 1 at time 1s. VHAL may/may not send a property event for the initial value (e.g.
* a property change event with value 0 at time 0s). VHAL client must not rely on the first
* property event, and must use getValues to fetch the initial value. In fact, car service is
* using getValues to fetch the initial value, convert it to a property event and deliver to
* car service clients.
*/
boolean supportVariableUpdateRate;
}

View File

@@ -44,4 +44,5 @@ message VehicleAreaConfig {
*/
repeated int64 supported_enum_values = 8;
int32 access = 9;
bool support_variable_update_rate = 10;
};