When enabling or disabling Bluetooth, the Bluedroid backend waits
on sToggleBtMonitor until a BT adapter has been activated. Once
the monitor gets notified, the backend sends a ToggleBtAck runnable
to the main thread.
This patch removes sToggleBtMonitor from the Bluetooth Bluedroid
backend. Instead of signalling the monitor's notification, the
Bluedroid handler function sends the ToggleBtAck directly.
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.
The current Bluetooth API can't allow user to disable BT before the BT
adapter is initialized.
In practice, We block the clicking event in gaia layer to prevent user
to turn off BT before BT enable procedure complete.
If we use marionette test to force emulator turn on and turn off BT in
a short period of time, it may crash emulator.
Listen to 'adapteradded' event rather than 'enabled' as the end of
BT enable to make sure we wouldn't disable BT when it's not ready.
The methods {Start|Stop}Internal for BlueZ and Bluedroid now send
ToggleBtAck to signal completeness of the operation.
The current patch allows for further cleanups in the BlueZ code. It
does not change the semantics or code flow.
PROP_BLUETOOTH_ENABLED signals the Bluetooth state to other
components in the system. Setting its value in ToggleBtAck
on the main thread avoids duplicated code in the upcoming
patches.
This patch cleans up the code for starting and stopping DBus
connections in the BlueZ backend of Bluetooth. It also fixes
a bug were the initial 'adapteradded' reply might have been
missed.
This patch removes all unnecessary code when starting and stopping
Gonk in BluetoothDBusService. The change simplifies the respective
methods considerably.
This patch cleans up the handling of libbluedroid.so and its
interfaces. Open and closing the library is now handled internally
and contained functions are wrapped in class methods.
Currently, the DBus connection for Bluetooth is shared between the
main thread and the I/O thread. This causes race conditions when
starting or stopping Bluetooth.
This patch moves all occurences of main-thread-invoked DBus send
operations to the I/O thread. This is mostly refactoring. Internally,
send operations are already executed on the main thread, so there is
no change in the over all logic of these methods.
If the listen operation fails for Bluetooth servers, we should
not call listen again in the error handler. Otherwise, we run
into an endless loop of listen calls and error callbacks.
This makes sense since the file no longer contains anything with the
nsTraceRefcnt name in it, and it will allow renaming nsTraceRefcntImpl
back to nsTraceRefcnt.