hal: enable app type calibration for car streams

Enable app type calibration for car streams
based on output flags.

Change-Id: I3f275ee674a315b0a912de2bdafd03ff2477e020
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index d407f80..4858eac 100644
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -1286,6 +1286,10 @@
 #define audio_extn_auto_hal_set_audio_port_config(dev, config) (0)
 #define audio_extn_auto_hal_set_parameters(adev, parms) (0)
 #else
+#define AUDIO_OUTPUT_FLAG_MEDIA 0x100000
+#define AUDIO_OUTPUT_FLAG_SYS_NOTIFICATION 0x200000
+#define AUDIO_OUTPUT_FLAG_NAV_GUIDANCE 0x400000
+#define AUDIO_OUTPUT_FLAG_PHONE 0x800000
 int32_t audio_extn_auto_hal_init(struct audio_device *adev);
 void audio_extn_auto_hal_deinit(void);
 int audio_extn_auto_hal_create_audio_patch(struct audio_hw_device *dev,
diff --git a/hal/audio_extn/auto_hal.c b/hal/audio_extn/auto_hal.c
index 7f2163d..d74c80e 100644
--- a/hal/audio_extn/auto_hal.c
+++ b/hal/audio_extn/auto_hal.c
@@ -264,11 +264,16 @@
             ret = -EINVAL;
             goto error;
         }
+        if (out->flags == AUDIO_OUTPUT_FLAG_NONE ||
+            out->flags == AUDIO_OUTPUT_FLAG_PRIMARY)
+            out->flags |= AUDIO_OUTPUT_FLAG_MEDIA;
         break;
     case CAR_AUDIO_STREAM_SYS_NOTIFICATION:
         /* sys notification bus stream shares pcm device with low-latency */
         out->usecase = USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION;
         out->config = pcm_config_low_latency;
+        if (out->flags == AUDIO_OUTPUT_FLAG_NONE)
+            out->flags |= AUDIO_OUTPUT_FLAG_SYS_NOTIFICATION;
         break;
     case CAR_AUDIO_STREAM_NAV_GUIDANCE:
         out->usecase = USECASE_AUDIO_PLAYBACK_NAV_GUIDANCE;
@@ -280,10 +285,14 @@
             ret = -EINVAL;
             goto error;
         }
+        if (out->flags == AUDIO_OUTPUT_FLAG_NONE)
+            out->flags |= AUDIO_OUTPUT_FLAG_NAV_GUIDANCE;
         break;
     case CAR_AUDIO_STREAM_PHONE:
         out->usecase = USECASE_AUDIO_PLAYBACK_PHONE;
         out->config = pcm_config_low_latency;
+        if (out->flags == AUDIO_OUTPUT_FLAG_NONE)
+            out->flags |= AUDIO_OUTPUT_FLAG_PHONE;
         break;
     default:
         ALOGE("%s: Car audio stream %x not supported", __func__,
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
index 30bc10d..10626c0 100644
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -146,6 +146,12 @@
     STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_VOIP_RX),
     STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_BD),
     STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_INTERACTIVE),
+#ifdef AUDIO_EXTN_AUTO_HAL_ENABLED
+    STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_MEDIA),
+    STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_SYS_NOTIFICATION),
+    STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_NAV_GUIDANCE),
+    STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_PHONE),
+#endif
     STRING_TO_ENUM(AUDIO_INPUT_FLAG_NONE),
     STRING_TO_ENUM(AUDIO_INPUT_FLAG_FAST),
     STRING_TO_ENUM(AUDIO_INPUT_FLAG_HW_HOTWORD),