Blend MMAP streams for accessibility

There is an accessibility feature called Mono audio. This feature
allows stereo audio to be blended into mono audio.

Currently, this feature works perfectly in most scenarios. However,
this feature is not used when MMAP is enabled. This cl fixes MMAP
scenarios.

Bug: 69635707
Test: Tested on Bramble and MMAP through the following six scenarios:
1. MMAP Exclusive Mono Audio Enabled
2. MMAP Shared Mono Audio Enabled
3. No MMAP Mono Audio Enabled
4. MMAP Exclusive Mono Audio Disabled
5. MMAP Shared Mono Audio Disabled
6. No MMAP Mono Audio Disabled
You can enable Mono Audio from Settings -> Accessibility -> Audio
adjustment -> Mono audio
With OboeTester playing a different frequency on each ear, this seems
to work as expected.
atest test_flowgraph

Change-Id: I2688f06cc8c6ef0f2965845e65e2582f3cc9788e
diff --git a/media/libaaudio/tests/test_flowgraph.cpp b/media/libaaudio/tests/test_flowgraph.cpp
index 611cbf7..0792fc5 100644
--- a/media/libaaudio/tests/test_flowgraph.cpp
+++ b/media/libaaudio/tests/test_flowgraph.cpp
@@ -23,6 +23,7 @@
 #include <gtest/gtest.h>
 
 #include "flowgraph/ClipToRange.h"
+#include "flowgraph/MonoBlend.h"
 #include "flowgraph/MonoToMultiConverter.h"
 #include "flowgraph/SourceFloat.h"
 #include "flowgraph/RampLinear.h"
@@ -164,3 +165,29 @@
         EXPECT_NEAR(expected[i], output[i], tolerance);
     }
 }
+
+TEST(test_flowgraph, module_mono_blend) {
+    // Two channel to two channel with 3 inputs and outputs.
+    constexpr int numChannels = 2;
+    constexpr int numFrames = 3;
+
+    static const float input[] = {-0.7, 0.5, -0.25, 1.25, 1000, 2000};
+    static const float expected[] = {-0.1, -0.1, 0.5, 0.5, 1500, 1500};
+    float output[100];
+    SourceFloat sourceFloat{numChannels};
+    MonoBlend monoBlend{numChannels};
+    SinkFloat sinkFloat{numChannels};
+
+    sourceFloat.setData(input, numFrames);
+
+    sourceFloat.output.connect(&monoBlend.input);
+    monoBlend.output.connect(&sinkFloat.input);
+
+    int32_t numRead = sinkFloat.read(output, numFrames);
+    ASSERT_EQ(numRead, numFrames);
+    constexpr float tolerance = 0.000001f; // arbitrary
+    for (int i = 0; i < numRead; i++) {
+        EXPECT_NEAR(expected[i], output[i], tolerance);
+    }
+}
+