This branch adds support for Bluetooth discovery when adding contacts on devices that don't know their own Bluetooth addresses.
If a device knows its own address, it includes it in the BQP transport descriptor as before, and the other device connects without performing discovery. Otherwise the device includes a Bluetooth transport descriptor with no address. A legacy device will ignore this descriptor after trying to parse the address. A device running this branch will understand that the absence of an address means discovery is needed.
Discovery starts after scanning the other device's QR code and runs for a maximum of 10 seconds. The BQP connection timeout is increased from 20 to 60 seconds. This allows time for connecting to several devices, which may be necessary if there are many discoverable devices nearby. The discovered devices are tried in a random order, so that if there are too many devices to attempt within the timeout, the order will be different the next time.
I tested this branch on eight devices, divided into groups of four. Wifi was disabled and
AndroidBluetoothPlugin#getBluetoothAddress() was modified to return null, so all devices needed to use discovery. All devices in the group were made discoverable to test the effect of discovering several devices. All devices were eventually able to add the other devices in their groups, but some retries were needed.
When wifi and Bluetooth were both enabled, four devices were able to add each other without retries, but adding contacts seemed slower than with only wifi enabled - but that's also true without discovery. It's not clear whether discovery makes the interference worse.
First part of #1147. Support for discovery on Java SE is not included in this branch, but will be added later.