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
This commit is contained in:
Angela Wang
2022-11-15 06:43:00 +00:00
parent 19ef1c3a10
commit b55bf39e24

View File

@@ -361,10 +361,28 @@ public class LocalBluetoothProfileManager {
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);
}
}
if (getCsipSetCoordinatorProfile() != null
&& mProfile instanceof CsipSetCoordinatorProfile
&& newState == BluetoothProfile.STATE_CONNECTED) {