SpatializerHelper: fix routing check in canBeSpatialized

Fill in AudioDeviceAttributes array from ArrayList directly
when calling AudioSystem.canBeSpatialized() method.

Bug: 208931004
Test: atest SpatializerTester run on device that supports
     spatial audio, connected to audio device where
     spatialization is expected.
Change-Id: I41f9058765ee20243459af84cd40d870f26f3226
This commit is contained in:
Jean-Michel Trivi
2021-12-02 20:38:10 -08:00
parent 990528e9be
commit 81f71862ba

View File

@@ -551,9 +551,9 @@ public class SpatializerHelper {
logd("canBeSpatialized false due to usage:" + attributes.getUsage());
return false;
}
AudioDeviceAttributes[] devices =
// going through adapter to take advantage of routing cache
(AudioDeviceAttributes[]) mASA.getDevicesForAttributes(attributes).toArray();
AudioDeviceAttributes[] devices = new AudioDeviceAttributes[1];
// going through adapter to take advantage of routing cache
mASA.getDevicesForAttributes(attributes).toArray(devices);
final boolean able = AudioSystem.canBeSpatialized(attributes, format, devices);
logd("canBeSpatialized returning " + able);
return able;