OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 } else { | 444 } else { |
445 final AudioDeviceInfo[] devices = audioManager.getDevices(AudioManager.GET
_DEVICES_ALL); | 445 final AudioDeviceInfo[] devices = audioManager.getDevices(AudioManager.GET
_DEVICES_ALL); |
446 for (AudioDeviceInfo device : devices) { | 446 for (AudioDeviceInfo device : devices) { |
447 final int type = device.getType(); | 447 final int type = device.getType(); |
448 if (type == AudioDeviceInfo.TYPE_WIRED_HEADSET) { | 448 if (type == AudioDeviceInfo.TYPE_WIRED_HEADSET) { |
449 Log.d(TAG, "hasWiredHeadset: found wired headset"); | 449 Log.d(TAG, "hasWiredHeadset: found wired headset"); |
450 return true; | 450 return true; |
451 } else if (type == AudioDeviceInfo.TYPE_USB_DEVICE) { | 451 } else if (type == AudioDeviceInfo.TYPE_USB_DEVICE) { |
452 Log.d(TAG, "hasWiredHeadset: found USB audio device"); | 452 Log.d(TAG, "hasWiredHeadset: found USB audio device"); |
453 return true; | 453 return true; |
454 } else if (type == AudioDeviceInfo.TYPE_USB_HEADSET) { | |
455 Log.d(TAG, "hasWiredHeadset: found USB headset"); | |
456 return true; | |
457 } | 454 } |
458 } | 455 } |
459 return false; | 456 return false; |
460 } | 457 } |
461 } | 458 } |
462 | 459 |
463 /** | 460 /** |
464 * Updates list of possible audio devices and make new device selection. | 461 * Updates list of possible audio devices and make new device selection. |
465 * TODO(henrika): add unit test to verify all state transitions. | 462 * TODO(henrika): add unit test to verify all state transitions. |
466 */ | 463 */ |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 + "available=" + audioDevices + ", " | 586 + "available=" + audioDevices + ", " |
590 + "selected=" + newAudioDevice); | 587 + "selected=" + newAudioDevice); |
591 if (audioManagerEvents != null) { | 588 if (audioManagerEvents != null) { |
592 // Notify a listening client that audio device has been changed. | 589 // Notify a listening client that audio device has been changed. |
593 audioManagerEvents.onAudioDeviceChanged(selectedAudioDevice, audioDevice
s); | 590 audioManagerEvents.onAudioDeviceChanged(selectedAudioDevice, audioDevice
s); |
594 } | 591 } |
595 } | 592 } |
596 Log.d(TAG, "--- updateAudioDeviceState done"); | 593 Log.d(TAG, "--- updateAudioDeviceState done"); |
597 } | 594 } |
598 } | 595 } |
OLD | NEW |