summaryrefslogtreecommitdiffstats
path: root/automotive/vehicle
diff options
context:
space:
mode:
authorEnrico Granata <egranata@google.com>2017-09-11 15:06:40 -0700
committerEnrico Granata <egranata@google.com>2017-09-11 15:06:40 -0700
commitad2baebb3b1c4455d3f7fe3cfd9f91e2a1442c15 (patch)
treebb13bd27f8e9682accc2e5eb921e654823e5b85a /automotive/vehicle
parent62cc79bdf0c52c773602d9e93bbf732b1c54b934 (diff)
downloadandroid_hardware_interfaces-ad2baebb3b1c4455d3f7fe3cfd9f91e2a1442c15.tar.gz
android_hardware_interfaces-ad2baebb3b1c4455d3f7fe3cfd9f91e2a1442c15.tar.bz2
android_hardware_interfaces-ad2baebb3b1c4455d3f7fe3cfd9f91e2a1442c15.zip
Do not write initial empty values for the diagnostic properties.
There is a separate step that initializes them with meaningful values. Change-Id: I2480a029773b62b0e77b8c52c73f2ee465caf17c Fixes: b/65125128 Test: runtest -x packages/services/Car/tests/android_car_api_test/src/android/car/apitest/CarDiagnosticManagerTest.java
Diffstat (limited to 'automotive/vehicle')
-rw-r--r--automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp
index 385f03de5..6bc052240 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp
@@ -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;