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

Commit 2361ed8e authored by jiabin's avatar jiabin
Browse files

Only reopen output with preferred mixer info when new devices are not

empty.

Bug: 368428254
Test: make
Flag: EXEMPT bugfix
Change-Id: I4108e68156f365fe7387c9590ef2175d795449fd
parent f4bbe5bf
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -4379,8 +4379,9 @@ void AudioPolicyManager::updateCallAndOutputRouting(bool forceVolumeReeval, uint
            // As done in setDeviceConnectionState, we could also fix default device issue by
            // preventing the force re-routing in case of default dev that distinguishes on address.
            // Let's give back to engine full device choice decision however.
            bool forceRouting = !newDevices.isEmpty();
            if (outputDesc->mPreferredAttrInfo != nullptr && newDevices != outputDesc->devices()) {
            bool newDevicesNotEmpty = !newDevices.isEmpty();
            if (outputDesc->mPreferredAttrInfo != nullptr && newDevices != outputDesc->devices()
                && newDevicesNotEmpty) {
                // If the device is using preferred mixer attributes, the output need to reopen
                // with default configuration when the new selected devices are different from
                // current routing devices.
@@ -4388,9 +4389,10 @@ void AudioPolicyManager::updateCallAndOutputRouting(bool forceVolumeReeval, uint
                continue;
            }

            waitMs = setOutputDevices(__func__, outputDesc, newDevices, forceRouting, delayMs,
                                       nullptr, !skipDelays /*requiresMuteCheck*/,
                                      !forceRouting /*requiresVolumeCheck*/, skipDelays);
            waitMs = setOutputDevices(__func__, outputDesc, newDevices,
                                      newDevicesNotEmpty /*force*/, delayMs,
                                      nullptr /*patchHandle*/, !skipDelays /*requiresMuteCheck*/,
                                      !newDevicesNotEmpty /*requiresVolumeCheck*/, skipDelays);
            // Only apply special touch sound delay once
            delayMs = 0;
        }