diff options
author | Mikhail Naganov <mnaganov@google.com> | 2020-04-14 14:54:18 -0700 |
---|---|---|
committer | Mikhail Naganov <mnaganov@google.com> | 2020-04-17 01:56:41 +0000 |
commit | cd517d8e5e60cd999b1c2621e1a7828d2c98b66e (patch) | |
tree | de5711ecc4f1b5b68fac32233f25eaa529d40904 | |
parent | d36ef438b9be5dbd19e487492e4a48a44c918997 (diff) | |
download | media-cd517d8e5e60cd999b1c2621e1a7828d2c98b66e.tar.gz |
audio: Centralize audio configuration paths specification
The list of possible paths for the audio configuration
files is now retrieved using audio_get_configuration_paths()
function. All duplicated lists of known configuration
directories have been removed.
Bug: 153680356
Test: test audio on built image working
atest VtsHalAudioV6_0TargetTest VtsHalAudioPolicyV6_0TargetTest
Change-Id: I5340e2200f2ab45fcd80a2144c0e04e099da9276
Merged-In: I5340e2200f2ab45fcd80a2144c0e04e099da9276
-rw-r--r-- | audio/include/system/audio_config.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/audio/include/system/audio_config.h b/audio/include/system/audio_config.h new file mode 100644 index 00000000..5cb3ff52 --- /dev/null +++ b/audio/include/system/audio_config.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_AUDIO_CONFIG_H +#define ANDROID_AUDIO_CONFIG_H + +#ifdef __cplusplus + +#include <string> +#include <vector> + +#include <cutils/properties.h> + +namespace android { + +// Returns a vector of paths where audio configuration files +// must be searched, in the provided order. +static inline std::vector<std::string> audio_get_configuration_paths() { + static const std::vector<std::string> paths = []() { + char value[PROPERTY_VALUE_MAX] = {}; + if (property_get("ro.boot.product.vendor.sku", value, "") <= 0) { + return std::vector<std::string>({"/odm/etc", "/vendor/etc", "/system/etc"}); + } else { + return std::vector<std::string>({ + "/odm/etc", std::string("/vendor/etc/audio/sku_") + value, + "/vendor/etc", "/system/etc"}); + } + }(); + return paths; +} + +} // namespace android + +#endif // __cplusplus + +#endif // ANDROID_AUDIO_CONFIG_H |