AudioFlinger: fallback to non-primary HW devs if getInputBufferSize failed

At the moment only primary audio module is requested for its
input buffer size, but it may not even support input streams,
while there may be other modules with input support.

This patch adds fallback that requests non-primary modules
if the primary module failed in the following precedence:

-- USB
-- Bluetooth
-- A2DP
-- Other modules
-- Remote submix

Test: manual
Change-Id: I54bae431745edecdf23ec09e59292dca6b434965
Signed-off-by: Oleg Lyovin <ovlevin@salutedevices.com>
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 0f75d6e..39462fc 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -629,6 +629,10 @@
     DefaultKeyedVector<audio_module_handle_t, AudioHwDevice*> mAudioHwDevs
             GUARDED_BY(hardwareMutex()) {nullptr /* defValue */};
 
+    static bool inputBufferSizeDevsCmp(const AudioHwDevice* lhs, const AudioHwDevice* rhs);
+    std::set<AudioHwDevice*, decltype(&inputBufferSizeDevsCmp)>
+            mInputBufferSizeOrderedDevs GUARDED_BY(hardwareMutex()) {inputBufferSizeDevsCmp};
+
      const sp<DevicesFactoryHalInterface> mDevicesFactoryHal =
              DevicesFactoryHalInterface::create();
      /* const */ sp<DevicesFactoryHalCallback> mDevicesFactoryHalCallback;  // set onFirstRef().