audioflinger: set flush pending on invalidating offload track

On invalidating an offload track, the IAudioTrack instance is
destroyed and the offload output is released. If it so happens
that APM::getOutputForAttr for the new IAudioTrack is called before
OffloadThread::prepareTracks_l checks and removes an invalid track,
the same output can get reused.

The side effect of this is data present in HAL and below from before the
invalidate will be rendered before data from the new seek position
is rendered. This is unexpected.

To fix this, set hint to issue flush when an offload track is invalidated.

Bug: 28566885
Change-Id: Ib6c38a3abb600598b87591bac90d03b7150d5216
diff --git a/services/audioflinger/Threads.h b/services/audioflinger/Threads.h
index 16238f8..0ddd279 100644
--- a/services/audioflinger/Threads.h
+++ b/services/audioflinger/Threads.h
@@ -606,7 +606,8 @@
                 virtual bool     isValidSyncEvent(const sp<SyncEvent>& event) const;
 
                 // called with AudioFlinger lock held
-                        void     invalidateTracks(audio_stream_type_t streamType);
+                        void     invalidateTracks_l(audio_stream_type_t streamType);
+                virtual void     invalidateTracks(audio_stream_type_t streamType);
 
     virtual     size_t      frameCount() const { return mNormalFrameCount; }
 
@@ -998,6 +999,7 @@
 
     virtual     bool        waitingAsyncCallback();
     virtual     bool        waitingAsyncCallback_l();
+    virtual     void        invalidateTracks(audio_stream_type_t streamType);
 
     virtual     bool        keepWakeLock() const { return mKeepWakeLock; }