From d936b5bc7a1588a0f62d7362356ab7c1d16af590 Mon Sep 17 00:00:00 2001 From: SongFerngWang Date: Mon, 7 Mar 2022 15:19:09 +0800 Subject: [PATCH] [LE] Connect and disconnect both LE headsets Disconnect the LE headset from settings page, only one side(L or R) is disconnected. Bug: 206049683 Test: build pass Change-Id: I8c9c808b830947ab8d8510042827e55f85faa781 --- .../settingslib/bluetooth/CachedBluetoothDevice.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java index 233e798c8578f..52bbac7cbb054 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java @@ -282,6 +282,12 @@ public class CachedBluetoothDevice implements Comparable public void disconnect() { synchronized (mProfileLock) { + if (getGroupId() != BluetoothCsipSetCoordinator.GROUP_ID_INVALID) { + for (CachedBluetoothDevice member : getMemberDevice()) { + Log.d(TAG, "Disconnect the member(" + member.getAddress() + ")"); + member.disconnect(); + } + } mDevice.disconnect(); } // Disconnect PBAP server in case its connected @@ -396,6 +402,12 @@ public class CachedBluetoothDevice implements Comparable } mDevice.connect(); + if (getGroupId() != BluetoothCsipSetCoordinator.GROUP_ID_INVALID) { + for (CachedBluetoothDevice member : getMemberDevice()) { + Log.d(TAG, "connect the member(" + member.getAddress() + ")"); + member.connect(); + } + } } }