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

Commit 5f1fadf0 authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

audiopolicy: Avoid logspam about engine config parsing error

Skip calling into libxml2 parsing when the engine config
file does not exist (this is allowed). This removes a misleading
error message from libxml2 in the syslog.

Bug: 181269159
Test: adb shell logcat | grep libxml2
      during phone boot
Change-Id: I9159a458ce68146271c3b22ea452194c4cabc79f
parent 91f9f7d3
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
#define LOG_TAG "APM::AudioPolicyEngine/Base"
//#define LOG_NDEBUG 0

#include <sys/stat.h>

#include "EngineBase.h"
#include "EngineDefaultConfig.h"
#include <TypeConverter.h>
@@ -147,8 +149,13 @@ engineConfig::ParsingResult EngineBase::loadAudioPolicyEngineConfig()
        });
        return iter != end(volumeGroups);
    };
    auto fileExists = [](const char* path) {
        struct stat fileStat;
        return stat(path, &fileStat) == 0 && S_ISREG(fileStat.st_mode);
    };

    auto result = engineConfig::parse();
    auto result = fileExists(engineConfig::DEFAULT_PATH) ?
            engineConfig::parse(engineConfig::DEFAULT_PATH) : engineConfig::ParsingResult{};
    if (result.parsedConfig == nullptr) {
        ALOGW("%s: No configuration found, using default matching phone experience.", __FUNCTION__);
        engineConfig::Config config = gDefaultEngineConfig;