fix flush on HW A/V sync tracks

Fix mismatch between track flags on client and server side
when HW A/V sync is requested.

The audio track was connected to a direct output by the audio policy
manager but the client failed to set the direct flag when creating
the track resulting in the direct flag not being set in audio flinger.

Bug: 19665934.
Change-Id: I0a5257b20bf76c9c4d89bc2ad9b44777b81f13bf
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 0ad9cc0..c775e7b 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -299,6 +299,9 @@
         ALOGV("Building AudioTrack with attributes: usage=%d content=%d flags=0x%x tags=[%s]",
                 mAttributes.usage, mAttributes.content_type, mAttributes.flags, mAttributes.tags);
         mStreamType = AUDIO_STREAM_DEFAULT;
+        if ((mAttributes.flags & AUDIO_FLAG_HW_AV_SYNC) != 0) {
+            flags = (audio_output_flags_t)(flags | AUDIO_OUTPUT_FLAG_HW_AV_SYNC);
+        }
     }
 
     // these below should probably come from the audioFlinger too...