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

Commit 661d7e56 authored by Gaurav Asati's avatar Gaurav Asati
Browse files

Bluetooth: Connect only A2dp Sink devices.

DUT supports only A2DP source role,it should connect
only with A2DP sink devices.RENDERING service must be
supported by A2DP sink devices.Hence try to connect A2DP
source only with these class of devices.

CRs-Fixed: 507306

Change-Id: I93d9d30185444473e79008b47b607802ec5e7f3e
parent c5987d22
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.bluetooth.a2dp;

import android.bluetooth.BluetoothClass;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothProfile;
import android.bluetooth.IBluetoothA2dp;
@@ -115,6 +116,13 @@ public class A2dpService extends ProfileService {
        enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
                                       "Need BLUETOOTH ADMIN permission");

        BluetoothClass remoteclass = device.getBluetoothClass();
        if (DBG) {
            Log.d(TAG,"getRemoteClass " + remoteclass.toString());
        }
        if (!remoteclass.doesClassMatch(BluetoothClass.PROFILE_A2DP)) {
            return false;
        }
        if (getPriority(device) == BluetoothProfile.PRIORITY_OFF) {
            return false;
        }
+5 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ package com.android.bluetooth.a2dp;

import android.bluetooth.BluetoothA2dp;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothClass;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothProfile;
import android.bluetooth.BluetoothUuid;
@@ -635,6 +636,10 @@ final class A2dpStateMachine extends StateMachine {
        AdapterService adapterService = AdapterService.getAdapterService();
        int priority = mService.getPriority(device);
        boolean ret = false;
        BluetoothClass remoteclass = device.getBluetoothClass();
        if (!remoteclass.doesClassMatch(BluetoothClass.PROFILE_A2DP)) {
            return false;
        }
        //check if this is an incoming connection in Quiet mode.
        if((adapterService == null) ||
           ((adapterService.isQuietModeEnabled() == true) &&