audio policy: fix merging error for commit 112b0af8.

Wrong patch set was merged from partner gerrit.

Change-Id: I850d61b1cc8682e0a82ee64bc8cb022b7512de1c
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 2aed7b1..f853274 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -3465,7 +3465,7 @@
 
     if (audio_device_is_digital(device)) {
         // erase all current sample rates, formats and channel masks
-        devDesc->clearCapabilities();
+        devDesc->clearAudioProfiles();
     }
 
     if (state == AUDIO_POLICY_DEVICE_STATE_AVAILABLE) {
@@ -3710,7 +3710,7 @@
 
     if (audio_device_is_digital(device)) {
         // erase all current sample rates, formats and channel masks
-        devDesc->clearCapabilities();
+        devDesc->clearAudioProfiles();
     }
 
     if (state == AUDIO_POLICY_DEVICE_STATE_AVAILABLE) {
@@ -5129,8 +5129,10 @@
     }
     const FormatVector &supportedFormats = profiles.getSupportedFormats();
 
-    for(size_t formatIndex = 0; formatIndex < supportedFormats.size(); formatIndex++) {
+    for (size_t formatIndex = 0; formatIndex < supportedFormats.size(); formatIndex++) {
         audio_format_t format = supportedFormats[formatIndex];
+        ChannelsVector channelMasks;
+        SampleRateVector samplingRates;
         AudioParameter requestedParameters;
         requestedParameters.addInt(String8(AUDIO_PARAMETER_STREAM_FORMAT), format);
 
@@ -5141,7 +5143,7 @@
             ALOGV("%s: supported sampling rates %s", __FUNCTION__, reply.string());
             value = strpbrk((char *)reply.string(), "=");
             if (value != NULL) {
-                profiles.setSampleRatesFor(samplingRatesFromString(value + 1), format);
+                samplingRates = samplingRatesFromString(value + 1);
             }
         }
         if (profiles.hasDynamicChannelsFor(format)) {
@@ -5151,9 +5153,10 @@
             ALOGV("%s: supported channel masks %s", __FUNCTION__, reply.string());
             value = strpbrk((char *)reply.string(), "=");
             if (value != NULL) {
-                profiles.setChannelsFor(channelMasksFromString(value + 1), format);
+                channelMasks = channelMasksFromString(value + 1);
             }
         }
+        profiles.addProfileFromHal(new AudioProfile(format, channelMasks, samplingRates));
     }
 }