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

Commit 7673dcb3 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "audio: Centralize audio configuration paths specification" am:...

Merge "audio: Centralize audio configuration paths specification" am: c0884de8 am: a89bd207 am: 2c365b16

Change-Id: I778ab385a909a60aba11bdb33ac917dd844f7a95
parents df49b35c 2c365b16
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ cc_library {
        "libtinyxml2",
        "libutils",
        "libmedia_helper",
        "libcutils",
    ],

    header_libs: ["libaudio_system_headers"],
+0 −5
Original line number Diff line number Diff line
@@ -35,11 +35,6 @@ namespace effectsConfig {
/** Default path of effect configuration file. Relative to DEFAULT_LOCATIONS. */
constexpr const char* DEFAULT_NAME = "audio_effects.xml";

/** Default path of effect configuration file.
 * The /vendor partition is the recommended one, the others are deprecated.
 */
constexpr const char* DEFAULT_LOCATIONS[] = {"/odm/etc", "/vendor/etc", "/system/etc"};

/** Directories where the effect libraries will be search for. */
constexpr const char* LD_EFFECT_LIBRARY_PATH[] =
#ifdef __LP64__
+2 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@

#include <media/EffectsConfig.h>
#include <media/TypeConverter.h>
#include <system/audio_config.h>

using namespace tinyxml2;

@@ -338,7 +339,7 @@ ParsingResult parse(const char* path) {
        return parseWithPath(path);
    }

    for (const std::string& location : DEFAULT_LOCATIONS) {
    for (const std::string& location : audio_get_configuration_paths()) {
        std::string defaultPath = location + '/' + DEFAULT_NAME;
        if (access(defaultPath.c_str(), R_OK) != 0) {
            continue;
+0 −3
Original line number Diff line number Diff line
@@ -31,9 +31,6 @@ namespace engineConfig {
/** Default path of audio policy usages configuration file. */
constexpr char DEFAULT_PATH[] = "/vendor/etc/audio_policy_engine_configuration.xml";

/** Directories where the effect libraries will be search for. */
constexpr const char* POLICY_USAGE_LIBRARY_PATH[] = {"/odm/etc/", "/vendor/etc/", "/system/etc/"};

using AttributesVector = std::vector<audio_attributes_t>;
using StreamVector = std::vector<audio_stream_type_t>;

+3 −5
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <cutils/properties.h>
#include <media/TypeConverter.h>
#include <media/convert.h>
#include <system/audio_config.h>
#include <utils/Log.h>
#include <libxml/parser.h>
#include <libxml/xinclude.h>
@@ -693,9 +694,6 @@ android::status_t parseLegacyVolumeFile(const char* path, VolumeGroups &volumeGr
    return deserializeLegacyVolumeCollection(doc, cur, volumeGroups, nbSkippedElements);
}

static const char *kConfigLocationList[] = {"/odm/etc", "/vendor/etc", "/system/etc"};
static const int kConfigLocationListSize =
        (sizeof(kConfigLocationList) / sizeof(kConfigLocationList[0]));
static const int gApmXmlConfigFilePathMaxLength = 128;

static constexpr const char *apmXmlConfigFileName = "audio_policy_configuration.xml";
@@ -715,9 +713,9 @@ android::status_t parseLegacyVolumes(VolumeGroups &volumeGroups) {
    fileNames.push_back(apmXmlConfigFileName);

    for (const char* fileName : fileNames) {
        for (int i = 0; i < kConfigLocationListSize; i++) {
        for (const auto& path : audio_get_configuration_paths()) {
            snprintf(audioPolicyXmlConfigFile, sizeof(audioPolicyXmlConfigFile),
                     "%s/%s", kConfigLocationList[i], fileName);
                     "%s/%s", path.c_str(), fileName);
            ret = parseLegacyVolumeFile(audioPolicyXmlConfigFile, volumeGroups);
            if (ret == NO_ERROR) {
                return ret;
Loading