hal: select HFP devices based on hfp active session

Enabling the HFP devices based on hfp active session.

Bug : 31922459

Change-Id: I64fcbe7d5662f6408cf95afa7a89581bbe421281
Signed-off-by: Yamit Mehta <ymehta@codeaurora.org>
Signed-off-by: Madhuri Athota <mathota@codeaurora.org>
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 5faa2b2..900a7e6 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -1547,7 +1547,7 @@
         goto exit;
     }
 
-    if (mode == AUDIO_MODE_IN_CALL) {
+    if (mode == AUDIO_MODE_IN_CALL || audio_extn_hfp_is_active(adev)) {
         if (devices & AUDIO_DEVICE_OUT_WIRED_HEADPHONE ||
             devices & AUDIO_DEVICE_OUT_WIRED_HEADSET ||
             devices & AUDIO_DEVICE_OUT_LINE) {
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index a890b61..62baf5b 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -1960,7 +1960,7 @@
         goto exit;
     }
 
-    if (voice_is_in_call(adev) || adev->enable_voicerx) {
+    if (voice_is_in_call(adev) || adev->enable_voicerx || audio_extn_hfp_is_active(adev)) {
         if (devices & AUDIO_DEVICE_OUT_WIRED_HEADPHONE ||
             devices & AUDIO_DEVICE_OUT_WIRED_HEADSET ||
             devices & AUDIO_DEVICE_OUT_LINE) {