b/2293042 Fixed the problem where A2DP connections may fail if there's an existing connection to another device.
Change-Id: I1b4963a167b633c0905e2719ab3f651ff8be9f2c
This commit is contained in:
@@ -16,17 +16,18 @@
|
||||
|
||||
package com.android.settings.bluetooth;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
import android.bluetooth.BluetoothA2dp;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.bluetooth.BluetoothHeadset;
|
||||
import android.bluetooth.BluetoothUuid;
|
||||
import android.os.ParcelUuid;
|
||||
import android.os.Handler;
|
||||
import android.os.ParcelUuid;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -121,6 +122,8 @@ public abstract class LocalBluetoothProfileManager {
|
||||
mLocalManager = localManager;
|
||||
}
|
||||
|
||||
public abstract Set<BluetoothDevice> getConnectedDevices();
|
||||
|
||||
public abstract boolean connect(BluetoothDevice device);
|
||||
|
||||
public abstract boolean disconnect(BluetoothDevice device);
|
||||
@@ -163,6 +166,11 @@ public abstract class LocalBluetoothProfileManager {
|
||||
mService = new BluetoothA2dp(localManager.getContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<BluetoothDevice> getConnectedDevices() {
|
||||
return mService.getConnectedSinks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean connect(BluetoothDevice device) {
|
||||
Set<BluetoothDevice> sinks = mService.getConnectedSinks();
|
||||
@@ -260,6 +268,17 @@ public abstract class LocalBluetoothProfileManager {
|
||||
public void onServiceDisconnected() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<BluetoothDevice> getConnectedDevices() {
|
||||
Set<BluetoothDevice> devices = null;
|
||||
BluetoothDevice device = mService.getCurrentHeadset();
|
||||
if (device != null) {
|
||||
devices = new HashSet<BluetoothDevice>();
|
||||
devices.add(device);
|
||||
}
|
||||
return devices;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean connect(BluetoothDevice device) {
|
||||
// Since connectHeadset fails if already connected to a headset, we
|
||||
@@ -333,6 +352,11 @@ public abstract class LocalBluetoothProfileManager {
|
||||
super(localManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<BluetoothDevice> getConnectedDevices() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean connect(BluetoothDevice device) {
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user