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

Commit 8beffc61 authored by Enrico Granata's avatar Enrico Granata Committed by android-build-merger
Browse files

Do not write initial empty values for the diagnostic properties. There is a...

Do not write initial empty values for the diagnostic properties. There is a separate step that initializes them with meaningful values.
am: ad2baebb

Change-Id: Ibddaa3b205c363a13688914d718d7aa51c1bc737
parents c36e35f5 ad2baebb
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -162,12 +162,29 @@ StatusCode EmulatedVehicleHal::set(const VehiclePropValue& propValue) {
    return StatusCode::OK;
}

static bool isDiagnosticProperty(VehiclePropConfig propConfig) {
    switch (propConfig.prop) {
        case OBD2_LIVE_FRAME:
        case OBD2_FREEZE_FRAME:
        case OBD2_FREEZE_FRAME_CLEAR:
        case OBD2_FREEZE_FRAME_INFO:
            return true;
    }
    return false;
}

// Parse supported properties list and generate vector of property values to hold current values.
void EmulatedVehicleHal::onCreate() {
    for (auto& it : kVehicleProperties) {
        VehiclePropConfig cfg = it.config;
        int32_t supportedAreas = cfg.supportedAreas;

        if (isDiagnosticProperty(cfg)) {
            // do not write an initial empty value for the diagnostic properties
            // as we will initialize those separately.
            continue;
        }

        //  A global property will have supportedAreas = 0
        if (isGlobalProp(cfg.prop)) {
            supportedAreas = 0;