Introduce getPropertyConfig to IVehicleHardware
This function gets only one property config instead of getting all.
This is useful to let IVehicleHardware to return one config or
not_supported for early boot required properties when not all property
configs are available.
Test: Local run on cf_auto
atest DefaultVehicleHalTest
Bug: 342470570
Change-Id: I0a8aec95007e901ceffce1ee3ead1f6bbeb7a089
diff --git a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.cpp b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.cpp
index 73bb521..201ddb0 100644
--- a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.cpp
+++ b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.cpp
@@ -83,6 +83,17 @@
return configs;
}
+std::optional<aidlvhal::VehiclePropConfig> GRPCVehicleHardware::getPropertyConfig(
+ int32_t propId) const {
+ // TODO(b/354055835): Use GRPC call to get one config instead of getting all the configs.
+ for (const auto& config : getAllPropertyConfigs()) {
+ if (config.prop == propId) {
+ return config;
+ }
+ }
+ return std::nullopt;
+}
+
aidlvhal::StatusCode GRPCVehicleHardware::setValues(
std::shared_ptr<const SetValuesCallback> callback,
const std::vector<aidlvhal::SetValueRequest>& requests) {