summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Angela Wang <angelala@google.com> 2023-08-15 03:10:58 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-08-15 03:10:58 +0000
commitb30815d38a8c9a138e5be678301a843c8c56696c (patch)
treed0c6ab3e0ba81dd3b0c190e3007d403dc1b1e6a4
parent5f4948028825952235d9d2311e674d9bbb6af3fc (diff)
parentf5a03d91d60469637f7a65a22b0b1cc0f71ea986 (diff)
Merge "Ignore ASHA hisyncId grouping if the device supports CSIP" into udc-qpr-dev
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java10
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/bluetooth/HearingAidDeviceManager.java8
2 files changed, 17 insertions, 1 deletions
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
index 2118d2cbf4b3..f03ff00828a6 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
@@ -1518,10 +1518,15 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
* list.
*/
public void switchMemberDeviceContent(CachedBluetoothDevice newMainDevice) {
- // Backup from main device
+ // Remove the sub device from mMemberDevices first to prevent hash mismatch problem due
+ // to mDevice switch
+ removeMemberDevice(newMainDevice);
+
+ // Backup from current main device
final BluetoothDevice tmpDevice = mDevice;
final short tmpRssi = mRssi;
final boolean tmpJustDiscovered = mJustDiscovered;
+
// Set main device from sub device
release();
mDevice = newMainDevice.mDevice;
@@ -1535,6 +1540,9 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
newMainDevice.mRssi = tmpRssi;
newMainDevice.mJustDiscovered = tmpJustDiscovered;
newMainDevice.fillData();
+
+ // Add the sub device back into mMemberDevices with correct hash
+ addMemberDevice(newMainDevice);
}
/**
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/HearingAidDeviceManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/HearingAidDeviceManager.java
index efba953e3c6b..111a2c1a07ea 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/HearingAidDeviceManager.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/HearingAidDeviceManager.java
@@ -186,6 +186,14 @@ public class HearingAidDeviceManager {
if (cachedDevice.getHiSyncId() != hiSyncId) {
continue;
}
+
+ // The remote device supports CSIP, the other ear should be processed as a member
+ // device. Ignore hiSyncId grouping from ASHA here.
+ if (cachedDevice.getProfiles().stream().anyMatch(
+ profile -> profile instanceof CsipSetCoordinatorProfile)) {
+ continue;
+ }
+
if (firstMatchedIndex == -1) {
// Found the first one
firstMatchedIndex = i;