hal: don't reroute playback usecases when voip output stops

AudioPolicyManager will force device switch for audio playback
usecases when voip usecase stops, skip this redundant switch
as it can possibly route media back to handset unexpectedly.

Change-Id: Ife7cb75e165233f351ee7b86da55a680503c9eb7
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index fd04f3f..112d88f 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2021, The Linux Foundation. All rights reserved.
  * Not a Contribution.
  *
  * Copyright (C) 2013 The Android Open Source Project
@@ -3793,20 +3793,17 @@
             ALOGE("%s: audio_extn_ip_hdlr_intf_close failed %d",__func__, ret);
     }
 
-    /* 1) media + voip output routing to handset must route media back to
-          speaker when voip stops.
-       2) trigger voip input to reroute when voip output changes to
-          hearing aid. */
+    /* trigger voip input to reroute when voip output changes to hearing aid */
     if (has_voip_usecase ||
             compare_device_type(&out->device_list, AUDIO_DEVICE_OUT_SPEAKER_SAFE)) {
         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->type == PCM_CAPTURE &&
+            if (usecase->type == PCM_PLAYBACK || usecase == uc_info ||
+                (usecase->type == PCM_CAPTURE &&
                      usecase->id != USECASE_AUDIO_RECORD_VOIP &&
-                          usecase->id != USECASE_AUDIO_RECORD_VOIP_LOW_LATENCY)
-                || usecase == uc_info)
+                          usecase->id != USECASE_AUDIO_RECORD_VOIP_LOW_LATENCY))
                 continue;
 
             ALOGD("%s: select_devices at usecase(%d: %s) after removing the usecase(%d: %s)",