This fixes the following:
==25759== Syscall param socketcall.sendmsg(msg.msg_iov[i]) points to
uninitialised byte(s)
==25759== at 0x521C570: __sendmsg_nocancel (syscall-template.S:82)
==25759== by 0x41688F: ipc_send (ipc.c:366)
==25759== by 0x40ECF8: send_ssp_request (bluetooth.c:1028)
==25759== by 0x4110A6: user_confirm_request_callback
(bluetooth.c:1055)
==25759== by 0x4094FE: queue_foreach (queue.c:186)
==25759== by 0x409FCF: can_read_data (mgmt.c:287)
==25759== by 0x408E4C: read_callback (io-glib.c:168)
==25759== by 0x4E79D12: g_main_context_dispatch (in
/lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.4)
==25759== by 0x4E7A05F: ??? (in
/lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.4)
==25759== by 0x4E7A459: g_main_loop_run (in
/lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.4)
==25759== by 0x40454D: main (main.c:538)
==25759== Address 0x7ff00085d is on thread 1's stack
==25759== Uninitialised value was created by a stack allocation
==25759== at 0x40EC77: send_ssp_request (bluetooth.c:1018)
This is a preparation for correctly handling no bond pairing.
Currently paired but not bonded devices are left on list of bonded
devices in Framework until BT is restarted on device. This is due to
Android Framework is not allowing stack to unpair device by its own
(setting bond state bonded->no_bond is ignored).
It is possible that dual mode device is paired both for LE and BR/EDR
link. This patch add tracking of this.
Due to HAL API contraints second pairing will result in following bond
state changed events:
bonded -> bonding (success) -> bonded (success/failed)
This makes function flow easier to follow. Also fix usage of
adapter.exp_discovery_type which should be used only when stopping
currently running discovery session to restart it with new type.
This makes function flow easier to follow. Also fix usage of
adapter.exp_discovery_type which should be used only when stopping
currently running discovery session to restart it with new type.
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.