alsa_sound: add support for low latency playback and recording

b/6865729

- Add deep buffer output in config file
- Configure deep buffer output if flag
  AUDIO_OUTPUT_FLAG_DEEP_BUFFER is set,
  otherwise configure low latency output.
- Add support for low latency recording
- Enable low latency recording path with
  system property
- For 2 buffers and 2048 bytes, reduce
  PLAYBACK_LOW_LATENCY to 21.5 ms

Change-Id: I3c0d54fa473fe89df5a3924de483f16975f4000e
Signed-off-by: Iliyan Malchev <malchev@google.com>
diff --git a/alsa_sound/audio_policy.conf b/alsa_sound/audio_policy.conf
index 8bfc63d..be2da9d 100644
--- a/alsa_sound/audio_policy.conf
+++ b/alsa_sound/audio_policy.conf
@@ -27,12 +27,19 @@
   primary {
     outputs {
       primary {
-        sampling_rates 44100
+        sampling_rates 44100|48000
         channel_masks AUDIO_CHANNEL_OUT_STEREO
         formats AUDIO_FORMAT_PCM_16_BIT
         devices AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE|AUDIO_DEVICE_OUT_ALL_SCO|AUDIO_DEVICE_OUT_AUX_DIGITAL
         flags AUDIO_OUTPUT_FLAG_PRIMARY
       }
+      deep_buffer {
+        sampling_rates 8000|11025|12000|16000|22050|24000|32000|44100|48000
+        channel_masks AUDIO_CHANNEL_OUT_STEREO
+        formats AUDIO_FORMAT_PCM_16_BIT
+        devices AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE|AUDIO_DEVICE_OUT_ALL_SCO|AUDIO_DEVICE_OUT_AUX_DIGITAL
+        flags AUDIO_OUTPUT_FLAG_DEEP_BUFFER
+      }
     }
     inputs {
       primary {