Convert Vehicle Property to integer
This make sense for easier extending Vehicle Hal interface
by OEMs and creating new versions.
Test: adb shell "su system /data/nativetest/android.hardware.vehicle@2.0-manager-unit-tests/android.hardware.vehicle@2.0-manager-unit-tests" ; ENABLE_TREBLE=true make vts BUILD_GOOGLE_VTS=true -j32 && vts-tradefed run commandAndExit vts --skip-all-system-status-check --primary-abi-only --skip-preconditions --module VehicleHidlTest -l INFO
Change-Id: I02415a1c180a6d24fded48a1583f7cb150419820
Fix: b/34894217
diff --git a/vehicle/2.0/default/impl/DefaultVehicleHal.cpp b/vehicle/2.0/default/impl/DefaultVehicleHal.cpp
index 4541168..65bd49d 100644
--- a/vehicle/2.0/default/impl/DefaultVehicleHal.cpp
+++ b/vehicle/2.0/default/impl/DefaultVehicleHal.cpp
@@ -31,7 +31,7 @@
*outStatus = StatusCode::OK;
VehiclePropValuePtr v;
- VehicleProperty property = requestedPropValue.prop;
+ auto property = static_cast<VehicleProperty>(requestedPropValue.prop);
int32_t areaId = requestedPropValue.areaId;
auto& pool = *getValuePool();
@@ -103,7 +103,7 @@
}
if (StatusCode::OK == *outStatus && v.get() != nullptr) {
- v->prop = property;
+ v->prop = toInt(property);
v->areaId = areaId;
v->timestamp = elapsedRealtimeNano();
}
@@ -112,7 +112,7 @@
}
StatusCode DefaultVehicleHal::set(const VehiclePropValue& propValue) {
- auto property = propValue.prop;
+ auto property = static_cast<VehicleProperty>(propValue.prop);
const auto& v = propValue.value;
StatusCode status = StatusCode::OK;