diff options
author | Jaikumar Ganesh <jaikumar@google.com> | 2011-01-13 16:21:12 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-01-13 16:21:12 -0800 |
commit | e77e9da84946a2833ef8b0d1d476d6325768a244 (patch) | |
tree | d814602f1f3dc9219486025f38907a4660bb58a5 /core/java | |
parent | 52ea989874160be47aad75b285503959c0e4c0bb (diff) | |
parent | d1287f5ef091bd41ec902d6a83284db21a4dcabb (diff) | |
download | frameworks_base-e77e9da84946a2833ef8b0d1d476d6325768a244.zip frameworks_base-e77e9da84946a2833ef8b0d1d476d6325768a244.tar.gz frameworks_base-e77e9da84946a2833ef8b0d1d476d6325768a244.tar.bz2 |
Merge "Fix bug in handling connect/disconnect multiple devices." into honeycomb
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/bluetooth/BluetoothDeviceProfileState.java | 6 | ||||
-rw-r--r-- | core/java/android/server/BluetoothService.java | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/core/java/android/bluetooth/BluetoothDeviceProfileState.java b/core/java/android/bluetooth/BluetoothDeviceProfileState.java index 21144f2..3280d39 100644 --- a/core/java/android/bluetooth/BluetoothDeviceProfileState.java +++ b/core/java/android/bluetooth/BluetoothDeviceProfileState.java @@ -102,7 +102,6 @@ public final class BluetoothDeviceProfileState extends HierarchicalStateMachine private BluetoothDevice mDevice; private int mHeadsetState = BluetoothProfile.STATE_DISCONNECTED; private int mA2dpState = BluetoothProfile.STATE_DISCONNECTED; - private int mHidState = BluetoothProfile.STATE_DISCONNECTED; private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { @Override @@ -140,7 +139,7 @@ public final class BluetoothDeviceProfileState extends HierarchicalStateMachine int newState = intent.getIntExtra(BluetoothInputDevice.EXTRA_INPUT_DEVICE_STATE, 0); int oldState = intent.getIntExtra(BluetoothInputDevice.EXTRA_PREVIOUS_INPUT_DEVICE_STATE, 0); - mHidState = newState; + if (oldState == BluetoothInputDevice.STATE_CONNECTED && newState == BluetoothInputDevice.STATE_DISCONNECTED) { sendMessage(DISCONNECT_HID_INCOMING); @@ -286,7 +285,8 @@ public final class BluetoothDeviceProfileState extends HierarchicalStateMachine sendMessage(DISCONNECT_A2DP_OUTGOING); deferMessage(message); break; - } else if (mHidState != BluetoothInputDevice.STATE_DISCONNECTED) { + } else if (mService.getInputDeviceState(mDevice) != + BluetoothInputDevice.STATE_DISCONNECTED) { sendMessage(DISCONNECT_HID_OUTGOING); deferMessage(message); break; diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java index 32e609c..dd88838 100644 --- a/core/java/android/server/BluetoothService.java +++ b/core/java/android/server/BluetoothService.java @@ -1755,7 +1755,8 @@ public class BluetoothService extends IBluetooth.Stub { "Need BLUETOOTH_ADMIN permission"); String objectPath = getObjectPathFromAddress(device.getAddress()); - if (objectPath == null || getConnectedInputDevices().size() == 0) { + if (objectPath == null || + getInputDeviceState(device) == BluetoothInputDevice.STATE_DISCONNECTED) { return false; } BluetoothDeviceProfileState state = mDeviceProfileState.get(device.getAddress()); |