hal: avoid set power mode during call if FM is active

If FM is not stopped during VoLTE in island mode,
the island port would access the loopback non-island
client to cause crash.

Fix it by avoid set power mode during call if FM is
active.

Change-Id: I2ceab67e1a67cec6cbd2d10a05dc3d83be6dec7b
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index fd04f3f..3f8b307 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -894,6 +894,21 @@
     return false;
 }
 
+static bool is_supported_conc_usecase_for_power_mode_call(struct audio_device *adev)
+{
+    struct listnode *node;
+    struct audio_usecase *usecase;
+
+    list_for_each(node, &adev->usecase_list) {
+        usecase = node_to_item(node, struct audio_usecase, list);
+        if (usecase->id == USECASE_AUDIO_PLAYBACK_FM) {
+            ALOGD("%s: FM usecase is active, not setting power mode", __func__);
+            return false;
+        }
+    }
+
+    return true;
+}
 static inline bool is_mmap_usecase(audio_usecase_t uc_id)
 {
     return (uc_id == USECASE_AUDIO_RECORD_AFE_PROXY) ||
@@ -1820,6 +1835,7 @@
      */
     if (uc_info->type == VOICE_CALL &&
         voice_extn_is_voice_power_mode_supported() &&
+        is_supported_conc_usecase_for_power_mode_call(adev) &&
         platform_check_and_update_island_power_status(adev->platform,
                                              uc_info,
                                              snd_device)) {
@@ -1979,6 +1995,7 @@
 
     if (uc_info->type == VOICE_CALL &&
         voice_extn_is_voice_power_mode_supported() &&
+        is_supported_conc_usecase_for_power_mode_call(adev) &&
         platform_check_and_update_island_power_status(adev->platform,
                                              uc_info,
                                              snd_device)) {