AudioService: Unify multiple device volume selection with APM

Java selectOneAudioDevice() should match
native apm_extract_one_audio_device().
Generally cosmetic change, but could have implications
if other logic is modified.

Test: compiles
Bug: 220948052
Change-Id: Iabdf49df08a9bb3f92f0673b59ba699818746804
This commit is contained in:
Andy Hung
2022-02-22 17:48:37 -08:00
parent 1162c55ed4
commit 9dbe751e90

View File

@@ -6298,13 +6298,16 @@ public class AudioService extends IAudioService.Stub
return AudioSystem.DEVICE_OUT_HDMI_ARC;
} else if (deviceSet.contains(AudioSystem.DEVICE_OUT_HDMI_EARC)) {
return AudioSystem.DEVICE_OUT_HDMI_EARC;
} else if (deviceSet.contains(AudioSystem.DEVICE_OUT_SPDIF)) {
return AudioSystem.DEVICE_OUT_SPDIF;
} else if (deviceSet.contains(AudioSystem.DEVICE_OUT_AUX_LINE)) {
return AudioSystem.DEVICE_OUT_AUX_LINE;
} else if (deviceSet.contains(AudioSystem.DEVICE_OUT_SPDIF)) {
return AudioSystem.DEVICE_OUT_SPDIF;
} else {
for (int deviceType : AudioSystem.DEVICE_OUT_ALL_A2DP_SET) {
if (deviceSet.contains(deviceType)) {
// At this point, deviceSet should contain exactly one A2DP device;
// regardless, return the first A2DP device in numeric order.
// If there is no A2DP device, this falls through to log an error.
for (int deviceType : deviceSet) {
if (AudioSystem.DEVICE_OUT_ALL_A2DP_SET.contains(deviceType)) {
return deviceType;
}
}