Seems that GattService onScanResult is only looking into remote uuids in
adverisement data. No device object is created in the Android framework,
Therefore we need to send regular device found for BLE devices as well.
Otherwise the Android GATT application will not be aware of remote device
properties like name etc.
This fix not setting friendly name correctly after BT power was
toggled. This is due to props being send in multiple notifications
instead of single one.
It is not needed to send notification when friendly name of remote
device is being set. Java already cache proper value. This was also
triggering exception in Java code (bug).
This includes fix for storage format so that dual mode devices are
handled correctly. Unfortunatelly this change is not backward
compatible so wiping out /data/misc/bluetooth/ is recommended.
Also correct device type is passed to bonding commands. For create_bond
we fallback to BDEDR if device is not known. This can happen eg. with
OOB. For cancel_bond and remove_bond we require device to be known.
For dual mode device currently only BREDR type is used.
Storage change details:
Instead of storing bdaddr type of device as "Type", now two variables
are used. Boolean "BREDR" if device supports BREDR. Address type is
stored in "AddressType" only if device supports LE and is either
LE random or LE public type.
This patch introduce API which GATT can use to start/stop discovery
and register for required events.
This is because GATT needs to get from GAP notifications about
founded devices and also notification when discovery has been stopped.
GATT will need it explicity when GATT client calls scan, and also in
case of connect device, as before le connect is sent we do scan first
to make sure that device is available.
For now on adapter have two variables tracing discovery.
1. cur_discovery_type which show type of ongoing discovery type.
2. exp_discovery_type which shows type of next discovery session.
We need this because of scenarion when GATT is interesting in scan and
in the same time HAL wants to do scanning.
This patch improves handling stop disvocery in scenarios when there is a big
inflow of device found events. In such case, number of confirm
name request might block mgmt queses and make stop discovery stack in the queue.
Even we cancel previous confirm name request, there is still possibility that
new incoming device found events produce confirm name request which will
might block stop discovery.
If user wants to cancel discovery we should remove all the confirm name
requests from mgmt queues.
It is in order to make sure that stop discovery have a free way to
reach kernel.
This improves scenario when there is a big inflow of device found events and
mgmt queues become full of confirm name requests. In such case stop discovery
might stack in the queue.
This patch introduce possibility to enable mgmt interface logs.
In order to enable it is required to set property:
persist.sys.bluetooth.mgmtdbg to 1 or literaly "true".
More info in README
This header contains IPC specific structures and code not related to
BT and audio HAL protocols. This allows to fully decouple IPC from
HAL messages.
This is first step to make HAL part of IPC unit-testable and reusable
between BT HAL and audio HAL.
If remote device has name but it is empty (0 bytes) just ignore it and
continue using address as name. This will avoid sending remote device
property notification with empty name.
If loading key file from file failed free key file. This fix following:
490 (40 direct, 450 indirect) bytes in 1 blocks are definitely lost in
loss record 122 of 126
at 0x4028B4C: malloc (vg_replace_malloc.c:291)
by 0x40A25B2: g_malloc (in /lib/i386-linux-gnu/
libglib-2.0.so.0.3800.2)
by 0x40B8DB1: g_slice_alloc (in /lib/i386-linux-gnu/
libglib-2.0.so.0.3800.2)
by 0x40B92DC: g_slice_alloc0 (in /lib/i386-linux-gnu/
libglib-2.0.so.0.3800.2)
by 0x40946BB: g_key_file_new (in /lib/i386-linux-gnu/
libglib-2.0.so.0.3800.2)
by 0x8054A84: new_link_key_callback (bluetooth.c:563)
by 0x804FB44: notify_handler (mgmt.c:278)
by 0x804F357: queue_foreach (queue.c:186)
by 0x804FE6C: can_read_data (mgmt.c:290)
by 0x804ED12: read_callback (io-glib.c:168)
by 0x40E0CF4: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.3800.2)
by 0x409CAED: g_main_context_dispatch (in /lib/i386-linux-gnu/
libglib-2.0.so.0.3800.2)
With this patch, deamon will not ask kernel to resolve name of remote
device during inquiry in case device name is already in the local cache.
Instead Android will be updated with already known device name.
This patch fix an issue when Android disables BT during ongoing
paring. In this case mgmt did not accept any commands and BT gets
in some unknown state.
Since Android turns off BT anyway, it is ok to just cancel all
the mgmt requests before send power off command.
It's now possible to add record with 128-bit UUID Service Class which
are used for custom applications. To simplify implementation adapter
uuids list stores now full UUID in uuid_t structure instead of uint16_t
short UUID.