Commit 2fdf5a36 authored by deymo@chromium.org's avatar deymo@chromium.org

Bluetooth: Disable "IsConnectable" property for ChromeOS implementation.

The IsConnectable property tells if a given device can be re-connected
later once paired. If it is false, the device is not supposed to respond
to a connection attempt from the host, and since we know it, we don't
show the connect button for this kind of devices.

This fix rollbacks the IsConnectable implementation in ChromeOS and
default its value to true because some mice don't support pairing and should be possible to connect to them regardless the value of this property.

BUG=chromium:220553
TEST=Pair to Microsoft mouse 5000, disconnect and try to connect again.

Review URL: https://chromiumcodereview.appspot.com/12917023

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190559 0039d316-1c4b-4281-b951-d872f2087c98
parent 03532905
......@@ -457,36 +457,10 @@ void BluetoothDeviceChromeOS::CollectServiceRecordsCallback(
new BluetoothServiceRecordChromeOS(address(), i->second));
}
service_records_loaded_ = true;
OnServiceRecordsChanged();
callback.Run(service_records_);
}
void BluetoothDeviceChromeOS::OnServiceRecordsChanged(void) {
// Update the BluetoothDevice::connectable_ property.
bool hid_normally_connectable = true;
bool hid_reconnect_initiate = true;
for (ServiceRecordList::const_iterator it = service_records_.begin();
it != service_records_.end(); ++it) {
if ((*it)->SupportsHid()) {
// If there are several HID profiles, we assume the device is connectable
// if all them are connectable.
hid_normally_connectable =
hid_normally_connectable && (*it)->hid_normally_connectable();
hid_reconnect_initiate =
hid_reconnect_initiate && (*it)->hid_reconnect_initiate();
}
}
// The Bluetooth HID spec states that if HIDNormallyConnectable or
// HIDReconnectInitiate are not present in a HID profile, the value is false.
// Nevertheless, a device with both properties in false can't reconnect to the
// adapter and can't be reconnected from the adapter. To avoid problems with
// devices that don't export this properties we asume they are connectable.
connectable_ = hid_normally_connectable || !hid_reconnect_initiate;
VLOG(1) << "ServiceRecordsChanged for " << address_
<< ": connectable = " << connectable_;
}
void BluetoothDeviceChromeOS::OnSetTrusted(bool success) {
LOG_IF(WARNING, !success) << "Failed to set device as trusted: " << address_;
}
......
......@@ -124,11 +124,6 @@ class BluetoothDeviceChromeOS
const BluetoothDeviceClient::ServiceMap& service_map,
bool success);
// Called by CollectServiceRecordsCallback() every time |service_records_| is
// updated. |OnServiceRecordsChanged| updates the derived properties that
// depend on |service_records_|.
void OnServiceRecordsChanged(void);
// Called by BluetoothProperty when the call to Set() for the Trusted
// property completes. |success| indicates whether or not the request
// succeeded.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment