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

Commit 3b62ca8c 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
am: 8beffc61

Change-Id: I239505a8b1a4b3cb90a02e7980d256c9e9222678
parents db2e5123 8beffc61
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;