hal: Fix AudioRecord and AudioTrack timestamps incorrect

Calculate the timestamps with platfrom and snd device delay.
Add delay for snd device from xml and add platform rendor delay
with snd device delay for capture and playback usecases.

Bug: 137325602
Test: manual test
Change-Id: I2a606018cb1fb6678459e3a407dcb02b7db1b074
Signed-off-by: Robert Lee <lerobert@google.com>
(cherry picked from commit 225f7d47ac137746f99b4a436dfc279dc7be7918)
Signed-off-by: Aniket Kumar Lata <alata@codeaurora.org>
diff --git a/hal/platform_api.h b/hal/platform_api.h
index c8c1447..0934bb2 100644
--- a/hal/platform_api.h
+++ b/hal/platform_api.h
@@ -236,7 +236,8 @@
 int platform_update_lch(void *platform, struct voice_session *session,
                         enum voice_lch_mode lch_mode);
 /* returns the latency for a usecase in Us */
-int64_t platform_render_latency(audio_usecase_t usecase);
+int64_t platform_render_latency(struct audio_device* adev, audio_usecase_t usecase);
+int64_t platform_capture_latency(struct audio_device* adev, audio_usecase_t usecase);
 int platform_update_usecase_from_source(int source, audio_usecase_t usecase);
 
 bool platform_listen_device_needs_event(snd_device_t snd_device);
@@ -419,4 +420,5 @@
                                   int controller, int stream);
 int platform_get_display_port_ctl_index(int controller, int stream);
 bool platform_is_call_proxy_snd_device(snd_device_t snd_device);
+void platform_set_snd_device_delay(snd_device_t snd_device, int delay_ms);
 #endif // AUDIO_PLATFORM_API_H