audio policy: fix device selection in startInput()

Check again input device selection when capture starts in case
conditions have changed since the input stream was opened.

This is related to but does not fix issue 8761558. It makes the
selection of BT SCO device consistent.

Bug: 8761558
Change-Id: I386b638e9c3238711e16fb848449af561624359e
diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp
index e755d28..236bf69 100644
--- a/audio/AudioPolicyManagerBase.cpp
+++ b/audio/AudioPolicyManagerBase.cpp
@@ -941,6 +941,10 @@
         }
     }
 
+    audio_devices_t newDevice = getDeviceForInputSource(inputDesc->mInputSource);
+    if ((newDevice != AUDIO_DEVICE_NONE) && (newDevice != inputDesc->mDevice)) {
+        inputDesc->mDevice = newDevice;
+    }
     AudioParameter param = AudioParameter();
     param.addInt(String8(AudioParameter::keyRouting), (int)inputDesc->mDevice);