audio: Initialize the radio voice session

This just allocates the structre and creates the RIL connection. This is
per audio_device structure to make sure we to not run into issues with
audioserver threading.

Change-Id: I42e1b7ae57579f39c5f76566ef5b67d4e2c13e3f
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index 59cc0f4..97acd48 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -48,6 +48,7 @@
 #include <audio_effects/effect_ns.h>
 #include "audio_hw.h"
 #include "compress_offload.h"
+#include "voice.h"
 
 #include "sound/compress_params.h"
 
@@ -4184,10 +4185,12 @@
 static int adev_close(hw_device_t *device)
 {
     struct audio_device *adev = (struct audio_device *)device;
+    voice_session_deinit(adev->voice.session);
     audio_device_ref_count--;
     free(adev->snd_dev_ref_cnt);
     free_mixer_list(adev);
     free(device);
+
     return 0;
 }
 
@@ -4318,6 +4321,16 @@
         }
     }
 
+    adev->voice.session = voice_session_init();
+    if (adev->voice.session == NULL) {
+        ALOGE("%s: Failed to initialize voice session data", __func__);
+
+        free(adev->snd_dev_ref_cnt);
+        free(adev);
+
+        *device = NULL;
+        return -EINVAL;
+    }
 
     *device = &adev->device.common;