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

Issue 638715 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Sep 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug

Blocking:
issue 436283



Sign in to add a comment

bluetooth: Classic Bluetooth devices are constantly being added and removed.

Project Member Reported by ortuno@chromium.org, Aug 17 2016

Issue description

There is a bug in the way classic devices are being removed that causes BluetoothAdapter to constantly remove and add devices. It seems getLastInquiryUpdate is returning nil for classic devices which makes it look like the device should be remove because it expired but then AddPairedDevices is called and the device is added again.
 

Comment 1 by ortuno@chromium.org, Aug 17 2016

Cc: r...@chromium.org
+rkc since this affects chrome apps as well.

Comment 2 by st...@chromium.org, Aug 24 2016

Cc: st...@chromium.org

Comment 3 by st...@chromium.org, Aug 24 2016

Cc: -r...@chromium.org

Comment 4 by ortuno@chromium.org, Aug 30 2016

Cc: jlebel@chromium.org
 Issue 642456  has been merged into this issue.

Comment 5 by ortuno@chromium.org, Aug 30 2016

Owner: ortuno@chromium.org
Status: Started (was: Available)
Project Member

Comment 7 by bugdroid1@chromium.org, Sep 27 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/154da849a1f7106c4efb3b514d88eac45a39afaa

commit 154da849a1f7106c4efb3b514d88eac45a39afaa
Author: ortuno <ortuno@chromium.org>
Date: Tue Sep 27 01:27:23 2016

bluetooth: mac: Improve classic device discovery and update

There are a couple of problems with the current implementation of
classic device discovery:

  1. IOBluetoothDeviceInquiry's cache is never cleaned which means that
     only the first discovery session will find the device. (Since the device
     is still in the cache future discovery session will not be notified of
     the device being found.) We could send notifications for all devices
     in the cache but then we could be notifying of devices that are no longer
     around.
  2. IOBluetoothDevice getLastInquiryUpdate returns nil even for devices
     that have just been discovered during an inquiry procedure. This causes
     us to immediately remove a device that we just discovered.
  3. IOBluetoothDevice pairedDevices sometimes returns devices that are not
     paired which causes us to add a non paired device.

Solutions:
  1. Clean cache every time StartDiscovery is called. This means new sessions
     will be notified of previously seen. Which allows us to implement
     the solution for 2.
  2. Now that we notify whenever we see a device, we can update our cross
     platform last_update_time_. Then when we are removing outdated devices
     we can check last_update_time_ to see if the device should be removed.
  3. Check [IOBluetoothDevice isPaired] before adding a device.

Also changes some VLOG(1)s to VLOG(3) since they were spamming the logs.

BUG=618650, 638715 

Review-Url: https://codereview.chromium.org/2282763004
Cr-Commit-Position: refs/heads/master@{#421069}

[modify] https://crrev.com/154da849a1f7106c4efb3b514d88eac45a39afaa/device/bluetooth/bluetooth_adapter.cc
[modify] https://crrev.com/154da849a1f7106c4efb3b514d88eac45a39afaa/device/bluetooth/bluetooth_adapter_mac.mm
[modify] https://crrev.com/154da849a1f7106c4efb3b514d88eac45a39afaa/device/bluetooth/bluetooth_classic_device_mac.h
[modify] https://crrev.com/154da849a1f7106c4efb3b514d88eac45a39afaa/device/bluetooth/bluetooth_classic_device_mac.mm
[modify] https://crrev.com/154da849a1f7106c4efb3b514d88eac45a39afaa/device/bluetooth/bluetooth_device.cc
[modify] https://crrev.com/154da849a1f7106c4efb3b514d88eac45a39afaa/device/bluetooth/bluetooth_device.h
[modify] https://crrev.com/154da849a1f7106c4efb3b514d88eac45a39afaa/device/bluetooth/bluetooth_discovery_manager_mac.mm
[modify] https://crrev.com/154da849a1f7106c4efb3b514d88eac45a39afaa/device/bluetooth/bluetooth_low_energy_discovery_manager_mac.mm

Comment 8 by ortuno@chromium.org, Sep 27 2016

Status: Fixed (was: Started)

Comment 9 by st...@chromium.org, Mar 3 2017

Cc: r...@chromium.org
Cc: -st...@chromium.org

Sign in to add a comment