New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 707039 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug

Blocking:
issue 707630



Sign in to add a comment

Bluetooth: BlueZ caches service data even after the device stops advertising

Project Member Reported by xiaoyinh@chromium.org, Mar 30 2017

Issue description

Currently BlueZ caches all previously-found service data
and UUIDs, and the cached values should be cleared when a device stops advertising.
 

Comment 1 by ortuno@chromium.org, Mar 30 2017

Blocking: 580406
Status: Available (was: Untriaged)
fwiw, we discussed this issue with puthik when he was working on Arc++. This caching policy applies to many attributes in advertisements e.g. UUIDs, name, etc. and BlueZ is the only API that does this. We figured the best solution was to follow all other APIs[1][2][3] more closely and introduce a ScanResult property which is changed for each advertisement. This property would contain the RSSI and the raw bytes of the advertisement. This would avoid having to send a new Property Changed signal for all the properties that BlueZ caches but also allow us to control how we want to expose each advertisement. On the downside we would have to parse the data but at least we can be sure it will be thoroughly tested and we can even fuzz it. Ideally this could be done upstream since we need to support Linux as well.

[1] https://developer.android.com/reference/android/bluetooth/le/ScanCallback.html#onScanResult(int, android.bluetooth.le.ScanResult)
[2] https://developer.apple.com/reference/corebluetooth/cbcentralmanagerdelegate/1518937-centralmanager?language=objc
[3] https://docs.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.advertisement.bluetoothleadvertisementwatcher
Blocking: -580406
Blocking: 707630

Comment 4 by r...@chromium.org, Apr 10 2017

Cc: sonnysasaka@chromium.org
Owner: r...@chromium.org
Status: Assigned (was: Available)
Assigning to myself so it doesn't get lost in the churn.

We could perhaps stop caching advertisement data for non-connectable but these devices are not supposed to be persisted once the scan is stopped so I don't know if this is really a problem or you are talking about connectable devices, in that case the advertisement data can be related to GATT services or other profiles that may use the advertisement data as a discovery procedure.

Comment 6 by ortuno@chromium.org, Apr 12 2017

Re #5, stop caching for non-connectable devices would be an improvement but is not enough for us. Both Arc++ (i.e. Android) and Web Bluetooth Scanning require us to provide per scan result info for all devices, connectable and non-connectable.

For example, imagine a beacon that is alternating between two different advertisement packets: one with Service Data for 0xFF00 and one with Service Data for 0xFF01. Android (and thus Arc++) require us to dispatch a OnScanResult[1] event for each of these advertisement packets with information only about that adv. packet i.e. if the last received packet has Service Data for 0xFF00 we should dispatch the event only with that data.

[1] https://developer.android.com/reference/android/bluetooth/le/ScanCallback.html#onScanResult(int, android.bluetooth.le.ScanResult)
My understanding is that these APIs are to do things that are not really meant to be done with advertisements for 2 important reasons:

1. It is unreliable because there is no guarantee that no Advertisement will be missed as we can't do full duty cycle scanning.

2. There will be a much better solution that is:  https://www.bluetooth.com/search-results?q=mesh&fq= (actually this one might kill raw advertisement APIs completely since they would compete for advertisement time)


Comment 8 by ortuno@chromium.org, Apr 17 2017

I don't think 1. is that big of a problem. No API, including Android's makes that guarantee. 

Even if 2. is a better solution we still need to support Android's APIs.

Comment 9 by ortuno@chromium.org, Jul 31 2017

From vudentz:

there is now an option to see each advertisment data, just use ResetData filter, though the kernel will still set the duplicated filtering but bluetoothd won't prevent duplicated service and manufacturer data like it is currently.
Cc: -scheib@chromium.org

Comment 11 by rkc@google.com, Jan 17 (6 days ago)

Owner: jhawkins@chromium.org
James now owns connectivity in Chrome OS UI, over to him.

Sign in to add a comment