Update BT APIs for change in return type.
Change-Id: Ic85b47da50876fd6bdc6e223af4248a8586d82bc
This commit is contained in:
@@ -300,7 +300,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
|
||||
LocalBluetoothProfileManager profileManager =
|
||||
LocalBluetoothProfileManager.getProfileManager(mLocalManager, profile);
|
||||
CachedBluetoothDeviceManager cachedDeviceManager = mLocalManager.getCachedDeviceManager();
|
||||
Set<BluetoothDevice> devices = profileManager.getConnectedDevices();
|
||||
List<BluetoothDevice> devices = profileManager.getConnectedDevices();
|
||||
if (devices == null) return;
|
||||
for (BluetoothDevice btDevice : devices) {
|
||||
CachedBluetoothDevice cachedDevice = cachedDeviceManager.findDevice(btDevice);
|
||||
|
@@ -196,10 +196,9 @@ public class LocalBluetoothManager {
|
||||
|
||||
// If we are playing music, don't scan unless forced.
|
||||
if (mBluetoothA2dp != null) {
|
||||
Set<BluetoothDevice> sinks = mBluetoothA2dp.getConnectedDevices();
|
||||
List<BluetoothDevice> sinks = mBluetoothA2dp.getConnectedDevices();
|
||||
if (sinks.size() > 0) {
|
||||
BluetoothDevice sink = sinks.toArray(new BluetoothDevice[sinks.size()])[0];
|
||||
if (mBluetoothA2dp.isA2dpPlaying(sink)) return;
|
||||
if (mBluetoothA2dp.isA2dpPlaying(sinks.get(0))) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -197,7 +197,7 @@ public abstract class LocalBluetoothProfileManager {
|
||||
mLocalManager = localManager;
|
||||
}
|
||||
|
||||
public abstract Set<BluetoothDevice> getConnectedDevices();
|
||||
public abstract List<BluetoothDevice> getConnectedDevices();
|
||||
|
||||
public abstract boolean connect(BluetoothDevice device);
|
||||
|
||||
@@ -261,7 +261,7 @@ public abstract class LocalBluetoothProfileManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<BluetoothDevice> getConnectedDevices() {
|
||||
public List<BluetoothDevice> getConnectedDevices() {
|
||||
return mService.getDevicesMatchingConnectionStates(
|
||||
new int[] {BluetoothProfile.STATE_CONNECTED,
|
||||
BluetoothProfile.STATE_CONNECTING,
|
||||
@@ -270,7 +270,7 @@ public abstract class LocalBluetoothProfileManager {
|
||||
|
||||
@Override
|
||||
public boolean connect(BluetoothDevice device) {
|
||||
Set<BluetoothDevice> sinks = getConnectedDevices();
|
||||
List<BluetoothDevice> sinks = getConnectedDevices();
|
||||
if (sinks != null) {
|
||||
for (BluetoothDevice sink : sinks) {
|
||||
mService.disconnect(sink);
|
||||
@@ -378,14 +378,11 @@ public abstract class LocalBluetoothProfileManager {
|
||||
* We just bound to the service, so refresh the UI of the
|
||||
* headset device.
|
||||
*/
|
||||
Set<BluetoothDevice> deviceSet = mService.getConnectedDevices();
|
||||
if (deviceSet.size() == 0) return;
|
||||
|
||||
BluetoothDevice[] devices =
|
||||
deviceSet.toArray(new BluetoothDevice[deviceSet.size()]);
|
||||
List<BluetoothDevice> deviceList = mService.getConnectedDevices();
|
||||
if (deviceList.size() == 0) return;
|
||||
|
||||
mLocalManager.getCachedDeviceManager()
|
||||
.onProfileStateChanged(devices[0], Profile.HEADSET,
|
||||
.onProfileStateChanged(deviceList.get(0), Profile.HEADSET,
|
||||
BluetoothProfile.STATE_CONNECTED);
|
||||
}
|
||||
});
|
||||
@@ -415,7 +412,7 @@ public abstract class LocalBluetoothProfileManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<BluetoothDevice> getConnectedDevices() {
|
||||
public List<BluetoothDevice> getConnectedDevices() {
|
||||
return mService.getConnectedDevices();
|
||||
}
|
||||
|
||||
@@ -426,9 +423,8 @@ public abstract class LocalBluetoothProfileManager {
|
||||
|
||||
@Override
|
||||
public boolean disconnect(BluetoothDevice device) {
|
||||
Set<BluetoothDevice> deviceSet = getConnectedDevices();
|
||||
BluetoothDevice[] devices = deviceSet.toArray(new BluetoothDevice[deviceSet.size()]);
|
||||
if (devices.length != 0 && devices[0].equals(device)) {
|
||||
List<BluetoothDevice> deviceList = getConnectedDevices();
|
||||
if (deviceList.size() != 0 && deviceList.get(0).equals(device)) {
|
||||
// Downgrade prority as user is disconnecting the headset.
|
||||
if (mService.getPriority(device) > BluetoothProfile.PRIORITY_ON) {
|
||||
mService.setPriority(device, BluetoothProfile.PRIORITY_ON);
|
||||
@@ -441,10 +437,9 @@ public abstract class LocalBluetoothProfileManager {
|
||||
|
||||
@Override
|
||||
public int getConnectionStatus(BluetoothDevice device) {
|
||||
Set<BluetoothDevice> deviceSet = getConnectedDevices();
|
||||
BluetoothDevice[] devices = deviceSet.toArray(new BluetoothDevice[deviceSet.size()]);
|
||||
List<BluetoothDevice> deviceList = getConnectedDevices();
|
||||
|
||||
return devices.length > 0 && devices[0].equals(device)
|
||||
return deviceList.size() > 0 && deviceList.get(0).equals(device)
|
||||
? convertState(mService.getConnectionState(device))
|
||||
: SettingsBtStatus.CONNECTION_STATUS_DISCONNECTED;
|
||||
}
|
||||
@@ -506,7 +501,7 @@ public abstract class LocalBluetoothProfileManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<BluetoothDevice> getConnectedDevices() {
|
||||
public List<BluetoothDevice> getConnectedDevices() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -605,7 +600,7 @@ public abstract class LocalBluetoothProfileManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<BluetoothDevice> getConnectedDevices() {
|
||||
public List<BluetoothDevice> getConnectedDevices() {
|
||||
return mService.getConnectedInputDevices();
|
||||
}
|
||||
|
||||
@@ -703,7 +698,7 @@ public abstract class LocalBluetoothProfileManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<BluetoothDevice> getConnectedDevices() {
|
||||
public List<BluetoothDevice> getConnectedDevices() {
|
||||
return mService.getConnectedDevices();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user