Use BlueZ API 'CreateDevice' to update the SDP records of those
unknown devices. On the other hand, still use 'DiscoverServices'
to update SDP records of paired devices.
If user tries to send a file to a device which just completes the pairing
process, the OPP manager may update SDP records when it's not ready.
It's especially likely to occur in BT file transfer with inline pairing
since OPP manager would request for a service channel to send the file when
device is just paired.
Consent pairing event raises under the following conditions:
1. Local IO capabilities are DisplayYesNo and remote IO capabiltiies are DisplayOnly or NoInputNoOutput.
2. Call PairingConsent callback for "incoming" request.
This patch is try to directly reply pairing confirmation for consent cases.
How to test:
1. Initialize pairing request with IO capabilities-NoInputNoOutput as
headset role to b2g phone
2. Check pairing status of bluetooth headset
This patch removes the constant BLUEZ_DBUS_BASE_IFC from the file
RawDBusconnection.cpp. The constant is specific to BlueZ, and that's
where it's located now.
|sControllerArray| is only being used on the main thread, but
cleared on the I/O thread. During the BlueZ shutdown, we go
through the main thread, where we can clear |sControllerArray|;
moving the variable to main thread exclusively.
|sAdapterPath| is being accessed from within the main and the
I/O thread in a possible non-thread-safe way. This patch moves
all access to the I/O thread.
This patch prepares moving |sAdapterAdded| to the I/O thread. For
|GetServiceChannel| it gets pushed into task classes on the I/O
thread and the interface of these classes is cleaned up.
|sAuthorizedServiceClass| is being set on the main thread, but read
from within the I/O thread. Making the variable a static constant
array and moving all access to the I/O thread fixes potential race
conditions.
This patch adds an annotation to each assertion for non-main threads in
the BlueZ backend of Bluetooth. This should make is easy and obvious to
see in which context a method or function is expected to run.
The global variables in BluetoothDBusService.cpp are now annotated
for their multi-threading access. Some code still seems to access
some of these variables in an unprotected manner. Follow-up patches
should clean this up.
As a side effect, this patch makes several variables as constant,
which improves correctness of the code.
Until now, we had corner cases in Bluetooth where DBus messages might
have been received on connections that are shutting down. This can't
happen any longer and this patch replaces the respective tests with
assertions.
With this patch, the start code of Bluetooth's BlueZ back mostly
runs on the I/O thread. Only the loading of the BT firmware and
the blocking connection setup is done on the BT thread.
The stop code has been moved to the I/O thread, except for some
initial waiting and the final cleanup of the firmware. The code
doesn't wait for errors anymore when cleaning up the connection
to DBus. This makes it run completely non-blocking. The initial
waiting may later be replaced by something more sophisticated.
This is caused by bug 967364. We need to hand over data structures
to DBus operations and forget about them if the operation returned
success. Until now, we could just tell their nsRefPtrs to |forget|
about them, but with bug 967364 applied we need to swap an empty
value into the pointer.
The Bluetooth thread is only necessary for starting and stopping
Bluetooth with the BlueZ backend. Bluedroid implements its multi-
threading internally.
This patch moves the Bluetooth thread into the BlueZ backend. Two
runnables implement the starting and stopping code. The methods
|StartInternal| and |StopInternal| of |BluetoothDBusService| each
create an instance of the respective runnable and send it to the
internal BT thread. The code in |BluetoothService| runs completely
on the main thread.
For the Bluedroid back end, the patch changes a number of thread
assertions.
In BluetoothProfileController, it's meaningless to separate OnConnect
and OnDisconnect since the following steps would be the same for both
cases. Therefore I introduced a function called NotifyCompletion() for
each profile manager to report the completion of connecting/disconnecting
operations.