Add format conversion in AudioRecord.

In audio flinger, it is required that the client's format matches the
hardware format to get fast mode. However, format conversion is not a
time consuming operation. In that case, adding format conversion in
AudioRecord can help the client get fast mode if only format is
different from the hardware one. This can help improve latency.

Test: atest AudioRecordTest, capture audio in fast/non-fast mode
Bug: 79156275
Bug: 188843084
Change-Id: I1baaa9a6054bb84412c31a159c6d25ee498822cf
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 9665424..a07b9b1 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -8016,6 +8016,7 @@
       if (
             // we formerly checked for a callback handler (non-0 tid),
             // but that is no longer required for TRANSFER_OBTAIN mode
+            // No need to match hardware format, format conversion will be done in client side.
             //
             // Frame count is not specified (0), or is less than or equal the pipe depth.
             // It is OK to provide a higher capacity than requested.
@@ -8023,8 +8024,6 @@
             (frameCount <= mPipeFramesP2) &&
             // PCM data
             audio_is_linear_pcm(format) &&
-            // hardware format
-            (format == mFormat) &&
             // hardware channel mask
             (channelMask == mChannelMask) &&
             // hardware sample rate