Audio policy bit mask was replaced with a new type.

See: KEYSTONE(I0300190d57179b6fbfc8956f3198daa922d867cb,b/144055559)

Change-Id: I0300190d57179b6fbfc8956f3198daa922d867cb
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index ced1cac..77002e4 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -1055,7 +1055,7 @@
             // Automatically disable the remote submix input when output is stopped on a
             // re routing mix of type MIX_TYPE_RECORDERS
             sp<AudioPolicyMix> policyMix = outputDesc->mPolicyMix.promote();
-            if (audio_is_remote_submix_device(outputDesc->devices().types()) &&
+            if (isSingleDeviceType(outputDesc->devices().types(), &audio_is_remote_submix_device) &&
                 policyMix != NULL &&
                 policyMix->mMixType == MIX_TYPE_RECORDERS) {
                 setDeviceConnectionStateInt(AUDIO_DEVICE_IN_REMOTE_SUBMIX,
@@ -1291,7 +1291,8 @@
 
     // Automatically enable the remote submix input when output is started on a re routing mix
     // of type MIX_TYPE_RECORDERS
-    if (audio_is_remote_submix_device(devices.types()) && policyMix != NULL &&
+    if (isSingleDeviceType(devices.types(), &audio_is_remote_submix_device) &&
+        policyMix != NULL &&
         policyMix->mMixType == MIX_TYPE_RECORDERS) {
         setDeviceConnectionStateInt(AUDIO_DEVICE_IN_REMOTE_SUBMIX,
                                     AUDIO_POLICY_DEVICE_STATE_AVAILABLE,
@@ -1307,7 +1308,7 @@
                                                VolumeSource volumeSource,
                                                int index,
                                                const sp<AudioOutputDescriptor>& outputDesc,
-                                               audio_devices_t device,
+                                               DeviceTypeSet deviceTypes,
                                                int delayMs,
                                                bool force)
 {
@@ -1334,16 +1335,16 @@
         return INVALID_OPERATION;
     }
 
-    if (device == AUDIO_DEVICE_NONE) {
-        device = outputDesc->devices().types();
+    if (deviceTypes.empty()) {
+        deviceTypes = outputDesc->devices().types();
     }
 
-    float volumeDb = computeVolume(curves, volumeSource, index, device);
-    if (outputDesc->isFixedVolume(device)) {
+    float volumeDb = computeVolume(curves, volumeSource, index, deviceTypes);
+    if (outputDesc->isFixedVolume(deviceTypes)) {
         volumeDb = 0.0f;
     }
 
-    outputDesc->setVolume(volumeDb, volumeSource, curves.getStreamTypes(), device, delayMs, force);
+    outputDesc->setVolume(volumeDb, volumeSource, curves.getStreamTypes(), deviceTypes, delayMs, force);
 
       if (isVoiceVolSrc || isBtScoVolSrc) {
         float voiceVolume;
@@ -1636,8 +1637,8 @@
     * a non-music stream playback on WFD, so primary output is not reused for ringtone.
     */
     if (mApmConfigs->isAFEProxyEnabled()) {
-        audio_devices_t availableOutputDeviceTypes = mAvailableOutputDevices.types();
-        if ((availableOutputDeviceTypes & AUDIO_DEVICE_OUT_PROXY)
+        DeviceTypeSet availableOutputDeviceTypes = mAvailableOutputDevices.types();
+        if ((deviceTypesToBitMask(availableOutputDeviceTypes) & AUDIO_DEVICE_OUT_PROXY)
               && (stream != AUDIO_STREAM_MUSIC)) {
             ALOGD("WFD audio: use OUTPUT_FLAG_FAST for non music stream. flags:%x", *flags );
             //For voip paths
@@ -1712,7 +1713,7 @@
 
     if (stream == AUDIO_STREAM_TTS) {
         *flags = AUDIO_OUTPUT_FLAG_TTS;
-    } else if (devices.types() == AUDIO_DEVICE_OUT_TELEPHONY_TX &&
+    } else if (devices.onlyContainsDevicesWithType(AUDIO_DEVICE_OUT_TELEPHONY_TX) &&
         stream == AUDIO_STREAM_MUSIC &&
         audio_is_linear_pcm(config->format) &&
         isInCall()) {
@@ -1803,7 +1804,7 @@
 
         outputDesc =
                 new SwAudioOutputDescriptor(profile, mpClientInterface);
-        DeviceVector outputDevices = mAvailableOutputDevices.getDevicesFromTypeMask(devices.types());
+        DeviceVector outputDevices = mAvailableOutputDevices.getDevicesFromTypes(devices.types());
         String8 address = outputDevices.size() > 0 ? String8(outputDevices.itemAt(0)->address().data())
                 : String8("");
         status = outputDesc->open(config, devices, stream, *flags, &output);
@@ -2077,7 +2078,7 @@
         DeviceVector primaryInputDevices = availablePrimaryModuleInputDevices();
         if ((primaryInputDevices.contains(device) && (device->type() & ~AUDIO_DEVICE_BIT_IN)) != 0) {
             if (mApmConfigs->isVAConcEnabled()) {
-                if (activeNonSoundTriggerInputsCountOnDevices(primaryInputDevices.types()) == 1)
+                if (activeNonSoundTriggerInputsCountOnDevices(deviceTypesToBitMask(primaryInputDevices.types())) == 1)
                     SoundTrigger::setCaptureState(true);
             } else if (mInputs.activeInputsCountOnDevices(primaryInputDevices) == 1)
                 SoundTrigger::setCaptureState(true);
@@ -2125,7 +2126,7 @@
     if (mApmConfigs->isVAConcEnabled()) {
         sp<AudioInputDescriptor> inputDesc = mInputs.getInputForClient(portId);
         if ((primaryInputDevices.contains(inputDesc->getDevice()) &&
-                activeNonSoundTriggerInputsCountOnDevices(primaryInputDevices.types())) == 0) {
+                activeNonSoundTriggerInputsCountOnDevices(deviceTypesToBitMask(primaryInputDevices.types()))) == 0) {
                 SoundTrigger::setCaptureState(false);
         }
     }
diff --git a/policy_hal/AudioPolicyManager.h b/policy_hal/AudioPolicyManager.h
index e7670f4..513c53c 100644
--- a/policy_hal/AudioPolicyManager.h
+++ b/policy_hal/AudioPolicyManager.h
@@ -119,7 +119,7 @@
         virtual status_t checkAndSetVolume(IVolumeCurves &curves,
                                            VolumeSource volumeSource, int index,
                                            const sp<AudioOutputDescriptor>& outputDesc,
-                                           audio_devices_t device,
+                                           DeviceTypeSet deviceTypes,
                                            int delayMs = 0, bool force = false);
 
         // avoid invalidation for active music stream on  previous outputs