Merge "policy: update voice volume after output device is changed."
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index ab933a0..6bc3d1e 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -1042,6 +1042,9 @@
     }
     if (mEngine->getPhoneState() == AUDIO_MODE_IN_CALL && hasPrimaryOutput()) {
         audio_devices_t newDevice = getNewOutputDevice(mPrimaryOutput, true /*fromCache*/);
+        if (forceVolumeReeval && (newDevice != AUDIO_DEVICE_NONE)) {
+            applyStreamVolumes(mPrimaryOutput, newDevice, delayMs, true);
+        }
         waitMs = updateCallRouting(newDevice, delayMs);
     }
     // Use reverse loop to make sure any low latency usecases (generally tones)
@@ -1057,10 +1060,11 @@
         if ((mEngine->getPhoneState() != AUDIO_MODE_IN_CALL) || (outputDesc != mPrimaryOutput)) {
             waitMs = setOutputDevice(outputDesc, newDevice, (newDevice != AUDIO_DEVICE_NONE),
                                      delayMs);
-        }
-        if (forceVolumeReeval && (newDevice != AUDIO_DEVICE_NONE)) {
-            applyStreamVolumes(outputDesc, newDevice, waitMs, true);
-        }
+
+            if (forceVolumeReeval && (newDevice != AUDIO_DEVICE_NONE)) {
+                applyStreamVolumes(outputDesc, newDevice, waitMs, true);
+            }
+         }
     }
 
     Vector<sp <AudioInputDescriptor> > activeInputs = mInputs.getActiveInputs();