OSDN Git Service

BLE: Updating the WL if addr_type is not matched for same BDaddr
authorJanardhana Rao Bokka <quic_jbokka@quicinc.com>
Tue, 10 Sep 2019 04:31:16 +0000 (10:01 +0530)
committerJakub Pawlowski <jpawlowski@google.com>
Wed, 11 Sep 2019 06:33:36 +0000 (08:33 +0200)
commit592db8461c96c8b06d1b791f32e0dc8ef0fc1dda
tree7887e1c7e6c833cf3c44f13bdcb890549f692b85
parent7080584a1b69931dc069bf17a5942d66285d409c
BLE: Updating the WL if addr_type is not matched for same BDaddr

Issue:
Connection is not happening with same remote device after BT
reset.

Steps to Repro:
1. Scan and connect to remote device with "Random" address
2. Toggle BT OFF and ON
3. Without scanning, App tries to connect to remote device and
device gets added as default "Public" addr_type in WL
4. Connection doesn't go through (as expected) since remote device
has "Random" address
5. App cancels the attempt or 30 sec direct connection timeout
happens. The device is marked for removal
6. App scans for the device and the correct addr_type (Random)
is now in the inquiry database in stack
7. App initiates connection for the device but the connection
attempt still goes with "Public" address type and hence never
succeeds.

RootCause:
At step 5, stack just marks the device to be removed from whitelist
(pending_removal) but doesn't actually remove it from Controller
until the next WL connection is needed. Later in step 7, when the
WL connection is needed from the App, stack attempts to add the
device to the whitelist, but realizes that the device is already in
the Controller whitelist and hence doesn't do remove and add.
There is no check to see if the device in Controller's WL is with
correct addr_type.

Fix:
When checking for remote addr that needs to be added/removed
from WL, also take into the account the remote addr_type.

Test:
Tested with the fix multiple times. Issue not seen with this fix.

Bug: 140085561
Change-Id: I415b5fa29800b975c2ebcbf95b36cf8879841b3e
stack/btm/btm_ble_bgconn.cc