diff options
| -rw-r--r-- | services/core/java/com/android/server/audio/AudioDeviceInventory.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/audio/AudioDeviceInventory.java b/services/core/java/com/android/server/audio/AudioDeviceInventory.java index 352d0d56ca8a..21c478417d87 100644 --- a/services/core/java/com/android/server/audio/AudioDeviceInventory.java +++ b/services/core/java/com/android/server/audio/AudioDeviceInventory.java @@ -241,15 +241,17 @@ public class AudioDeviceInventory { } else { makeA2dpDeviceUnavailableNow(address, di.mDeviceCodecFormat); } + } else if (state == BluetoothProfile.STATE_CONNECTED) { + // device is not already connected + if (a2dpVolume != -1) { + mDeviceBroker.postSetVolumeIndexOnDevice(AudioSystem.STREAM_MUSIC, + // convert index to internal representation in VolumeStreamState + a2dpVolume * 10, + AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, "onSetA2dpSinkConnectionState"); + } + makeA2dpDeviceAvailable(address, BtHelper.getName(btDevice), + "onSetA2dpSinkConnectionState", a2dpCodec); } - if (a2dpVolume != -1) { - mDeviceBroker.postSetVolumeIndexOnDevice(AudioSystem.STREAM_MUSIC, - // convert index to internal representation in VolumeStreamState - a2dpVolume * 10, - AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, "onSetA2dpSinkConnectionState"); - } - makeA2dpDeviceAvailable(address, BtHelper.getName(btDevice), - "onSetA2dpSinkConnectionState", a2dpCodec); } } |