Loading system/bta/hearing_aid/hearing_aid.cc +19 −14 Original line number Diff line number Diff line Loading @@ -259,8 +259,11 @@ class HearingAidImpl : public HearingAid { uint8_t capabilities, uint16_t codecs, uint16_t audio_control_point_handle, uint16_t volume_handle, uint64_t hiSyncId, uint16_t render_delay, uint16_t preparation_delay) { DVLOG(2) << __func__ << " " << address << ", hiSyncId=" << loghex(hiSyncId); uint16_t render_delay, uint16_t preparation_delay, uint16_t is_white_listed) { DVLOG(2) << __func__ << " " << address << ", hiSyncId=" << loghex(hiSyncId) << ", isWhiteListed=" << is_white_listed; if (is_white_listed) { hearingDevices.Add(HearingDevice( address, psm, capabilities, codecs, audio_control_point_handle, volume_handle, hiSyncId, render_delay, preparation_delay)); Loading @@ -272,6 +275,7 @@ class HearingAidImpl : public HearingAid { /* add device into BG connection to accept remote initiated connection */ BTA_GATTC_Open(gatt_if, address, false, GATT_TRANSPORT_LE, false); BTA_DmBleStartAutoConn(); } callbacks->OnDeviceAvailable(capabilities, hiSyncId, address); } Loading Loading @@ -1125,14 +1129,15 @@ void HearingAid::AddFromStorage(const RawAddress& address, uint16_t psm, uint16_t audio_control_point_handle, uint16_t volume_handle, uint64_t hiSyncId, uint16_t render_delay, uint16_t preparation_delay) { uint16_t preparation_delay, uint16_t is_white_listed) { if (!instance) { LOG(ERROR) << "Not initialized yet"; } instance->AddFromStorage(address, psm, capabilities, codecs, audio_control_point_handle, volume_handle, hiSyncId, render_delay, preparation_delay); render_delay, preparation_delay, is_white_listed); }; void HearingAid::CleanUp() { Loading system/bta/include/bta_hearing_aid_api.h +2 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,8 @@ class HearingAid { uint8_t capabilities, uint16_t codec, uint16_t audioControlPointHandle, uint16_t volumeHandle, uint64_t hiSyncId, uint16_t render_delay, uint16_t preparation_delay); uint16_t render_delay, uint16_t preparation_delay, uint16_t is_white_listed); virtual void Connect(const RawAddress& address) = 0; virtual void Disconnect(const RawAddress& address) = 0; Loading system/btif/include/btif_storage.h +3 −0 Original line number Diff line number Diff line Loading @@ -201,6 +201,9 @@ void btif_storage_load_bonded_hearing_aids(); /** Deletes the bonded hearing aid device info from NVRAM */ void btif_storage_remove_hearing_aid(const RawAddress& address); /** Remove the hearing aid device from white list */ void btif_storage_remove_hearing_aid_white_list(const RawAddress& address); /******************************************************************************* * * Function btif_storage_is_retricted_device Loading system/btif/src/btif_hearing_aid.cc +2 −2 Original line number Diff line number Diff line Loading @@ -91,8 +91,8 @@ class HearingAidInterfaceImpl DVLOG(2) << __func__ << " address: " << address; do_in_bta_thread(FROM_HERE, Bind(&HearingAid::Disconnect, Unretained(HearingAid::Get()), address)); do_in_jni_thread(FROM_HERE, Bind(&btif_storage_remove_hearing_aid, address)); do_in_jni_thread( FROM_HERE, Bind(&btif_storage_remove_hearing_aid_white_list, address)); } void SetVolume(int8_t volume) override { Loading system/btif/src/btif_storage.cc +18 −3 Original line number Diff line number Diff line Loading @@ -1364,6 +1364,7 @@ constexpr char HEARING_AID_VOLUME_HANDLE[] = "HearingAidVolumeHandle"; constexpr char HEARING_AID_SYNC_ID[] = "HearingAidSyncId"; constexpr char HEARING_AID_RENDER_DELAY[] = "HearingAidRenderDelay"; constexpr char HEARING_AID_PREPARATION_DELAY[] = "HearingAidPreparationDelay"; constexpr char HEARING_AID_IS_WHITE_LISTED[] = "HearingAidIsWhiteListed"; void btif_storage_add_hearing_aid(const RawAddress& address, uint16_t psm, uint8_t capabilities, uint16_t codecs, Loading Loading @@ -1391,6 +1392,7 @@ void btif_storage_add_hearing_aid(const RawAddress& address, uint16_t psm, btif_config_set_int(bdstr, HEARING_AID_RENDER_DELAY, render_delay); btif_config_set_int(bdstr, HEARING_AID_PREPARATION_DELAY, preparation_delay); btif_config_set_int(bdstr, HEARING_AID_IS_WHITE_LISTED, true); btif_config_save(); }, address, psm, capabilities, codecs, audio_control_point_handle, Loading Loading @@ -1446,13 +1448,18 @@ void btif_storage_load_bonded_hearing_aids() { if (btif_config_get_int(name, HEARING_AID_PREPARATION_DELAY, &value)) preparation_delay = value; uint16_t is_white_listed = 0; if (btif_config_get_int(name, HEARING_AID_IS_WHITE_LISTED, &value)) is_white_listed = value; RawAddress bd_addr; RawAddress::FromString(name, bd_addr); // add extracted information to BTA Hearing Aid do_in_bta_thread( FROM_HERE, Bind(&HearingAid::AddFromStorage, bd_addr, psm, capabilities, codecs, audio_control_point_handle, volume_handle, hi_sync_id, render_delay, preparation_delay)); FROM_HERE, Bind(&HearingAid::AddFromStorage, bd_addr, psm, capabilities, codecs, audio_control_point_handle, volume_handle, hi_sync_id, render_delay, preparation_delay, is_white_listed)); } } Loading @@ -1466,9 +1473,17 @@ void btif_storage_remove_hearing_aid(const RawAddress& address) { btif_config_remove(addrstr, HEARING_AID_AUDIO_CONTROL_POINT); btif_config_remove(addrstr, HEARING_AID_VOLUME_HANDLE); btif_config_remove(addrstr, HEARING_AID_SYNC_ID); btif_config_remove(addrstr, HEARING_AID_IS_WHITE_LISTED); btif_config_save(); } /** Remove the hearing aid device from white list */ void btif_storage_remove_hearing_aid_white_list(const RawAddress& address) { std::string addrstr = address.ToString(); btif_config_set_int(addrstr, HEARING_AID_IS_WHITE_LISTED, false); } /******************************************************************************* * * Function btif_storage_is_restricted_device Loading Loading
system/bta/hearing_aid/hearing_aid.cc +19 −14 Original line number Diff line number Diff line Loading @@ -259,8 +259,11 @@ class HearingAidImpl : public HearingAid { uint8_t capabilities, uint16_t codecs, uint16_t audio_control_point_handle, uint16_t volume_handle, uint64_t hiSyncId, uint16_t render_delay, uint16_t preparation_delay) { DVLOG(2) << __func__ << " " << address << ", hiSyncId=" << loghex(hiSyncId); uint16_t render_delay, uint16_t preparation_delay, uint16_t is_white_listed) { DVLOG(2) << __func__ << " " << address << ", hiSyncId=" << loghex(hiSyncId) << ", isWhiteListed=" << is_white_listed; if (is_white_listed) { hearingDevices.Add(HearingDevice( address, psm, capabilities, codecs, audio_control_point_handle, volume_handle, hiSyncId, render_delay, preparation_delay)); Loading @@ -272,6 +275,7 @@ class HearingAidImpl : public HearingAid { /* add device into BG connection to accept remote initiated connection */ BTA_GATTC_Open(gatt_if, address, false, GATT_TRANSPORT_LE, false); BTA_DmBleStartAutoConn(); } callbacks->OnDeviceAvailable(capabilities, hiSyncId, address); } Loading Loading @@ -1125,14 +1129,15 @@ void HearingAid::AddFromStorage(const RawAddress& address, uint16_t psm, uint16_t audio_control_point_handle, uint16_t volume_handle, uint64_t hiSyncId, uint16_t render_delay, uint16_t preparation_delay) { uint16_t preparation_delay, uint16_t is_white_listed) { if (!instance) { LOG(ERROR) << "Not initialized yet"; } instance->AddFromStorage(address, psm, capabilities, codecs, audio_control_point_handle, volume_handle, hiSyncId, render_delay, preparation_delay); render_delay, preparation_delay, is_white_listed); }; void HearingAid::CleanUp() { Loading
system/bta/include/bta_hearing_aid_api.h +2 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,8 @@ class HearingAid { uint8_t capabilities, uint16_t codec, uint16_t audioControlPointHandle, uint16_t volumeHandle, uint64_t hiSyncId, uint16_t render_delay, uint16_t preparation_delay); uint16_t render_delay, uint16_t preparation_delay, uint16_t is_white_listed); virtual void Connect(const RawAddress& address) = 0; virtual void Disconnect(const RawAddress& address) = 0; Loading
system/btif/include/btif_storage.h +3 −0 Original line number Diff line number Diff line Loading @@ -201,6 +201,9 @@ void btif_storage_load_bonded_hearing_aids(); /** Deletes the bonded hearing aid device info from NVRAM */ void btif_storage_remove_hearing_aid(const RawAddress& address); /** Remove the hearing aid device from white list */ void btif_storage_remove_hearing_aid_white_list(const RawAddress& address); /******************************************************************************* * * Function btif_storage_is_retricted_device Loading
system/btif/src/btif_hearing_aid.cc +2 −2 Original line number Diff line number Diff line Loading @@ -91,8 +91,8 @@ class HearingAidInterfaceImpl DVLOG(2) << __func__ << " address: " << address; do_in_bta_thread(FROM_HERE, Bind(&HearingAid::Disconnect, Unretained(HearingAid::Get()), address)); do_in_jni_thread(FROM_HERE, Bind(&btif_storage_remove_hearing_aid, address)); do_in_jni_thread( FROM_HERE, Bind(&btif_storage_remove_hearing_aid_white_list, address)); } void SetVolume(int8_t volume) override { Loading
system/btif/src/btif_storage.cc +18 −3 Original line number Diff line number Diff line Loading @@ -1364,6 +1364,7 @@ constexpr char HEARING_AID_VOLUME_HANDLE[] = "HearingAidVolumeHandle"; constexpr char HEARING_AID_SYNC_ID[] = "HearingAidSyncId"; constexpr char HEARING_AID_RENDER_DELAY[] = "HearingAidRenderDelay"; constexpr char HEARING_AID_PREPARATION_DELAY[] = "HearingAidPreparationDelay"; constexpr char HEARING_AID_IS_WHITE_LISTED[] = "HearingAidIsWhiteListed"; void btif_storage_add_hearing_aid(const RawAddress& address, uint16_t psm, uint8_t capabilities, uint16_t codecs, Loading Loading @@ -1391,6 +1392,7 @@ void btif_storage_add_hearing_aid(const RawAddress& address, uint16_t psm, btif_config_set_int(bdstr, HEARING_AID_RENDER_DELAY, render_delay); btif_config_set_int(bdstr, HEARING_AID_PREPARATION_DELAY, preparation_delay); btif_config_set_int(bdstr, HEARING_AID_IS_WHITE_LISTED, true); btif_config_save(); }, address, psm, capabilities, codecs, audio_control_point_handle, Loading Loading @@ -1446,13 +1448,18 @@ void btif_storage_load_bonded_hearing_aids() { if (btif_config_get_int(name, HEARING_AID_PREPARATION_DELAY, &value)) preparation_delay = value; uint16_t is_white_listed = 0; if (btif_config_get_int(name, HEARING_AID_IS_WHITE_LISTED, &value)) is_white_listed = value; RawAddress bd_addr; RawAddress::FromString(name, bd_addr); // add extracted information to BTA Hearing Aid do_in_bta_thread( FROM_HERE, Bind(&HearingAid::AddFromStorage, bd_addr, psm, capabilities, codecs, audio_control_point_handle, volume_handle, hi_sync_id, render_delay, preparation_delay)); FROM_HERE, Bind(&HearingAid::AddFromStorage, bd_addr, psm, capabilities, codecs, audio_control_point_handle, volume_handle, hi_sync_id, render_delay, preparation_delay, is_white_listed)); } } Loading @@ -1466,9 +1473,17 @@ void btif_storage_remove_hearing_aid(const RawAddress& address) { btif_config_remove(addrstr, HEARING_AID_AUDIO_CONTROL_POINT); btif_config_remove(addrstr, HEARING_AID_VOLUME_HANDLE); btif_config_remove(addrstr, HEARING_AID_SYNC_ID); btif_config_remove(addrstr, HEARING_AID_IS_WHITE_LISTED); btif_config_save(); } /** Remove the hearing aid device from white list */ void btif_storage_remove_hearing_aid_white_list(const RawAddress& address) { std::string addrstr = address.ToString(); btif_config_set_int(addrstr, HEARING_AID_IS_WHITE_LISTED, false); } /******************************************************************************* * * Function btif_storage_is_restricted_device Loading