Merge remote-tracking branch into aosp

  audio/hal: Configure HDMI channels based on output stream channels
  hal: Fix for Tx Mute issue when a new call accepted while in call
  Level measurement in offloaded visualizer
  audio: Presentation time enhancements
  implement get_presentation_position() for offloaded outputs
  audio : add new TMUS MCC and MNC list
  audio : add new TMUS MCC and MNC list
  audio : add new TMUS MCC and MNC list
  add offloaded audio visualizer
  audio: compress offload enhancements
  audio: enable AAC offload
  audio: set cached volume before starting voice call
  audio: set cached volume before starting voice call
  Implement HAL API get_presentation_position
  hal: force stop after drain.
  hal: Add support for Tunnel mode audio playback

Conflicts:
	Android.mk
	hal/audio_hw.c
	hal/audio_hw.h
	hal/msm8960/platform.c
	hal/msm8974/platform.c

Change-Id: I0c66fd6bae9b4974e1791f4e848c775d389da3d0
diff --git a/hal/msm8960/platform.c b/hal/msm8960/platform.c
index 78d06c5..ac36f87 100644
--- a/hal/msm8960/platform.c
+++ b/hal/msm8960/platform.c
@@ -192,6 +192,9 @@
     [SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE] = 6,
 };
 
+#define DEEP_BUFFER_PLATFORM_DELAY (29*1000LL)
+#define LOW_LATENCY_PLATFORM_DELAY (13*1000LL)
+
 static pthread_once_t check_op_once_ctl = PTHREAD_ONCE_INIT;
 static bool is_tmus = false;
 
@@ -889,3 +892,16 @@
     LOGE("%s: Not implemented", __func__);
     return -ENOSYS;
 }
+
+/* Delay in Us */
+int64_t platform_render_latency(audio_usecase_t usecase)
+{
+    switch (usecase) {
+        case USECASE_AUDIO_PLAYBACK_DEEP_BUFFER:
+            return DEEP_BUFFER_PLATFORM_DELAY;
+        case USECASE_AUDIO_PLAYBACK_LOW_LATENCY:
+            return LOW_LATENCY_PLATFORM_DELAY;
+        default:
+            return 0;
+    }
+}