summaryrefslogtreecommitdiffstats
path: root/core/java/android/server
diff options
context:
space:
mode:
authorJaikumar Ganesh <jaikumar@google.com>2009-09-30 13:57:37 -0700
committerJaikumar Ganesh <jaikumar@google.com>2009-09-30 14:02:36 -0700
commit37686069ae1d7db2604c8aef96a79904f6ddd2f3 (patch)
treeb2df0429c67acee178bc594a708fed770fb036a6 /core/java/android/server
parent15f0699504e64c1e290ef8955b1306d2a4a08201 (diff)
downloadframeworks_base-37686069ae1d7db2604c8aef96a79904f6ddd2f3.zip
frameworks_base-37686069ae1d7db2604c8aef96a79904f6ddd2f3.tar.gz
frameworks_base-37686069ae1d7db2604c8aef96a79904f6ddd2f3.tar.bz2
Set BondState to Bonding only if it not Bonded already.
Sometimes we might be paired but the other end might not have stored the link key. So when we initiate connection the other end will ask for the authorization. This was setting out Bond State to Bonding. Change-Id: Iba6fd660ac90a3f48da62e7b6cf479054624a5af
Diffstat (limited to 'core/java/android/server')
-rw-r--r--core/java/android/server/BluetoothEventLoop.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java
index 037e9d3..0152223 100644
--- a/core/java/android/server/BluetoothEventLoop.java
+++ b/core/java/android/server/BluetoothEventLoop.java
@@ -403,9 +403,13 @@ class BluetoothEventLoop {
mBluetoothService.cancelPairingUserInput(address);
return null;
}
- // Set state to BONDING, for incoming connections it will be set here.
- // For outgoing connections, it gets set when call createBond.
- mBluetoothService.getBondState().setBondState(address, BluetoothDevice.BOND_BONDING);
+ // Set state to BONDING. For incoming connections it will be set here.
+ // For outgoing connections, it gets set when we call createBond.
+ // Also set it only when the state is not already Bonded, we can sometimes
+ // get an authorization request from the remote end if it doesn't have the link key
+ // while we still have it.
+ if (mBluetoothService.getBondState().getBondState(address) != BluetoothDevice.BOND_BONDED)
+ mBluetoothService.getBondState().setBondState(address, BluetoothDevice.BOND_BONDING);
return address;
}