audio policy: fix stream to volume source mapping

remove use of obsolete method streamToVolumeSource()
and replace it by toVolumeSource() which actually queries
the engine for stream to volume source mapping.

Bug: 129439600
Test: make

Change-Id: Ie4e4e93aa5925315078fa96a957bb3ed71e7dc76
diff --git a/services/audiopolicy/enginedefault/src/Engine.cpp b/services/audiopolicy/enginedefault/src/Engine.cpp
index 592a0b9..4135f01 100644
--- a/services/audiopolicy/enginedefault/src/Engine.cpp
+++ b/services/audiopolicy/enginedefault/src/Engine.cpp
@@ -153,16 +153,16 @@
         break;
 
     case STRATEGY_SONIFICATION_RESPECTFUL:
-        if (isInCall() || outputs.isActiveLocally(streamToVolumeSource(AUDIO_STREAM_VOICE_CALL))) {
+        if (isInCall() || outputs.isActiveLocally(toVolumeSource(AUDIO_STREAM_VOICE_CALL))) {
             device = getDeviceForStrategyInt(
                     STRATEGY_SONIFICATION, availableOutputDevices, availableInputDevices, outputs,
                     outputDeviceTypesToIgnore);
         } else {
             bool media_active_locally =
-                    outputs.isActiveLocally(streamToVolumeSource(AUDIO_STREAM_MUSIC),
+                    outputs.isActiveLocally(toVolumeSource(AUDIO_STREAM_MUSIC),
                                             SONIFICATION_RESPECTFUL_AFTER_MUSIC_DELAY)
                     || outputs.isActiveLocally(
-                        streamToVolumeSource(AUDIO_STREAM_ACCESSIBILITY),
+                        toVolumeSource(AUDIO_STREAM_ACCESSIBILITY),
                         SONIFICATION_RESPECTFUL_AFTER_MUSIC_DELAY);
             // routing is same as media without the "remote" device
             device = getDeviceForStrategyInt(STRATEGY_MEDIA,
@@ -297,7 +297,7 @@
 
         // If incall, just select the STRATEGY_PHONE device
         if (isInCall() ||
-                outputs.isActiveLocally(streamToVolumeSource(AUDIO_STREAM_VOICE_CALL))) {
+                outputs.isActiveLocally(toVolumeSource(AUDIO_STREAM_VOICE_CALL))) {
             device = getDeviceForStrategyInt(
                     STRATEGY_PHONE, availableOutputDevices, availableInputDevices, outputs,
                     outputDeviceTypesToIgnore);
@@ -370,8 +370,8 @@
             }
             availableOutputDevices =
                     availableOutputDevices.getDevicesFromTypeMask(availableOutputDevicesType);
-            if (outputs.isActive(streamToVolumeSource(AUDIO_STREAM_RING)) ||
-                    outputs.isActive(streamToVolumeSource(AUDIO_STREAM_ALARM))) {
+            if (outputs.isActive(toVolumeSource(AUDIO_STREAM_RING)) ||
+                    outputs.isActive(toVolumeSource(AUDIO_STREAM_ALARM))) {
                 return getDeviceForStrategyInt(
                     STRATEGY_SONIFICATION, availableOutputDevices, availableInputDevices, outputs,
                     outputDeviceTypesToIgnore);