OSDN Git Service

android: Update bond state on incoming bonding
authorLukasz Rymanowski <lukasz.rymanowski@tieto.com>
Fri, 15 Nov 2013 18:03:58 +0000 (19:03 +0100)
committerJohan Hedberg <johan.hedberg@intel.com>
Fri, 15 Nov 2013 18:19:50 +0000 (20:19 +0200)
commite9d43a87fa324ab68c459df22e0843f72ac98093
tree3bb4fa5dec494f23abfc384dab52d78caab11fc0
parente30125fa921bc1d2c27ea47f79318ee90bbe54d5
android: Update bond state on incoming bonding

Before sending any ssp request or pin code request up to HAL library we
need to send bond state change with bonding state. Otherwise incoming
bonding is not correctly handled by Bluetooth.apk.
In this patch also device list has been added in order to e.g track
bonding state.

Note: For incoming paring (security mode 3) there is a  need to send
HAL_EVE_REMOTE_DEVICE_PROPS before HAL_EV_PIN_REQUEST.
It is because Android will crash due to bug in pinRequestCallback
function in java. Android checks if device is already in HashMap and if
not then creates  device, but forget to use that one, but instead do
operations on NULL. By sending HAL_BOND_STATE_BONDING event it works
better but we have race issue. It is because new device is added to
HashMap not in callback context but later after BONDING msg will be
received  by BondStateMachine. If it happens before pin_request_cb hits
java then we are fine, otherwise not. So for that reason we send
HAL_EV_REMOTE_DEVICE_PROPS so in the java handler class new device will
be added to HashMap in the  callback context.

In ssp case we don't have this problem as we send device found once acl
is created.
android/bluetooth.c