diff options
-rw-r--r-- | audio/AudioPolicyManagerBase.cpp | 37 | ||||
-rw-r--r-- | include/hardware_legacy/AudioPolicyManagerBase.h | 1 | ||||
-rw-r--r-- | include/hardware_legacy/audio_policy_conf.h | 1 |
3 files changed, 37 insertions, 2 deletions
diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp index 0c00208..b0debef 100644 --- a/audio/AudioPolicyManagerBase.cpp +++ b/audio/AudioPolicyManagerBase.cpp @@ -1217,8 +1217,11 @@ AudioPolicyManagerBase::AudioPolicyManagerBase(AudioPolicyClientInterface *clien mScoDeviceAddress = String8(""); mUsbCardAndDevice = String8(""); - if (loadAudioPolicyConfig(AUDIO_POLICY_CONFIG_FILE) != NO_ERROR) { - ALOGE("could not load audio policy configuration file"); + if (loadAudioPolicyConfig(AUDIO_POLICY_VENDOR_CONFIG_FILE) != NO_ERROR) { + if (loadAudioPolicyConfig(AUDIO_POLICY_CONFIG_FILE) != NO_ERROR) { + ALOGE("could not load audio policy configuration file, setting defaults"); + defaultAudioPolicyConfig(); + } } // open all output streams needed to access attached devices @@ -3399,8 +3402,38 @@ status_t AudioPolicyManagerBase::loadAudioPolicyConfig(const char *path) free(root); free(data); + ALOGI("loadAudioPolicyConfig() loaded %s\n", path); + return NO_ERROR; } +void AudioPolicyManagerBase::defaultAudioPolicyConfig(void) +{ + HwModule *module; + IOProfile *profile; + + mDefaultOutputDevice = AUDIO_DEVICE_OUT_SPEAKER; + mAttachedOutputDevices = AUDIO_DEVICE_OUT_SPEAKER; + mAvailableInputDevices = AUDIO_DEVICE_IN_BUILTIN_MIC; + + module = new HwModule("primary"); + + profile = new IOProfile(module); + profile->mSamplingRates.add(44100); + profile->mFormats.add(AUDIO_FORMAT_PCM_16_BIT); + profile->mChannelMasks.add(AUDIO_CHANNEL_OUT_STEREO); + profile->mSupportedDevices = AUDIO_DEVICE_OUT_SPEAKER; + profile->mFlags = AUDIO_OUTPUT_FLAG_PRIMARY; + module->mOutputProfiles.add(profile); + + profile = new IOProfile(module); + profile->mSamplingRates.add(8000); + profile->mFormats.add(AUDIO_FORMAT_PCM_16_BIT); + profile->mChannelMasks.add(AUDIO_CHANNEL_IN_MONO); + profile->mSupportedDevices = AUDIO_DEVICE_IN_BUILTIN_MIC; + module->mInputProfiles.add(profile); + + mHwModules.add(module); +} }; // namespace android diff --git a/include/hardware_legacy/AudioPolicyManagerBase.h b/include/hardware_legacy/AudioPolicyManagerBase.h index 916c952..8d38bbd 100644 --- a/include/hardware_legacy/AudioPolicyManagerBase.h +++ b/include/hardware_legacy/AudioPolicyManagerBase.h @@ -479,6 +479,7 @@ protected: void loadHwModules(cnode *root); void loadGlobalConfig(cnode *root); status_t loadAudioPolicyConfig(const char *path); + void defaultAudioPolicyConfig(void); AudioPolicyClientInterface *mpClientInterface; // audio policy client interface diff --git a/include/hardware_legacy/audio_policy_conf.h b/include/hardware_legacy/audio_policy_conf.h index c5e8940..c1fc0c1 100644 --- a/include/hardware_legacy/audio_policy_conf.h +++ b/include/hardware_legacy/audio_policy_conf.h @@ -26,6 +26,7 @@ #define AUDIO_HARDWARE_MODULE_ID_MAX_LEN 32 #define AUDIO_POLICY_CONFIG_FILE "/system/etc/audio_policy.conf" +#define AUDIO_POLICY_VENDOR_CONFIG_FILE "/vendor/etc/audio_policy.conf" // global configuration #define GLOBAL_CONFIG_TAG "global_configuration" |