diff options
author | Yu Shan <shanyu@google.com> | 2023-12-04 18:37:50 -0800 |
---|---|---|
committer | Yu Shan <shanyu@google.com> | 2023-12-04 19:12:32 -0800 |
commit | bdd2622257b663ee6018649e5789927f5a01d314 (patch) | |
tree | 912de2d545359e133cbe7f3bff4b3d979fe77671 | |
parent | 2cb909a6798cae62415cefcc0d80f95176f27f78 (diff) | |
download | car-bdd2622257b663ee6018649e5789927f5a01d314.tar.gz |
Use getPropConfig instead of getConfig.
getPropConfig returns a copy of the config, which is safer to use.
Test: Presubmit
Bug: 308202443
Change-Id: I7ed7e7af2297b4e6536213994c031abd17bc1e7e
3 files changed, 3 insertions, 3 deletions
diff --git a/emulator/vhal_aidl/VehicleEmulator/EmulatedVehicleHardware.cpp b/emulator/vhal_aidl/VehicleEmulator/EmulatedVehicleHardware.cpp index 941d4f8..6eb7010 100644 --- a/emulator/vhal_aidl/VehicleEmulator/EmulatedVehicleHardware.cpp +++ b/emulator/vhal_aidl/VehicleEmulator/EmulatedVehicleHardware.cpp @@ -175,7 +175,7 @@ std::vector<VehiclePropValuePool::RecyclableType> EmulatedVehicleHardware::getAl EmulatedVehicleHardware::ConfigResultType EmulatedVehicleHardware::getPropConfig(int32_t propId) const { - return mServerSidePropStore->getConfig(propId); + return mServerSidePropStore->getPropConfig(propId); } bool EmulatedVehicleHardware::isInQemu() { diff --git a/emulator/vhal_aidl/VehicleEmulator/VehicleEmulator.cpp b/emulator/vhal_aidl/VehicleEmulator/VehicleEmulator.cpp index b09b8b9..73ffeef 100644 --- a/emulator/vhal_aidl/VehicleEmulator/VehicleEmulator.cpp +++ b/emulator/vhal_aidl/VehicleEmulator/VehicleEmulator.cpp @@ -105,7 +105,7 @@ void VehicleEmulator::doGetConfig(const VehicleEmulator::EmulatorMessage& rxMsg, } vhal_proto::VehiclePropConfig* protoCfg = respMsg->add_config(); - populateProtoVehicleConfig(*result.value(), protoCfg); + populateProtoVehicleConfig(result.value(), protoCfg); respMsg->set_status(vhal_proto::RESULT_OK); } diff --git a/emulator/vhal_aidl/VehicleEmulator/include/EmulatedVehicleHardware.h b/emulator/vhal_aidl/VehicleEmulator/include/EmulatedVehicleHardware.h index f5aaed1..c4a7b01 100644 --- a/emulator/vhal_aidl/VehicleEmulator/include/EmulatedVehicleHardware.h +++ b/emulator/vhal_aidl/VehicleEmulator/include/EmulatedVehicleHardware.h @@ -38,7 +38,7 @@ class EmulatedVehicleHardware : public FakeVehicleHardware { using AidlVehiclePropValue = aidl::android::hardware::automotive::vehicle::VehiclePropValue; using IVehicleBus = aidl::device::generic::car::emulator::IVehicleBus; using BnVehicleBusCallback = aidl::device::generic::car::emulator::BnVehicleBusCallback; - using ConfigResultType = android::base::Result<const aidl::android::hardware::automotive::vehicle::VehiclePropConfig*, VhalError>; + using ConfigResultType = android::base::Result<aidl::android::hardware::automotive::vehicle::VehiclePropConfig, VhalError>; EmulatedVehicleHardware(); EmulatedVehicleHardware(std::string_view default_config_dir, |