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

Commit af034fc9 authored by Eric Laurent's avatar Eric Laurent Committed by Automerger Merge Worker
Browse files

Merge "Fix music output to speaker" am: fc9e26a3

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/1360120

Change-Id: I5752232356db0815a3e45eb9ff23e948ff8003c1
parents a4217304 fc9e26a3
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,