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

Commit 3dae6d67 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Bluetooth: Connect only A2dp Sink devices."

parents 9e06f196 661d7e56
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) &&