Add support for mmap stream

Add support for MMAP streams created by Oboe service.
- A new audio thread class MmapThread deriving from ThreadBase
is added to manage permissions, volume, routing and wakelocks for activity
on MMAP streams.
- Requests received over MmapStreamInterface to open, start and stop
a MMAP stream are forwarded to audio policy manager so that activity
on MMAP capture and playback streams is visible to audio policy and
taken into account in volume and routing management.
`

Bug: Bug: 33398120
Test: manual test
Change-Id: I957906495fe9277d2972d810b633f50cd1e14ec3
diff --git a/services/audioflinger/TrackBase.h b/services/audioflinger/TrackBase.h
index 9ca2d63..e0c09f7 100644
--- a/services/audioflinger/TrackBase.h
+++ b/services/audioflinger/TrackBase.h
@@ -77,6 +77,7 @@
             audio_track_cblk_t* cblk() const { return mCblk; }
             audio_session_t sessionId() const { return mSessionId; }
             uid_t       uid() const { return mUid; }
+            audio_port_handle_t portId() const { return mPortId; }
     virtual status_t    setSyncEvent(const sp<SyncEvent>& event);
 
             sp<IMemory> getBuffers() const { return mBufferMemory; }
@@ -86,6 +87,10 @@
             bool        isPatchTrack() const { return (mType == TYPE_PATCH); }
             bool        isExternalTrack() const { return !isOutputTrack() && !isPatchTrack(); }
 
+    virtual void        invalidate() { mIsInvalid = true; }
+            bool        isInvalid() const { return mIsInvalid; }
+
+
 protected:
                         TrackBase(const TrackBase&);
                         TrackBase& operator = (const TrackBase&);
@@ -165,6 +170,7 @@
     track_type          mType;      // must be one of TYPE_DEFAULT, TYPE_OUTPUT, TYPE_PATCH ...
     audio_io_handle_t   mThreadIoHandle; // I/O handle of the thread the track is attached to
     audio_port_handle_t mPortId; // unique ID for this track used by audio policy
+    bool                mIsInvalid; // non-resettable latch, set by invalidate()
 };
 
 // PatchProxyBufferProvider interface is implemented by PatchTrack and PatchRecord.