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

Commit c161a24d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Audio Policy: add audio.msd.disable property for MSD detour"

parents 18d4c4f8 f02f367f
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -1070,8 +1070,17 @@ non_direct_output:
    return output;
}

sp<DeviceDescriptor> AudioPolicyManager::getMsdAudioInDevice() const {
sp<HwModule> AudioPolicyManager::getMsdModule() const {
    sp<HwModule> msdModule = mHwModules.getModuleFromName(AUDIO_HARDWARE_MODULE_ID_MSD);
    if (msdModule != 0 && property_get_bool("audio.msd.disable", false /* default_value */)) {
        ALOGI("use of the MSD module is disabled by audio.msd.disable property");
        return 0;
    }
    return msdModule;
}

sp<DeviceDescriptor> AudioPolicyManager::getMsdAudioInDevice() const {
    sp<HwModule> msdModule = getMsdModule();
    if (msdModule != 0) {
        DeviceVector msdInputDevices = mAvailableInputDevices.getDevicesFromHwModule(
                msdModule->getHandle());
@@ -1081,7 +1090,7 @@ sp<DeviceDescriptor> AudioPolicyManager::getMsdAudioInDevice() const {
}

audio_devices_t AudioPolicyManager::getMsdAudioOutDeviceTypes() const {
    sp<HwModule> msdModule = mHwModules.getModuleFromName(AUDIO_HARDWARE_MODULE_ID_MSD);
    sp<HwModule> msdModule = getMsdModule();
    if (msdModule != 0) {
        return mAvailableOutputDevices.getDeviceTypesFromHwModule(msdModule->getHandle());
    }
@@ -1090,6 +1099,7 @@ audio_devices_t AudioPolicyManager::getMsdAudioOutDeviceTypes() const {

const AudioPatchCollection AudioPolicyManager::getMsdPatches() const {
    AudioPatchCollection msdPatches;
    // This function ignores audio.msd.disable property to allow patch teardown.
    sp<HwModule> msdModule = mHwModules.getModuleFromName(AUDIO_HARDWARE_MODULE_ID_MSD);
    if (msdModule != 0) {
        for (size_t i = 0; i < mAudioPatches.size(); ++i) {
@@ -1109,7 +1119,7 @@ const AudioPatchCollection AudioPolicyManager::getMsdPatches() const {
status_t AudioPolicyManager::getBestMsdAudioProfileFor(audio_devices_t outputDevice,
        bool hwAvSync, audio_port_config *sourceConfig, audio_port_config *sinkConfig) const
{
    sp<HwModule> msdModule = mHwModules.getModuleFromName(AUDIO_HARDWARE_MODULE_ID_MSD);
    sp<HwModule> msdModule = getMsdModule();
    if (msdModule == nullptr) {
        ALOGE("%s() unable to get MSD module", __func__);
        return NO_INIT;
@@ -4627,7 +4637,7 @@ void AudioPolicyManager::checkForDeviceAndOutputChanges(std::function<bool()> on
    checkOutputForAllStrategies();
    if (onOutputsChecked != nullptr && onOutputsChecked()) checkA2dpSuspend();
    updateDevicesAndOutputs();
    if (mHwModules.getModuleFromName(AUDIO_HARDWARE_MODULE_ID_MSD) != 0) {
    if (getMsdModule() != 0) {
        setMsdPatch();
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -616,6 +616,7 @@ private:
        void filterSurroundChannelMasks(ChannelsVector *channelMasksPtr);

        // Support for Multi-Stream Decoder (MSD) module
        sp<HwModule> getMsdModule() const;
        sp<DeviceDescriptor> getMsdAudioInDevice() const;
        audio_devices_t getMsdAudioOutDeviceTypes() const;
        const AudioPatchCollection getMsdPatches() const;