policy_hal: restore device if it differs from the stopped output
Currently, restore device for the output handle can be ignored if
the new device is the same with current device of this output, this
can lead playback for this output keeps on the route of the stopped
output.
Instead, need to compare the device with the previous active device
of the stopped output to decide if it's a spurious routing request.
Change-Id: I3e5eb8b3aa68b050a84515b50b9745864826129a
CRs-Fixed: 2136994
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index 6cbb1c1..b22d471 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -1069,7 +1069,7 @@
outputDesc->sharesHwModuleWith(desc) &&
(newDevice != desc->device())) {
audio_devices_t dev = getNewOutputDevice(mOutputs.valueFor(curOutput), false /*fromCache*/);
- bool force = desc->device() != dev;
+ bool force = prevDevice != dev;
uint32_t delayMs;
if (dev == prevDevice) {
delayMs = 0;