Fix sensor event in vehicle HAL emulator
Test: verified events are now gets propagated to CarSensorManager
(toggle day/night mode in Emulator UI)
Change-Id: Ifc4a755c5f6d31f41ab26ebc873c66c43d9e234a
Fix: b/35926101
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.cpp
index 7a66c04..e1a3ae7 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.cpp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.cpp
@@ -118,6 +118,7 @@
val.prop = protoVal.prop();
val.areaId = protoVal.area_id();
+ val.timestamp = elapsedRealtimeNano();
// Copy value data if it is set. This automatically handles complex data types if needed.
if (protoVal.has_string_value()) {
@@ -453,7 +454,7 @@
VehiclePropValue* internalPropValue = getVehiclePropValueLocked(propId, areaId);
if (internalPropValue != nullptr) {
internalPropValue->value = propValue.value;
- internalPropValue->timestamp = elapsedRealtimeNano();
+ internalPropValue->timestamp = propValue.timestamp;
status = StatusCode::OK;
}
}