Add TYPE_USB_DEVICE to list of external output devices.
Also adds some logging.
This commit is contained in:
parent
3c62628a42
commit
eb001ad7be
@ -972,11 +972,12 @@ public final class PlaybackService extends Service
|
||||
// Devices we consider to not be speakers.
|
||||
final Integer[] headsetTypes = { AudioDeviceInfo.TYPE_BLUETOOTH_A2DP, AudioDeviceInfo.TYPE_BLUETOOTH_SCO,
|
||||
AudioDeviceInfo.TYPE_WIRED_HEADSET, AudioDeviceInfo.TYPE_WIRED_HEADPHONES,
|
||||
AudioDeviceInfo.TYPE_USB_HEADSET };
|
||||
AudioDeviceInfo.TYPE_USB_HEADSET, AudioDeviceInfo.TYPE_USB_DEVICE };
|
||||
boolean result = true;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
AudioDeviceInfo[] devices = mAudioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS);
|
||||
for (AudioDeviceInfo device: devices) {
|
||||
Log.v("VanillaMusic", "AudioDeviceInfo type = " + device.getType());
|
||||
if (Arrays.asList(headsetTypes).contains(device.getType())) {
|
||||
result = false;
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user