hal: Remove storage of audio device on bitfields

Audio devices were stored in HAL on variables with
type audio_devices_t. This change removes the storage
of multiple devices on a bitfield. Device comparisons,
assigments, removal have been updated. Helper functions
have been introduced for device operations.

Change-Id: I9ce8b0f9bdc542c386cbfe45b685158cc51d47b6
diff --git a/hal/audio_extn/fm.c b/hal/audio_extn/fm.c
index 435c377..a0c2410 100644
--- a/hal/audio_extn/fm.c
+++ b/hal/audio_extn/fm.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved.
  * Not a Contribution.
  *
  * Copyright (C) 2013 The Android Open Source Project
@@ -182,7 +182,7 @@
     fm_out->format = AUDIO_FORMAT_PCM_16_BIT;
     fm_out->usecase = USECASE_AUDIO_PLAYBACK_FM;
     fm_out->config = pcm_config_fm;
-    fm_out->devices = outputDevices;
+    reassign_device_list(&fm_out->device_list, outputDevices, "");
     fmmod.is_fm_running = true;
 
     uc_info = (struct audio_usecase *)calloc(1, sizeof(struct audio_usecase));
@@ -195,7 +195,7 @@
     uc_info->id = USECASE_AUDIO_PLAYBACK_FM;
     uc_info->type = PCM_PLAYBACK;
     uc_info->stream.out = fm_out;
-    uc_info->devices = outputDevices;
+    reassign_device_list(&uc_info->device_list, outputDevices, "");
     uc_info->in_snd_device = SND_DEVICE_NONE;
     uc_info->out_snd_device = SND_DEVICE_NONE;
 
@@ -240,7 +240,7 @@
     pcm_start(fmmod.fm_pcm_rx);
     pcm_start(fmmod.fm_pcm_tx);
 
-    fmmod.fm_device = fm_out->devices;
+    fmmod.fm_device = get_device_types(&fm_out->device_list);
 
     ALOGD("%s: exit: status(%d)", __func__, ret);
     return 0;
@@ -388,7 +388,8 @@
     ALOGV("%s: exit", __func__);
 }
 
-void audio_extn_fm_route_on_selected_device(struct audio_device *adev, audio_devices_t device)
+void audio_extn_fm_route_on_selected_device(struct audio_device *adev,
+                                            struct listnode *devices)
 {
     struct listnode *node;
     struct audio_usecase *usecase;
@@ -397,10 +398,10 @@
         list_for_each(node, &adev->usecase_list) {
             usecase = node_to_item(node, struct audio_usecase, list);
             if (usecase->id == USECASE_AUDIO_PLAYBACK_FM) {
-                if (fmmod.fm_device != device) {
+                if (fmmod.fm_device != get_device_types(devices)) {
                     ALOGV("%s selected routing device %x current device %x"
                           "are different, reroute on selected device", __func__,
-                          fmmod.fm_device, device);
+                          fmmod.fm_device, get_device_types(devices));
                     select_devices(adev, usecase->id);
                 }
             }