Merge "Rename CachedBluetoothDevice.setMemberDevice to addMemberDevice" into tm-dev am: 24f7beacfa
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18157297 Change-Id: Ia46c0b634a035da18b46e57379c3545897bc01f3 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -1376,7 +1376,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);
|
||||
}
|
||||
|
||||
@@ -1393,24 +1393,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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user