diff options
-rwxr-xr-x | src/com/android/bluetooth/a2dp/A2dpService.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/com/android/bluetooth/a2dp/A2dpService.java b/src/com/android/bluetooth/a2dp/A2dpService.java index bae637398..e14302caf 100755 --- a/src/com/android/bluetooth/a2dp/A2dpService.java +++ b/src/com/android/bluetooth/a2dp/A2dpService.java @@ -18,9 +18,11 @@ package com.android.bluetooth.a2dp; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; +import android.bluetooth.BluetoothUuid; import android.bluetooth.IBluetoothA2dp; import android.content.Context; import android.content.Intent; +import android.os.ParcelUuid; import android.provider.Settings; import android.util.Log; import com.android.bluetooth.avrcp.Avrcp; @@ -42,6 +44,13 @@ public class A2dpService extends ProfileService { private A2dpStateMachine mStateMachine; private Avrcp mAvrcp; private static A2dpService sAd2dpService; + static final ParcelUuid[] A2DP_SOURCE_UUID = { + BluetoothUuid.AudioSource + }; + static final ParcelUuid[] A2DP_SOURCE_SINK_UUIDS = { + BluetoothUuid.AudioSource, + BluetoothUuid.AudioSink + }; protected String getName() { return TAG; @@ -123,6 +132,12 @@ public class A2dpService extends ProfileService { if (getPriority(device) == BluetoothProfile.PRIORITY_OFF) { return false; } + ParcelUuid[] featureUuids = device.getUuids(); + if ((BluetoothUuid.containsAnyUuid(featureUuids, A2DP_SOURCE_UUID)) && + !(BluetoothUuid.containsAllUuids(featureUuids ,A2DP_SOURCE_SINK_UUIDS))) { + Log.e(TAG,"Remote does not have A2dp Sink UUID"); + return false; + } int connectionState = mStateMachine.getConnectionState(device); if (connectionState == BluetoothProfile.STATE_CONNECTED || |