From: weichinweng Date: Wed, 3 Jul 2019 09:52:19 +0000 (+0800) Subject: Hearing Aid: set BLE phy to 2M if local and peer indicate PHY 2M support X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=554c3598db5661ac0166eb12006d248a38723db1;p=android-x86%2Fsystem-bt.git Hearing Aid: set BLE phy to 2M if local and peer indicate PHY 2M support Set the BLE phy to 2M if the BT controller and peer Hearing Aid device indicate phy 2M support, otherwise, use default phy channel. Bug: 135769508 Test: 1.Forget/Repair Hearing Aid device check whether phy is expected. 2.Disconnect/Reconnect Hearing Aid device check whether phy is expected. 3.HearingAid device power off/on, check whether phy is expected. Change-Id: Ib410a8885f3a68c361bb97d5c9a3833f2a1be528 --- diff --git a/bta/hearing_aid/hearing_aid.cc b/bta/hearing_aid/hearing_aid.cc index 187c0ab97..076792144 100644 --- a/bta/hearing_aid/hearing_aid.cc +++ b/bta/hearing_aid/hearing_aid.cc @@ -390,6 +390,13 @@ class HearingAidImpl : public HearingAid { hearingDevice->connection_update_status = AWAITING; } + tACL_CONN* p_acl = btm_bda_to_acl(address, BT_TRANSPORT_LE); + if (p_acl != nullptr && controller_get_interface()->supports_ble_2m_phy() && + HCI_LE_2M_PHY_SUPPORTED(p_acl->peer_le_features)) { + LOG(INFO) << address << " set preferred PHY to 2M"; + BTM_BleSetPhy(address, PHY_LE_2M, PHY_LE_2M, 0); + } + // Set data length // TODO(jpawlowski: for 16khz only 87 is required, optimize BTM_SetBleDataLength(address, 167);