Index: device/bluetooth/bluetooth_classic_device_mac.mm |
diff --git a/device/bluetooth/bluetooth_classic_device_mac.mm b/device/bluetooth/bluetooth_classic_device_mac.mm |
index cc2fafb6e2632aa9bb6e1fdce078457a7a287035..f677f11fe4e8eeadac5322910244e67cd73c3e1c 100644 |
--- a/device/bluetooth/bluetooth_classic_device_mac.mm |
+++ b/device/bluetooth/bluetooth_classic_device_mac.mm |
@@ -62,7 +62,9 @@ BluetoothUUID ExtractUuid(IOBluetoothSDPDataElement* service_class_data) { |
BluetoothClassicDeviceMac::BluetoothClassicDeviceMac( |
BluetoothAdapterMac* adapter, |
IOBluetoothDevice* device) |
- : BluetoothDeviceMac(adapter), device_([device retain]) {} |
+ : BluetoothDeviceMac(adapter), device_([device retain]) { |
+ UpdateTimestamp(); |
+} |
BluetoothClassicDeviceMac::~BluetoothClassicDeviceMac() { |
} |
@@ -255,8 +257,14 @@ void BluetoothClassicDeviceMac::CreateGattConnection( |
} |
base::Time BluetoothClassicDeviceMac::GetLastUpdateTime() const { |
- return base::Time::FromDoubleT( |
- [[device_ getLastInquiryUpdate] timeIntervalSince1970]); |
+ // Even when a device is discovered during an inquiry procedure this returns |
+ // nil so we implement out own last_update_time_ which gets updated whenever |
+ // the device is found. |
+ NSDate* inquiry_update = [device_ getLastInquiryUpdate]; |
+ if (inquiry_update != nil) { |
+ return base::Time::FromDoubleT([inquiry_update timeIntervalSince1970]); |
+ } |
+ return last_update_time_; |
} |
int BluetoothClassicDeviceMac::GetHostTransmitPower( |