Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 214032f1 authored by Angela Wang's avatar Angela Wang
Browse files

Ignore ASHA hisyncId grouping if the device supports CSIP

If a device is added as another device's sub device, it'll be removed
from the cached device list. This makes the device can't be correctly
grouped as a CSIP set when CSIP is connected.

We should ignore ASHA hisyncId grouping and leave it to be handled as a
member of CSIP set.

Flag: EXEMPT bugfix
Bug: 376022366
Test: atest HearingAidDeviceManagerTest
Test: manually check the issue is resolved with real device
Change-Id: I5897bcbd1915d03157743ba09e4092c6976736c3
parent 662f37ea
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -94,6 +94,14 @@ public class HearingAidDeviceManager {
    boolean setSubDeviceIfNeeded(CachedBluetoothDevice newDevice) {
        final long hiSyncId = newDevice.getHiSyncId();
        if (isValidHiSyncId(hiSyncId)) {
            // The remote device supports CSIP, the other ear should be processed as a member
            // device. Ignore hiSyncId grouping from ASHA here.
            if (newDevice.getProfiles().stream().anyMatch(
                    profile -> profile instanceof CsipSetCoordinatorProfile)) {
                Log.w(TAG, "Skip ASHA grouping since this device supports CSIP");
                return false;
            }

            final CachedBluetoothDevice hearingAidDevice = getCachedDevice(hiSyncId);
            // Just add one of the hearing aids from a pair in the list that is shown in the UI.
            // Once there is another device with the same hiSyncId, to add new device as sub
@@ -161,6 +169,7 @@ public class HearingAidDeviceManager {
            // device. Ignore hiSyncId grouping from ASHA here.
            if (cachedDevice.getProfiles().stream().anyMatch(
                    profile -> profile instanceof CsipSetCoordinatorProfile)) {
                Log.w(TAG, "Skip ASHA grouping since this device supports CSIP");
                continue;
            }