Added resolution check in DefaultVehicleHal
Bug: 276124296
Test: atest DefaultVehicleHalTest
Change-Id: If53c6395a8ea9656e6b59a43872a0d9f6871dac5
diff --git a/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp
index cc5edcc..a29861f 100644
--- a/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp
+++ b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp
@@ -722,6 +722,10 @@
return StatusError(StatusCode::INVALID_ARG)
<< "invalid sample rate: " << sampleRateHz << " HZ";
}
+ if (!SubscriptionManager::checkResolution(option.resolution)) {
+ return StatusError(StatusCode::INVALID_ARG)
+ << "invalid resolution: " << option.resolution;
+ }
}
}
return {};
diff --git a/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp b/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp
index bb82108..11a8fc7 100644
--- a/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp
+++ b/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp
@@ -234,6 +234,14 @@
},
},
{
+ .name = "invalid_resolution",
+ .option =
+ {
+ .propId = GLOBAL_CONTINUOUS_PROP,
+ .resolution = 2.0,
+ },
+ },
+ {
.name = "static_property",
.option =
{