diff options
| author | 2022-11-15 06:43:00 +0000 | |
|---|---|---|
| committer | 2022-11-28 10:01:14 +0000 | |
| commit | b55bf39e2443fabefe4b56b44d466b8c03168445 (patch) | |
| tree | 410d09d5da764dea2070c2e08c54b34b306d7941 | |
| parent | 19ef1c3a101683f1dface57ed8cf0934ea7a1f94 (diff) | |
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
| -rw-r--r-- | packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java index efee34ca10dd..a3c2e70c7da4 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java @@ -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) { |