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

Commit ced95503 authored by Yiyi Shen's avatar Yiyi Shen
Browse files

Add some debugging logs for CSIP logic

Flag: EXEMPT add logging
Test: compile
Bug: 375358149
Change-Id: I945d9611fbbf8313322db79397d94fd822d188ea
parent 9c77f4eb
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -134,6 +134,8 @@ public class CsipDeviceManager {
            // Do nothing if GroupId has been assigned
            // Do nothing if GroupId has been assigned
            if (!isValidGroupId(cachedDevice.getGroupId())) {
            if (!isValidGroupId(cachedDevice.getGroupId())) {
                final int newGroupId = getBaseGroupId(cachedDevice.getDevice());
                final int newGroupId = getBaseGroupId(cachedDevice.getDevice());
                log("updateCsipDevices: propose new group id " + newGroupId + " for device "
                        + cachedDevice.getDevice());
                // Do nothing if there is no GroupId on Bluetooth device
                // Do nothing if there is no GroupId on Bluetooth device
                if (isValidGroupId(newGroupId)) {
                if (isValidGroupId(newGroupId)) {
                    cachedDevice.setGroupId(newGroupId);
                    cachedDevice.setGroupId(newGroupId);
+15 −1
Original line number Original line Diff line number Diff line
@@ -358,6 +358,9 @@ public class LocalBluetoothProfileManager {
                    && mProfile instanceof CsipSetCoordinatorProfile;
                    && mProfile instanceof CsipSetCoordinatorProfile;


            if (isAshaProfile && (newState == BluetoothProfile.STATE_CONNECTED)) {
            if (isAshaProfile && (newState == BluetoothProfile.STATE_CONNECTED)) {
                if (DEBUG) {
                    Log.d(TAG, "onReceive, hearing aid profile connected, check hisyncid");
                }
                // Check if the HiSyncID has being initialized
                // Check if the HiSyncID has being initialized
                if (cachedDevice.getHiSyncId() == BluetoothHearingAid.HI_SYNC_ID_INVALID) {
                if (cachedDevice.getHiSyncId() == BluetoothHearingAid.HI_SYNC_ID_INVALID) {
                    long newHiSyncId = getHearingAidProfile().getHiSyncId(cachedDevice.getDevice());
                    long newHiSyncId = getHearingAidProfile().getHiSyncId(cachedDevice.getDevice());
@@ -375,7 +378,9 @@ public class LocalBluetoothProfileManager {
            }
            }


            if (isHapClientOrLeAudioProfile && newState == BluetoothProfile.STATE_CONNECTED) {
            if (isHapClientOrLeAudioProfile && newState == BluetoothProfile.STATE_CONNECTED) {

                if (DEBUG) {
                    Log.d(TAG, "onReceive, hap/lea profile connected, check hearing aid info");
                }
                // Checks if both profiles are connected to the device. Hearing aid info need
                // Checks if both profiles are connected to the device. Hearing aid info need
                // to be retrieved from these profiles separately.
                // to be retrieved from these profiles separately.
                if (cachedDevice.isConnectedLeAudioHearingAidDevice()) {
                if (cachedDevice.isConnectedLeAudioHearingAidDevice()) {
@@ -389,10 +394,16 @@ public class LocalBluetoothProfileManager {
            }
            }


            if (isCsipProfile && (newState == BluetoothProfile.STATE_CONNECTED)) {
            if (isCsipProfile && (newState == BluetoothProfile.STATE_CONNECTED)) {
                if (DEBUG) {
                    Log.d(TAG, "onReceive, csip profile connected, check group id");
                }
                // Check if the GroupID has being initialized
                // Check if the GroupID has being initialized
                if (cachedDevice.getGroupId() == BluetoothCsipSetCoordinator.GROUP_ID_INVALID) {
                if (cachedDevice.getGroupId() == BluetoothCsipSetCoordinator.GROUP_ID_INVALID) {
                    final Map<Integer, ParcelUuid> groupIdMap = getCsipSetCoordinatorProfile()
                    final Map<Integer, ParcelUuid> groupIdMap = getCsipSetCoordinatorProfile()
                            .getGroupUuidMapByDevice(cachedDevice.getDevice());
                            .getGroupUuidMapByDevice(cachedDevice.getDevice());
                    if (DEBUG) {
                        Log.d(TAG, "csip group uuid map = " + groupIdMap);
                    }
                    if (groupIdMap != null) {
                    if (groupIdMap != null) {
                        for (Map.Entry<Integer, ParcelUuid> entry: groupIdMap.entrySet()) {
                        for (Map.Entry<Integer, ParcelUuid> entry: groupIdMap.entrySet()) {
                            if (entry.getValue().equals(BluetoothUuid.CAP)) {
                            if (entry.getValue().equals(BluetoothUuid.CAP)) {
@@ -431,6 +442,9 @@ public class LocalBluetoothProfileManager {
                        mProfile.getProfileId());
                        mProfile.getProfileId());
            }
            }
            if (needDispatchProfileConnectionState) {
            if (needDispatchProfileConnectionState) {
                if (DEBUG) {
                    Log.d(TAG, "needDispatchProfileConnectionState");
                }
                cachedDevice.refresh();
                cachedDevice.refresh();
                mEventManager.dispatchProfileConnectionStateChanged(cachedDevice, newState,
                mEventManager.dispatchProfileConnectionStateChanged(cachedDevice, newState,
                        mProfile.getProfileId());
                        mProfile.getProfileId());