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

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

Merge "Fix an issue where Vehicle HAL would crash when trying to update a...

Merge "Fix an issue where Vehicle HAL would crash when trying to update a continuous property without an initial floating-point value"
parents 18dff50c 945d0bbc
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -212,7 +212,7 @@ const ConfigDeclaration kVehicleProperties[] {
            .minSampleRate = 1.0f,
            .minSampleRate = 1.0f,
            .maxSampleRate = 2.0f,
            .maxSampleRate = 2.0f,
        },
        },
        .initialValue = { .int32Values = {25} }
        .initialValue = { .floatValues = {25.0f} }
    },
    },


    {
    {
+6 −0
Original line number Original line Diff line number Diff line
@@ -540,6 +540,12 @@ void DefaultVehicleHal::onContinuousPropertyTimer(const std::vector<int32_t>& pr
            if (VehiclePropertyType::FLOAT == getPropType(property)) {
            if (VehiclePropertyType::FLOAT == getPropType(property)) {
                // Just get some randomness to continuous properties to see slightly differnt values
                // Just get some randomness to continuous properties to see slightly differnt values
                // on the other end.
                // on the other end.
                if (v->value.floatValues.size() == 0) {
                    ALOGW("continuous property 0x%x is of type float but does not have a"
                          " float value. defaulting to zero",
                          property);
                    v->value.floatValues = android::hardware::hidl_vec<float>{0.0f};
                }
                v->value.floatValues[0] = v->value.floatValues[0] + std::rand() % 5;
                v->value.floatValues[0] = v->value.floatValues[0] + std::rand() % 5;
            }
            }
        } else {
        } else {