libaudiohal@aidl: update dynamic mix port when disconnecting device.

When an external device is disconnected, the framework should query the
HAL to update the cached mix port so that the cached mix ports are up to
date in libaudiohal. That prevents stream opening failure after
disconecting external devices.

Bug: 251215866
Test: connect multiple different devices
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:4def684ea164870c775bd4bc6e688bf669d242d2)
Merged-In: Ibc6c29f9a31c0cb5257e8348aba6822086564947
Change-Id: Ibc6c29f9a31c0cb5257e8348aba6822086564947
diff --git a/media/libaudiohal/impl/Hal2AidlMapper.h b/media/libaudiohal/impl/Hal2AidlMapper.h
index 21cfd5a..0117410 100644
--- a/media/libaudiohal/impl/Hal2AidlMapper.h
+++ b/media/libaudiohal/impl/Hal2AidlMapper.h
@@ -185,6 +185,7 @@
     status_t updateAudioPort(
             int32_t portId, ::aidl::android::media::audio::common::AudioPort* port);
     status_t updateRoutes();
+    void updateDynamicMixPorts();
 
     Ports mPorts;
     // Remote submix "template" ports (no address specified, no profiles).
@@ -202,6 +203,7 @@
     ConnectedPorts mConnectedPorts;
     std::pair<int32_t, ::aidl::android::media::audio::common::AudioPort>
             mDisconnectedPortReplacement;
+    std::set<int32_t> mDynamicMixPortIds;
 };
 
 }  // namespace android