Merge "audio: if device is change from none to new device, need get index from new device." into main am: 0cf7ca884c am: 039936c858 am: b72a3db88e am: 4d24611479 am: 14434bf862

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

Change-Id: Ib0ae65738231726d242e7a7fc441844fc4b02fa0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 8f10c62..f1f2048 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -7835,6 +7835,9 @@
     }
     if (deviceTypes.empty()) {
         deviceTypes = outputDesc->devices().types();
+        index = curves.getVolumeIndex(deviceTypes);
+        ALOGD("%s if deviceTypes is change from none to device %s, need get index %d",
+                __func__, dumpDeviceTypes(deviceTypes).c_str(), index);
     }
 
     if (curves.getVolumeIndexMin() < 0 || curves.getVolumeIndexMax() < 0) {