In some cases, it will add the random address into the BG connection
after the HA device is connected via a random address. Then the
ble_bgconn will add the public address into the controller white list if
the random address has the public address. Finally, it will get a second
connection handle with the public address on the same HearingAid device.
The patch changes the behavior that when the HearingAid device
disconnects from the remote side, add the device into the BG connection.
Bug:
152517031
Test: 1.run unit test.
2.Forget/Repair HearingAid device from Bluetooth UI.
3.Disconnect/Reconnect HearingAid device from Bluetooth UI.
4.HearingAid device power off/on, check them can reconnect.
Change-Id: Id491faeaddaa32bbea0c88c7f0563d299f7f33f8
Merged-In: Id491faeaddaa32bbea0c88c7f0563d299f7f33f8
}
if (hearingDevice->first_connection) {
- /* add device into BG connection to accept remote initiated connection */
- BTA_GATTC_Open(gatt_if, address, false, GATT_TRANSPORT_LE, false);
-
btif_storage_add_hearing_aid(*hearingDevice);
hearingDevice->first_connection = false;
DoDisconnectCleanUp(hearingDevice);
- // Keep this hearing aid in the list, and allow to reconnect back.
+ // This is needed just for the first connection. After stack is restarted,
+ // code that loads device will add them to whitelist.
+ BTA_GATTC_Open(gatt_if, hearingDevice->address, false, GATT_TRANSPORT_LE,
+ false);
callbacks->OnConnectionState(ConnectionState::DISCONNECTED, remote_bda);