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

Commit b55bf39e authored by Angela Wang's avatar Angela Wang
Browse files

Updates hearing aid related log for BLE hearing aids (1/2)

Retrives BLE hearing aid device type from
HapClientProfile#getHearingAidType() and audio location from
LeAudioProfile#getAudioLocation(). Sets these HearingAidInfo to
CachedBluetoothDevice when both profiles are connected.

Bug: 253192350
Test: m statsd_testdrive & statsd_testdrive 513
Change-Id: Ib50b2612903decf554f594335a56465fe4c47cfa
parent 19ef1c3a
Loading
Loading
Loading
Loading
+19 −1
Original line number Original line Diff line number Diff line
@@ -361,9 +361,27 @@ public class LocalBluetoothProfileManager {
                        cachedDevice.setHearingAidInfo(infoBuilder.build());
                        cachedDevice.setHearingAidInfo(infoBuilder.build());
                    }
                    }
                }
                }
                HearingAidStatsLogUtils.logHearingAidInfo(cachedDevice);
            }


            final boolean isHapClientProfile = getHapClientProfile() != null
                    && mProfile instanceof HapClientProfile;
            final boolean isLeAudioProfile = getLeAudioProfile() != null
                    && mProfile instanceof LeAudioProfile;
            final boolean isHapClientOrLeAudioProfile = isHapClientProfile || isLeAudioProfile;
            if (isHapClientOrLeAudioProfile && newState == BluetoothProfile.STATE_CONNECTED) {

                // Checks if both profiles are connected to the device. Hearing aid info need
                // to be retrieved from these profiles separately.
                if (cachedDevice.isConnectedLeAudioHearingAidDevice()) {
                    final BluetoothDevice device = cachedDevice.getDevice();
                    final HearingAidInfo.Builder infoBuilder = new HearingAidInfo.Builder()
                            .setLeAudioLocation(getLeAudioProfile().getAudioLocation(device))
                            .setHapDeviceType(getHapClientProfile().getHearingAidType(device));
                    cachedDevice.setHearingAidInfo(infoBuilder.build());
                    HearingAidStatsLogUtils.logHearingAidInfo(cachedDevice);
                    HearingAidStatsLogUtils.logHearingAidInfo(cachedDevice);
                }
                }
            }


            if (getCsipSetCoordinatorProfile() != null
            if (getCsipSetCoordinatorProfile() != null
                    && mProfile instanceof CsipSetCoordinatorProfile
                    && mProfile instanceof CsipSetCoordinatorProfile