Loading packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +11 −11 Original line number Diff line number Diff line Loading @@ -1351,7 +1351,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> /** * Store the member devices that are in the same coordinated set. */ public void setMemberDevice(CachedBluetoothDevice memberDevice) { public void addMemberDevice(CachedBluetoothDevice memberDevice) { mMemberDevices.add(memberDevice); } Loading @@ -1368,24 +1368,24 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> * device and member devices. * * @param prevMainDevice the previous Main device, it will be added into the member device set. * @param newMainDevie the new Main device, it will be removed from the member device set. * @param newMainDevice the new Main device, it will be removed from the member device set. */ public void switchMemberDeviceContent(CachedBluetoothDevice prevMainDevice, CachedBluetoothDevice newMainDevie) { CachedBluetoothDevice newMainDevice) { // Backup from main device final BluetoothDevice tmpDevice = mDevice; final short tmpRssi = mRssi; final boolean tmpJustDiscovered = mJustDiscovered; // Set main device from sub device mDevice = newMainDevie.mDevice; mRssi = newMainDevie.mRssi; mJustDiscovered = newMainDevie.mJustDiscovered; setMemberDevice(prevMainDevice); mMemberDevices.remove(newMainDevie); mDevice = newMainDevice.mDevice; mRssi = newMainDevice.mRssi; mJustDiscovered = newMainDevice.mJustDiscovered; addMemberDevice(prevMainDevice); mMemberDevices.remove(newMainDevice); // Set sub device from backup newMainDevie.mDevice = tmpDevice; newMainDevie.mRssi = tmpRssi; newMainDevie.mJustDiscovered = tmpJustDiscovered; newMainDevice.mDevice = tmpDevice; newMainDevice.mRssi = tmpRssi; newMainDevice.mJustDiscovered = tmpJustDiscovered; fetchActiveDevices(); } Loading packages/SettingsLib/src/com/android/settingslib/bluetooth/CsipDeviceManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -85,7 +85,7 @@ public class CsipDeviceManager { // Once there is other devices with the same groupId, to add new device as member // devices. if (CsipDevice != null) { CsipDevice.setMemberDevice(newDevice); CsipDevice.addMemberDevice(newDevice); newDevice.setName(CsipDevice.getName()); return true; } Loading Loading @@ -148,7 +148,7 @@ public class CsipDeviceManager { log("onGroupIdChanged: removed from UI device =" + cachedDevice + ", with groupId=" + groupId + " firstMatchedIndex=" + firstMatchedIndex); mainDevice.setMemberDevice(cachedDevice); mainDevice.addMemberDevice(cachedDevice); mCachedDevices.remove(i); mBtManager.getEventManager().dispatchDeviceRemoved(cachedDevice); break; Loading packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceManagerTest.java +4 −5 Original line number Diff line number Diff line Loading @@ -40,7 +40,6 @@ import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import java.util.Collection; import java.util.HashMap; import java.util.Map; @RunWith(RobolectricTestRunner.class) Loading Loading @@ -503,8 +502,8 @@ public class CachedBluetoothDeviceManagerTest { CachedBluetoothDevice cachedDevice1 = mCachedDeviceManager.addDevice(mDevice1); CachedBluetoothDevice cachedDevice2 = mCachedDeviceManager.addDevice(mDevice2); CachedBluetoothDevice cachedDevice3 = mCachedDeviceManager.addDevice(mDevice3); cachedDevice1.setMemberDevice(cachedDevice2); cachedDevice1.setMemberDevice(cachedDevice3); cachedDevice1.addMemberDevice(cachedDevice2); cachedDevice1.addMemberDevice(cachedDevice3); assertThat(cachedDevice1.getMemberDevice()).contains(cachedDevice2); assertThat(cachedDevice1.getMemberDevice()).contains(cachedDevice3); Loading @@ -524,7 +523,7 @@ public class CachedBluetoothDeviceManagerTest { CachedBluetoothDevice cachedDevice2 = mCachedDeviceManager.addDevice(mDevice2); cachedDevice1.setGroupId(1); cachedDevice2.setGroupId(1); cachedDevice1.setMemberDevice(cachedDevice2); cachedDevice1.addMemberDevice(cachedDevice2); // Call onDeviceUnpaired for the one in mCachedDevices. mCachedDeviceManager.onDeviceUnpaired(cachedDevice1); Loading @@ -541,7 +540,7 @@ public class CachedBluetoothDeviceManagerTest { CachedBluetoothDevice cachedDevice2 = mCachedDeviceManager.addDevice(mDevice2); cachedDevice1.setGroupId(1); cachedDevice2.setGroupId(1); cachedDevice1.setMemberDevice(cachedDevice2); cachedDevice1.addMemberDevice(cachedDevice2); // Call onDeviceUnpaired for the one in mCachedDevices. mCachedDeviceManager.onDeviceUnpaired(cachedDevice2); Loading Loading
packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +11 −11 Original line number Diff line number Diff line Loading @@ -1351,7 +1351,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> /** * Store the member devices that are in the same coordinated set. */ public void setMemberDevice(CachedBluetoothDevice memberDevice) { public void addMemberDevice(CachedBluetoothDevice memberDevice) { mMemberDevices.add(memberDevice); } Loading @@ -1368,24 +1368,24 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> * device and member devices. * * @param prevMainDevice the previous Main device, it will be added into the member device set. * @param newMainDevie the new Main device, it will be removed from the member device set. * @param newMainDevice the new Main device, it will be removed from the member device set. */ public void switchMemberDeviceContent(CachedBluetoothDevice prevMainDevice, CachedBluetoothDevice newMainDevie) { CachedBluetoothDevice newMainDevice) { // Backup from main device final BluetoothDevice tmpDevice = mDevice; final short tmpRssi = mRssi; final boolean tmpJustDiscovered = mJustDiscovered; // Set main device from sub device mDevice = newMainDevie.mDevice; mRssi = newMainDevie.mRssi; mJustDiscovered = newMainDevie.mJustDiscovered; setMemberDevice(prevMainDevice); mMemberDevices.remove(newMainDevie); mDevice = newMainDevice.mDevice; mRssi = newMainDevice.mRssi; mJustDiscovered = newMainDevice.mJustDiscovered; addMemberDevice(prevMainDevice); mMemberDevices.remove(newMainDevice); // Set sub device from backup newMainDevie.mDevice = tmpDevice; newMainDevie.mRssi = tmpRssi; newMainDevie.mJustDiscovered = tmpJustDiscovered; newMainDevice.mDevice = tmpDevice; newMainDevice.mRssi = tmpRssi; newMainDevice.mJustDiscovered = tmpJustDiscovered; fetchActiveDevices(); } Loading
packages/SettingsLib/src/com/android/settingslib/bluetooth/CsipDeviceManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -85,7 +85,7 @@ public class CsipDeviceManager { // Once there is other devices with the same groupId, to add new device as member // devices. if (CsipDevice != null) { CsipDevice.setMemberDevice(newDevice); CsipDevice.addMemberDevice(newDevice); newDevice.setName(CsipDevice.getName()); return true; } Loading Loading @@ -148,7 +148,7 @@ public class CsipDeviceManager { log("onGroupIdChanged: removed from UI device =" + cachedDevice + ", with groupId=" + groupId + " firstMatchedIndex=" + firstMatchedIndex); mainDevice.setMemberDevice(cachedDevice); mainDevice.addMemberDevice(cachedDevice); mCachedDevices.remove(i); mBtManager.getEventManager().dispatchDeviceRemoved(cachedDevice); break; Loading
packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceManagerTest.java +4 −5 Original line number Diff line number Diff line Loading @@ -40,7 +40,6 @@ import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import java.util.Collection; import java.util.HashMap; import java.util.Map; @RunWith(RobolectricTestRunner.class) Loading Loading @@ -503,8 +502,8 @@ public class CachedBluetoothDeviceManagerTest { CachedBluetoothDevice cachedDevice1 = mCachedDeviceManager.addDevice(mDevice1); CachedBluetoothDevice cachedDevice2 = mCachedDeviceManager.addDevice(mDevice2); CachedBluetoothDevice cachedDevice3 = mCachedDeviceManager.addDevice(mDevice3); cachedDevice1.setMemberDevice(cachedDevice2); cachedDevice1.setMemberDevice(cachedDevice3); cachedDevice1.addMemberDevice(cachedDevice2); cachedDevice1.addMemberDevice(cachedDevice3); assertThat(cachedDevice1.getMemberDevice()).contains(cachedDevice2); assertThat(cachedDevice1.getMemberDevice()).contains(cachedDevice3); Loading @@ -524,7 +523,7 @@ public class CachedBluetoothDeviceManagerTest { CachedBluetoothDevice cachedDevice2 = mCachedDeviceManager.addDevice(mDevice2); cachedDevice1.setGroupId(1); cachedDevice2.setGroupId(1); cachedDevice1.setMemberDevice(cachedDevice2); cachedDevice1.addMemberDevice(cachedDevice2); // Call onDeviceUnpaired for the one in mCachedDevices. mCachedDeviceManager.onDeviceUnpaired(cachedDevice1); Loading @@ -541,7 +540,7 @@ public class CachedBluetoothDeviceManagerTest { CachedBluetoothDevice cachedDevice2 = mCachedDeviceManager.addDevice(mDevice2); cachedDevice1.setGroupId(1); cachedDevice2.setGroupId(1); cachedDevice1.setMemberDevice(cachedDevice2); cachedDevice1.addMemberDevice(cachedDevice2); // Call onDeviceUnpaired for the one in mCachedDevices. mCachedDeviceManager.onDeviceUnpaired(cachedDevice2); Loading