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 Merged-In: Iabdf49df08a9bb3f92f0673b59ba699818746804 Change-Id: Iabdf49df08a9bb3f92f0673b59ba699818746804
This commit is contained in:
@@ -6297,13 +6297,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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user