Merge "Fix HvacPowerOn vehicle property"
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
index 95ca37b..545de39 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
@@ -28,9 +28,9 @@
namespace impl {
-const VehicleProperty kHvacPowerProperties[] = {
- VehicleProperty::HVAC_FAN_SPEED,
- VehicleProperty::HVAC_FAN_DIRECTION,
+const int32_t kHvacPowerProperties[] = {
+ toInt(VehicleProperty::HVAC_FAN_SPEED),
+ toInt(VehicleProperty::HVAC_FAN_DIRECTION),
};
const VehiclePropConfig kVehicleProperties[] = {
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.cpp
index 808aafb..e6a3e56 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.cpp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.cpp
@@ -503,16 +503,15 @@
StatusCode status;
switch (propId) {
default:
- if (mHvacPowerProps.find(VehicleProperty(propId)) !=
- mHvacPowerProps.end()) {
- auto prop = mProps.find(
- std::make_pair(toInt(VehicleProperty::HVAC_POWER_ON), 0));
- if (prop != mProps.end()) {
- if (prop->second->value.int32Values.size() == 1 &&
- prop->second->value.int32Values[0] == 0) {
- status = StatusCode::NOT_AVAILABLE;
- break;
- }
+ if (mHvacPowerProps.count(propId)) {
+ std::lock_guard<std::mutex> lock(mPropsMutex);
+ auto hvacPowerOn = getVehiclePropValueLocked(toInt(VehicleProperty::HVAC_POWER_ON),
+ toInt(VehicleAreaZone::ROW_1));
+
+ if (hvacPowerOn && hvacPowerOn->value.int32Values.size() == 1
+ && hvacPowerOn->value.int32Values[0] == 0) {
+ status = StatusCode::NOT_AVAILABLE;
+ break;
}
}
status = updateProperty(propValue);
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.h
index 98eef27..2efe05c 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.h
@@ -108,7 +108,7 @@
std::pair<int32_t /*VehicleProperty*/, int32_t /*areaId*/>,
std::unique_ptr<VehiclePropValue>> mProps;
std::atomic<int> mExit;
- std::unordered_set<VehicleProperty> mHvacPowerProps;
+ std::unordered_set<int32_t> mHvacPowerProps;
std::mutex mPropsMutex;
std::thread mThread;
std::unique_ptr<CommBase> mComm{nullptr};