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

Commit fc9e26a3 authored by Eric Laurent's avatar Eric Laurent Committed by Gerrit Code Review
Browse files

Merge "Fix music output to speaker"

parents 43b32b29 bd2dcc4d
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -460,7 +460,16 @@ status_t AudioPolicyManager::handleDeviceConfigChange(audio_devices_t device,
            }
        }
    }

    auto musicStrategy = streamToStrategy(AUDIO_STREAM_MUSIC);
    for (size_t i = 0; i < mOutputs.size(); i++) {
       sp<SwAudioOutputDescriptor> desc = mOutputs.valueAt(i);
       // mute media strategies and delay device switch by the largest
       // This avoid sending the music tail into the earpiece or headset.
       setStrategyMute(musicStrategy, true, desc);
       setStrategyMute(musicStrategy, false, desc, MUTE_TIME_MS,
          mEngine->getOutputDevicesForAttributes(attributes_initializer(AUDIO_USAGE_MEDIA),
                                              nullptr, true /*fromCache*/).types());
    }
    // Toggle the device state: UNAVAILABLE -> AVAILABLE
    // This will force reading again the device configuration
    status = setDeviceConnectionState(device,