Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 38d90c2d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix HvacPowerOn vehicle property"

parents 93c7e13a fb661793
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -28,9 +28,9 @@ namespace V2_0 {

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[] = {
+9 −10
Original line number Diff line number Diff line
@@ -503,18 +503,17 @@ StatusCode DefaultVehicleHal::set(const VehiclePropValue& propValue) {
    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) {
            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);
            if (status == StatusCode::OK) {
                // Send property update to emulator
+1 −1
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ private:
        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};