Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 949ed6b5 authored by Anubhav Gupta's avatar Anubhav Gupta Committed by Android Git Automerger
Browse files

am f34fce97: Check for A2dp SNK UUID supported by remote

* commit 'f34fce97':
  Check for A2dp SNK UUID supported by remote
parents 9f2b1637 f34fce97
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -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 ||