diff options
| author | Jaikumar Ganesh <jaikumar@google.com> | 2009-10-08 02:27:52 -0700 |
|---|---|---|
| committer | Jaikumar Ganesh <jaikumar@google.com> | 2009-10-08 04:25:45 -0700 |
| commit | e5d93b7ed983f98855555d560faf060836f1a52f (patch) | |
| tree | bd9b6c485e3c3af23f1a60944e114783c8add72b /core/java/android/server/BluetoothEventLoop.java | |
| parent | b134b2038ecabcbec3f9b657834d45de27707068 (diff) | |
| download | frameworks_base-e5d93b7ed983f98855555d560faf060836f1a52f.zip frameworks_base-e5d93b7ed983f98855555d560faf060836f1a52f.tar.gz frameworks_base-e5d93b7ed983f98855555d560faf060836f1a52f.tar.bz2 | |
Set the Bond State to NONE when we receive a Agent Cancel.
Sometimes during OPP, we can get stuck in Pairing state when the remote
end, cancels the Pairing process - we will just get onAgentCancel
and thus not set the Pairing state properly.
DrNo: Eastham
Bug:2174874
Diffstat (limited to 'core/java/android/server/BluetoothEventLoop.java')
| -rw-r--r-- | core/java/android/server/BluetoothEventLoop.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java index da1918a..c0b9a68 100644 --- a/core/java/android/server/BluetoothEventLoop.java +++ b/core/java/android/server/BluetoothEventLoop.java @@ -54,6 +54,7 @@ class BluetoothEventLoop { private static final int EVENT_AUTO_PAIRING_FAILURE_ATTEMPT_DELAY = 1; private static final int EVENT_RESTART_BLUETOOTH = 2; private static final int EVENT_PAIRING_CONSENT_DELAYED_ACCEPT = 3; + private static final int EVENT_AGENT_CANCEL = 4; private static final int CREATE_DEVICE_ALREADY_EXISTS = 1; private static final int CREATE_DEVICE_SUCCESS = 0; @@ -90,6 +91,22 @@ class BluetoothEventLoop { mBluetoothService.setPairingConfirmation(address, true); } break; + case EVENT_AGENT_CANCEL: + // Set the Bond State to BOND_NONE. + // We always have only 1 device in BONDING state. + String[] devices = + mBluetoothService.getBondState().listInState(BluetoothDevice.BOND_BONDING); + if (devices.length == 0) { + break; + } else if (devices.length > 1) { + Log.e(TAG, " There is more than one device in the Bonding State"); + break; + } + address = devices[0]; + mBluetoothService.getBondState().setBondState(address, + BluetoothDevice.BOND_NONE, + BluetoothDevice.UNBOND_REASON_REMOTE_AUTH_CANCELED); + break; } } }; @@ -544,6 +561,10 @@ class BluetoothEventLoop { private void onAgentCancel() { Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_CANCEL); mContext.sendBroadcast(intent, BLUETOOTH_ADMIN_PERM); + + mHandler.sendMessageDelayed(mHandler.obtainMessage(EVENT_AGENT_CANCEL), + 1500); + return; } |
