mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Merge "audio: Make IConfig.getSurroundSound default implementation more robust" into main am: 58d953e4be am: cc476475f8 am: c38a04ba41
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2723318 Change-Id: I162eddc0beaecb8c01faf3b9b98f7bc1dda4aa56 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -27,12 +27,11 @@ using aidl::android::media::audio::common::AudioHalEngineConfig;
|
||||
|
||||
namespace aidl::android::hardware::audio::core {
|
||||
ndk::ScopedAStatus Config::getSurroundSoundConfig(SurroundSoundConfig* _aidl_return) {
|
||||
static const auto& func = __func__;
|
||||
static const SurroundSoundConfig surroundSoundConfig = [this]() {
|
||||
SurroundSoundConfig surroundCfg;
|
||||
if (mAudioPolicyConverter.getStatus() == ::android::OK) {
|
||||
surroundCfg = mAudioPolicyConverter.getSurroundSoundConfig();
|
||||
} else {
|
||||
LOG(WARNING) << __func__ << mAudioPolicyConverter.getError();
|
||||
SurroundSoundConfig surroundCfg = mAudioPolicyConverter.getSurroundSoundConfig();
|
||||
if (mAudioPolicyConverter.getStatus() != ::android::OK) {
|
||||
LOG(WARNING) << func << ": " << mAudioPolicyConverter.getError();
|
||||
}
|
||||
return surroundCfg;
|
||||
}();
|
||||
@@ -42,21 +41,22 @@ ndk::ScopedAStatus Config::getSurroundSoundConfig(SurroundSoundConfig* _aidl_ret
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus Config::getEngineConfig(AudioHalEngineConfig* _aidl_return) {
|
||||
static const auto& func = __func__;
|
||||
static const AudioHalEngineConfig returnEngCfg = [this]() {
|
||||
AudioHalEngineConfig engConfig;
|
||||
if (mEngConfigConverter.getStatus() == ::android::OK) {
|
||||
engConfig = mEngConfigConverter.getAidlEngineConfig();
|
||||
} else {
|
||||
LOG(INFO) << __func__ << mEngConfigConverter.getError();
|
||||
LOG(INFO) << func << ": " << mEngConfigConverter.getError();
|
||||
if (mAudioPolicyConverter.getStatus() == ::android::OK) {
|
||||
engConfig = mAudioPolicyConverter.getAidlEngineConfig();
|
||||
} else {
|
||||
LOG(WARNING) << __func__ << mAudioPolicyConverter.getError();
|
||||
LOG(WARNING) << func << ": " << mAudioPolicyConverter.getError();
|
||||
}
|
||||
}
|
||||
// Logging full contents of the config is an overkill, just provide statistics.
|
||||
LOG(DEBUG) << "getEngineConfig: number of strategies parsed: "
|
||||
<< engConfig.productStrategies.size()
|
||||
LOG(DEBUG) << func
|
||||
<< ": number of strategies parsed: " << engConfig.productStrategies.size()
|
||||
<< ", default strategy: " << engConfig.defaultProductStrategyId
|
||||
<< ", number of volume groups parsed: " << engConfig.volumeGroups.size();
|
||||
return engConfig;
|
||||
|
||||
@@ -53,10 +53,16 @@ class XmlConverter {
|
||||
const ::android::status_t& status) {
|
||||
std::string errorMessage;
|
||||
if (status != ::android::OK) {
|
||||
if (!isReadableConfigFile) {
|
||||
errorMessage = "Could not read requested config file:" + configFilePath;
|
||||
if (configFilePath.empty()) {
|
||||
errorMessage = "No audio configuration files found";
|
||||
} else if (!isReadableConfigFile) {
|
||||
errorMessage = std::string("Could not read requested XML config file: \"")
|
||||
.append(configFilePath)
|
||||
.append("\"");
|
||||
} else {
|
||||
errorMessage = "Invalid config file: " + configFilePath;
|
||||
errorMessage = std::string("Invalid XML config file: \"")
|
||||
.append(configFilePath)
|
||||
.append("\"");
|
||||
}
|
||||
}
|
||||
return errorMessage;
|
||||
|
||||
Reference in New Issue
Block a user