Merge "Fix the set member size check error"
This commit is contained in:
commit
0c02dc46e1
@ -87,7 +87,7 @@ public class CachedBluetoothDeviceManager {
|
||||
}
|
||||
// Check the member devices for the coordinated set if it exists
|
||||
final Set<CachedBluetoothDevice> memberDevices = cachedDevice.getMemberDevice();
|
||||
if (memberDevices != null) {
|
||||
if (!memberDevices.isEmpty()) {
|
||||
for (CachedBluetoothDevice memberDevice : memberDevices) {
|
||||
if (memberDevice.getDevice().equals(device)) {
|
||||
return memberDevice;
|
||||
@ -141,7 +141,7 @@ public class CachedBluetoothDeviceManager {
|
||||
final Set<CachedBluetoothDevice> memberDevices = device.getMemberDevice();
|
||||
// TODO: check the CSIP group size instead of the real member device set size, and adjust
|
||||
// the size restriction.
|
||||
if (memberDevices.size() == 1) {
|
||||
if (!memberDevices.isEmpty()) {
|
||||
for (CachedBluetoothDevice memberDevice : memberDevices) {
|
||||
if (memberDevice.isConnected()) {
|
||||
return memberDevice.getConnectionSummary();
|
||||
@ -166,7 +166,7 @@ public class CachedBluetoothDeviceManager {
|
||||
if (!cachedDevice.getDevice().equals(device)) {
|
||||
// Check the member devices of the coordinated set if it exists
|
||||
Set<CachedBluetoothDevice> memberDevices = cachedDevice.getMemberDevice();
|
||||
if (memberDevices != null) {
|
||||
if (!memberDevices.isEmpty()) {
|
||||
for (CachedBluetoothDevice memberDevice : memberDevices) {
|
||||
if (memberDevice.getDevice().equals(device)) {
|
||||
return true;
|
||||
@ -231,7 +231,7 @@ public class CachedBluetoothDeviceManager {
|
||||
for (int i = mCachedDevices.size() - 1; i >= 0; i--) {
|
||||
CachedBluetoothDevice cachedDevice = mCachedDevices.get(i);
|
||||
final Set<CachedBluetoothDevice> memberDevices = cachedDevice.getMemberDevice();
|
||||
if (memberDevices != null) {
|
||||
if (!memberDevices.isEmpty()) {
|
||||
for (CachedBluetoothDevice memberDevice : memberDevices) {
|
||||
// Member device exists and it is not bonded
|
||||
if (memberDevice.getDevice().getBondState() == BluetoothDevice.BOND_NONE) {
|
||||
@ -257,7 +257,7 @@ public class CachedBluetoothDeviceManager {
|
||||
CachedBluetoothDevice cachedDevice = mCachedDevices.get(i);
|
||||
cachedDevice.setJustDiscovered(false);
|
||||
final Set<CachedBluetoothDevice> memberDevices = cachedDevice.getMemberDevice();
|
||||
if (memberDevices != null) {
|
||||
if (!memberDevices.isEmpty()) {
|
||||
for (CachedBluetoothDevice memberDevice : memberDevices) {
|
||||
memberDevice.setJustDiscovered(false);
|
||||
}
|
||||
@ -277,7 +277,7 @@ public class CachedBluetoothDeviceManager {
|
||||
for (int i = mCachedDevices.size() - 1; i >= 0; i--) {
|
||||
CachedBluetoothDevice cachedDevice = mCachedDevices.get(i);
|
||||
final Set<CachedBluetoothDevice> memberDevices = cachedDevice.getMemberDevice();
|
||||
if (memberDevices != null) {
|
||||
if (!memberDevices.isEmpty()) {
|
||||
for (CachedBluetoothDevice memberDevice : memberDevices) {
|
||||
if (memberDevice.getBondState() != BluetoothDevice.BOND_BONDED) {
|
||||
cachedDevice.removeMemberDevice(memberDevice);
|
||||
@ -315,7 +315,7 @@ public class CachedBluetoothDeviceManager {
|
||||
public synchronized void onDeviceUnpaired(CachedBluetoothDevice device) {
|
||||
CachedBluetoothDevice mainDevice = mCsipDeviceManager.findMainDevice(device);
|
||||
final Set<CachedBluetoothDevice> memberDevices = device.getMemberDevice();
|
||||
if (memberDevices != null) {
|
||||
if (!memberDevices.isEmpty()) {
|
||||
// Main device is unpaired, to unpair the member device
|
||||
for (CachedBluetoothDevice memberDevice : memberDevices) {
|
||||
memberDevice.unpair();
|
||||
|
@ -193,7 +193,7 @@ public class CsipDeviceManager {
|
||||
return true;
|
||||
}
|
||||
final Set<CachedBluetoothDevice> memberSet = cachedDevice.getMemberDevice();
|
||||
if (memberSet == null) {
|
||||
if (memberSet.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -225,7 +225,7 @@ public class CsipDeviceManager {
|
||||
for (CachedBluetoothDevice cachedDevice : mCachedDevices) {
|
||||
if (isValidGroupId(cachedDevice.getGroupId())) {
|
||||
Set<CachedBluetoothDevice> memberSet = cachedDevice.getMemberDevice();
|
||||
if (memberSet == null) {
|
||||
if (memberSet.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user