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.
Bluedroid callbacks were usually called on a separate thread that
was specific to this task. So Gecko's Bluetooth Core contained a
number of runnables for executing callback operations on the main
thread.
Since all notifications always run on the main thread, the extra
runnables are not required any longer. This patch integrates them
into the notification methods where possible.
This patch adds the Gecko-side of the Core notifications. The current
implementation of the notification methods has been copied from the
repsective Bluedroid callback methods, with only minor changes to adapt
them to Gecko data types.
A notification is a callback from the Bluetooth backend to inform
Gecko about a event. Bluedroid uses function pointers for this, but
in Gecko we use method calls instead.
Gecko implements notification handlers for the Bluetooth backend. The
backend converts incomming events to Gecko types and forwards them to
the registered notification handler.
This patch adds some runnable classes for running class methods on
the main thread. This is the base of the upcomming notification
mechanism for Bluetooth.
This patch cleans up the interface of Bluedroid's |BluetoothScoket|
to look more similar the interface of |UnixSocketConsumer|, from
which it descends.