Loading packages/SettingsLib/src/com/android/settingslib/bluetooth/CsipDeviceManager.java +4 −1 Original line number Diff line number Diff line Loading @@ -431,10 +431,13 @@ public class CsipDeviceManager { for (BluetoothDevice device : sinksToSync) { log("addMemberDevicesIntoMainDevice: sync audio sharing source to " + device.getAnonymizedAddress()); if (assistant.getConnectionStatus(device) == BluetoothProfile.STATE_CONNECTED) { assistant.addSource(device, metadata, /* isGroupOp= */ false); } } } } } else { log("addMemberDevicesIntoMainDevice: skip sync source, flag disabled"); } Loading packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/CsipDeviceManagerTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -377,6 +377,7 @@ public class CsipDeviceManagerTest { BluetoothLeBroadcastReceiveState.class); when(state.getBisSyncState()).thenReturn(ImmutableList.of(1L)); when(mAssistant.getAllSources(mDevice2)).thenReturn(ImmutableList.of(state)); when(mAssistant.getConnectionStatus(mDevice1)).thenReturn(BluetoothAdapter.STATE_CONNECTED); when(mContext.getSystemService(UserManager.class)).thenReturn(mUserManager); when(mUserManager.isManagedProfile()).thenReturn(true); Loading Loading @@ -407,6 +408,7 @@ public class CsipDeviceManagerTest { BluetoothLeBroadcastReceiveState.class); when(state.getBisSyncState()).thenReturn(ImmutableList.of(1L)); when(mAssistant.getAllSources(mDevice2)).thenReturn(ImmutableList.of(state)); when(mAssistant.getConnectionStatus(mDevice1)).thenReturn(BluetoothAdapter.STATE_CONNECTED); assertThat(mCsipDeviceManager.addMemberDevicesIntoMainDevice(GROUP1, preferredDevice)) .isTrue(); Loading Loading @@ -474,6 +476,8 @@ public class CsipDeviceManagerTest { BluetoothLeBroadcastReceiveState.class); when(state.getBisSyncState()).thenReturn(ImmutableList.of(1L)); when(mAssistant.getAllSources(mDevice1)).thenReturn(ImmutableList.of(state)); when(mAssistant.getConnectionStatus(mDevice2)).thenReturn(BluetoothAdapter.STATE_CONNECTED); when(mAssistant.getConnectionStatus(mDevice3)).thenReturn(BluetoothAdapter.STATE_CONNECTED); assertThat(mCsipDeviceManager.addMemberDevicesIntoMainDevice(GROUP1, preferredDevice)) .isTrue(); Loading Loading
packages/SettingsLib/src/com/android/settingslib/bluetooth/CsipDeviceManager.java +4 −1 Original line number Diff line number Diff line Loading @@ -431,10 +431,13 @@ public class CsipDeviceManager { for (BluetoothDevice device : sinksToSync) { log("addMemberDevicesIntoMainDevice: sync audio sharing source to " + device.getAnonymizedAddress()); if (assistant.getConnectionStatus(device) == BluetoothProfile.STATE_CONNECTED) { assistant.addSource(device, metadata, /* isGroupOp= */ false); } } } } } else { log("addMemberDevicesIntoMainDevice: skip sync source, flag disabled"); } Loading
packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/CsipDeviceManagerTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -377,6 +377,7 @@ public class CsipDeviceManagerTest { BluetoothLeBroadcastReceiveState.class); when(state.getBisSyncState()).thenReturn(ImmutableList.of(1L)); when(mAssistant.getAllSources(mDevice2)).thenReturn(ImmutableList.of(state)); when(mAssistant.getConnectionStatus(mDevice1)).thenReturn(BluetoothAdapter.STATE_CONNECTED); when(mContext.getSystemService(UserManager.class)).thenReturn(mUserManager); when(mUserManager.isManagedProfile()).thenReturn(true); Loading Loading @@ -407,6 +408,7 @@ public class CsipDeviceManagerTest { BluetoothLeBroadcastReceiveState.class); when(state.getBisSyncState()).thenReturn(ImmutableList.of(1L)); when(mAssistant.getAllSources(mDevice2)).thenReturn(ImmutableList.of(state)); when(mAssistant.getConnectionStatus(mDevice1)).thenReturn(BluetoothAdapter.STATE_CONNECTED); assertThat(mCsipDeviceManager.addMemberDevicesIntoMainDevice(GROUP1, preferredDevice)) .isTrue(); Loading Loading @@ -474,6 +476,8 @@ public class CsipDeviceManagerTest { BluetoothLeBroadcastReceiveState.class); when(state.getBisSyncState()).thenReturn(ImmutableList.of(1L)); when(mAssistant.getAllSources(mDevice1)).thenReturn(ImmutableList.of(state)); when(mAssistant.getConnectionStatus(mDevice2)).thenReturn(BluetoothAdapter.STATE_CONNECTED); when(mAssistant.getConnectionStatus(mDevice3)).thenReturn(BluetoothAdapter.STATE_CONNECTED); assertThat(mCsipDeviceManager.addMemberDevicesIntoMainDevice(GROUP1, preferredDevice)) .isTrue(); Loading