From 0928b5d16e45527386a46cd658c8bc9762985218 Mon Sep 17 00:00:00 2001 From: SongFerngWang Date: Thu, 8 Sep 2022 17:49:58 +0800 Subject: [PATCH] Add more log for analysis Bug: 245657079 Test: NA. It is log only. Change-Id: If2c88cff803a8c09e6d44eda87abd127862de5a4 --- .../settingslib/bluetooth/CachedBluetoothDevice.java | 1 + .../settingslib/bluetooth/CachedBluetoothDeviceManager.java | 6 +++++- .../android/settingslib/bluetooth/CsipDeviceManager.java | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java index 3ca94dba027ee..a5f3df9f628d3 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java @@ -398,6 +398,7 @@ public class CachedBluetoothDevice implements Comparable * @param id the group id from the CSIP. */ public void setGroupId(int id) { + Log.d(TAG, this.getDevice().getAnonymizedAddress() + " set GroupId " + id); mGroupId = id; } diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceManager.java index 26a2080264118..5662ce6bd8084 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceManager.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceManager.java @@ -357,8 +357,12 @@ public class CachedBluetoothDeviceManager { * {@code false}. */ public synchronized boolean shouldPairByCsip(BluetoothDevice device, int groupId) { - if (mOngoingSetMemberPair != null || device.getBondState() != BluetoothDevice.BOND_NONE + boolean isOngoingSetMemberPair = mOngoingSetMemberPair != null; + int bondState = device.getBondState(); + if (isOngoingSetMemberPair || bondState != BluetoothDevice.BOND_NONE || !mCsipDeviceManager.isExistedGroupId(groupId)) { + Log.d(TAG, "isOngoingSetMemberPair: " + isOngoingSetMemberPair + + " , device.getBondState: " + bondState); return false; } diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CsipDeviceManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CsipDeviceManager.java index 9b38238ca8b8e..d5de3f0525a09 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CsipDeviceManager.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CsipDeviceManager.java @@ -102,9 +102,12 @@ public class CsipDeviceManager { } private CachedBluetoothDevice getCachedDevice(int groupId) { + log("getCachedDevice: groupId: " + groupId); for (int i = mCachedDevices.size() - 1; i >= 0; i--) { CachedBluetoothDevice cachedDevice = mCachedDevices.get(i); if (cachedDevice.getGroupId() == groupId) { + log("getCachedDevice: found cachedDevice with the groupId: " + + cachedDevice.getDevice().getAnonymizedAddress()); return cachedDevice; } }