audio policy: fix mmap stream invalidation logic

Implement a MMAP stream invalidation logic consistent with AAudio
disconnect callback policy.

- When a MMAP stream is opened with a preferred device selection:
  Invalidate the stream only when the preferred device becomes unavailable,
  either because disconnected or not selectable by highest priority use case.
- When a MMAP stream is opened without explicit device selection:
  Invalidate the stream when current device selection changes due to the
  routing rules applicable to the stream's audio attributes (attributes
  of first client on that stream).

Bug: 144020984
Test: OboeTester > TEST DISCONNECT

Change-Id: I70fde0bc8ab9d544b8d3badb713e6239d792cbdb
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index ffc3a0f..3615669 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -2406,9 +2406,7 @@
     for (size_t i = 0; i < mInputs.size(); i++) {
         const sp<AudioInputDescriptor> input = mInputs.valueAt(i);
         if (input->clientsList().size() == 0
-                || !mAvailableInputDevices.containsAtLeastOne(input->supportedDevices())
-                || (input->getPolicyAudioPort()->getFlags()
-                        & AUDIO_INPUT_FLAG_MMAP_NOIRQ) != 0) {
+                || !mAvailableInputDevices.containsAtLeastOne(input->supportedDevices())) {
             inputsToClose.push_back(mInputs.keyAt(i));
         } else {
             bool close = false;