Add timestamp for continuously property.

Bug: 148960132
Test: 1. apply google vhal to device
      2. atest CtsCarTestCases:CarPropertyManagerTest

Change-Id: Ib6690b5e242287958017c87632f56a546d418674
This commit is contained in:
Kai
2020-02-26 13:00:16 -08:00
committed by Kai Wang
parent 2056c2da3b
commit 47a9378d4d
2 changed files with 6 additions and 1 deletions

View File

@@ -58,6 +58,8 @@ bool VehiclePropertyStore::writeValue(const VehiclePropValue& propValue,
return false;
}
// update the propertyValue.
// The timestamp in propertyStore should only be updated by the server side. It indicates
// the time when the event is generated by the server.
valueToUpdate->timestamp = propValue.timestamp;
valueToUpdate->value = propValue.value;
if (updateStatus) {

View File

@@ -127,7 +127,9 @@ VehicleHal::VehiclePropValuePtr EmulatedVehicleHal::get(
*outStatus = v != nullptr ? StatusCode::OK : StatusCode::INVALID_ARG;
break;
}
if (v.get()) {
v->timestamp = elapsedRealtimeNano();
}
return v;
}
@@ -284,6 +286,7 @@ void EmulatedVehicleHal::onContinuousPropertyTimer(const std::vector<int32_t>& p
}
if (v.get()) {
v->timestamp = elapsedRealtimeNano();
doHalEvent(std::move(v));
}
}