Index: device/bluetooth/bluetooth_adapter_mac.mm |
diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm |
index c485f99bc40c7e585e591cd67671687c484b203b..4b8be9dea68f883b4a6951682bd7f9911cb0d23d 100644 |
--- a/device/bluetooth/bluetooth_adapter_mac.mm |
+++ b/device/bluetooth/bluetooth_adapter_mac.mm |
@@ -469,12 +469,19 @@ void BluetoothAdapterMac::ClassicDeviceAdded(IOBluetoothDevice* device) { |
std::string device_address = |
BluetoothClassicDeviceMac::GetDeviceAddress(device); |
+ BluetoothDevice* device_classic = GetDevice(device_address); |
+ |
// Only notify observers once per device. |
- if (devices_.count(device_address)) |
+ if (device_classic != nullptr) { |
+ VLOG(3) << "Updating classic device: " << device_classic->GetAddress(); |
+ device_classic->UpdateTimestamp(); |
return; |
+ } |
- BluetoothDevice* device_classic = new BluetoothClassicDeviceMac(this, device); |
+ device_classic = new BluetoothClassicDeviceMac(this, device); |
devices_.set(device_address, base::WrapUnique(device_classic)); |
+ VLOG(1) << "Adding new classic device: " << device_classic->GetAddress(); |
+ |
FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, |
DeviceAdded(this, device_classic)); |
} |
@@ -567,7 +574,11 @@ void BluetoothAdapterMac::LowEnergyCentralManagerUpdatedState() {} |
void BluetoothAdapterMac::AddPairedDevices() { |
// Add any new paired devices. |
for (IOBluetoothDevice* device in [IOBluetoothDevice pairedDevices]) { |
- ClassicDeviceAdded(device); |
+ // pairedDevices returns an unknown device that is not paired. |
Jeffrey Yasskin
2016/09/26 18:35:59
s/returns/includes/, I think, since it also return
ortuno
2016/09/26 23:58:18
Done.
|
+ // Radar issue with id 2282763004 has been filed about it. |
+ if ([device isPaired]) { |
+ ClassicDeviceAdded(device); |
+ } |
} |
} |