Do not write initial empty values for the diagnostic properties. There is a separate step that initializes them with meaningful values. am: ad2baebb3b

am: 8beffc61fb

Change-Id: I239505a8b1a4b3cb90a02e7980d256c9e9222678
This commit is contained in:
Enrico Granata 2017-09-12 02:17:30 +00:00 committed by android-build-merger
commit 3b62ca8ce2

View file

@ -162,12 +162,29 @@ StatusCode EmulatedVehicleHal::set(const VehiclePropValue& propValue) {
return StatusCode::OK;
}
static bool isDiagnosticProperty(VehiclePropConfig propConfig) {
switch (propConfig.prop) {
case OBD2_LIVE_FRAME:
case OBD2_FREEZE_FRAME:
case OBD2_FREEZE_FRAME_CLEAR:
case OBD2_FREEZE_FRAME_INFO:
return true;
}
return false;
}
// Parse supported properties list and generate vector of property values to hold current values.
void EmulatedVehicleHal::onCreate() {
for (auto& it : kVehicleProperties) {
VehiclePropConfig cfg = it.config;
int32_t supportedAreas = cfg.supportedAreas;
if (isDiagnosticProperty(cfg)) {
// do not write an initial empty value for the diagnostic properties
// as we will initialize those separately.
continue;
}
// A global property will have supportedAreas = 0
if (isGlobalProp(cfg.prop)) {
supportedAreas = 0;