diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SubscribeOptions.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SubscribeOptions.aidl index 23fc8a92b4..1b1696b240 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SubscribeOptions.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SubscribeOptions.aidl @@ -38,4 +38,5 @@ parcelable SubscribeOptions { int[] areaIds; float sampleRate; float resolution = 0.0f; + boolean enableVariableUpdateRate; } diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl index 3322769071..08d4ee46e8 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl @@ -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; } diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SubscribeOptions.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SubscribeOptions.aidl index 1f2fb2754e..69f6190363 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SubscribeOptions.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SubscribeOptions.aidl @@ -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; } diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl index 9fd9bda3f8..08863b2576 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl @@ -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; } diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehicleAreaConfig.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehicleAreaConfig.proto index 04b7dd4d82..8093658477 100644 --- a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehicleAreaConfig.proto +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehicleAreaConfig.proto @@ -44,4 +44,5 @@ message VehicleAreaConfig { */ repeated int64 supported_enum_values = 8; int32 access = 9; + bool support_variable_update_rate = 10; };