This patch moves BluetoothInterface.{cpp,h} to the generic section
of Gecko's Bluetooth code, and the Bluedroid implementation into
the new files BluetoothHalImplementation.{cpp,h}.
BluetoothHalImplementation.{cpp,h} contains all Bluedroid-specific
code. The classes in BluetoothInterface.{cpp,h} are now interfaces
for Gecko.
--HG--
rename : dom/bluetooth2/bluedroid/BluetoothInterface.cpp => dom/bluetooth2/bluedroid/BluetoothHALInterface.cpp
All interfaces for Bluetooth profiles are now always available, so we
don't have to check for specific versions of Bluedroid. Instead, we
try to call the methods, and check their results.
The methods of |BluetoothAVRCPInterface| are now always available. On
Android versions before 18, which don't support AVRCP, they always
fail with STATUS_UNSUPPORTED.
Calling read on a socket that has been closed for reading by the
peer, read returns 0. The socket is still readable however, so
polling and reading will return constant results of 0 received
bytes.
With this patch, if a socket's peer shuts down reading or if
we reached the EOF, we stop watching the file descriptor for
readability. |SocketIOBase| will detect this case exactly once
and initiate the socket's shutdown.
The patch removes unused callbacks and helper runnables from the
Bluedroid implementation of BluetoothA2DPManager. It also removes
the last Bluedroid-specific code from BluetoothUtils.{cpp,h}.
The helper runnables where necessary to perform certain operations on
the main thread after having received a callback from Bluedroid. The
new notification methods already run on the main thread, so the helper
runnables can be replaced by direct calls.
This patch adds Bluetooth A2DP and AVRCP notifications to Gecko's
A2DP manager. The code has been taken from taken from the callback
implementations, and adapted to run on the main thread. No further
cleanups have been applied.
This patch adds A2DP and AVRCP notifications and callbacks to
Gecko's Bluedroid interface. Support for AVRCP depends on the
version of the Android base system and is only available on
versions 18, 19 or later.
|MainThreadTask| performs different operations on the main thread,
depending on a given command flag. There is only one command, CLOSE_SCO,
in use.
This patch removes the command infrastructure and replaces |MainThreadTask|
by |CloseScoRunnable|, which implements only this single operation.
A number of notifications dispatch runnables to the main thread for
invoking actions. This is not requireed, as notifications already
run on the main thread. This patch merges the runnable's code into
the respective notifications.
This patch replaces Handsfree callbacks by notifications. One
important change is that the first call to |BluetoothHandsfreeManager::Get|
now happens during initialization. Hence the Handsfree manager is now setup
immediately, instead of later at use.
The patch adds notifications support to the Handsfree manager. Each
notification's method is taken from the respective callback code, with
changes to the arguments' data types.
The notification interface consists of virtual methods that are
invoked form the Bluetooth backend on certain events. The Handsfree
manager can implement the methods to handle these events.
This patch removes unsued code from |BluetoothServiceBluedroid|, related
functions, and cleans up the file. It
* removes callbacks,
* removes callback helper tasks,
* removes helper functions, and
* cleans up global variables.