summaryrefslogtreecommitdiffstats
path: root/src/com/android/bluetooth/hid
diff options
context:
space:
mode:
authorSreenidhi T <nidhit@broadcom.com>2012-05-21 03:39:22 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-07-16 22:09:26 -0700
commita25e9c65c2a0192b7b3d819e2b87704f1942aa2f (patch)
tree58335a47ccbf161c4895d3828d4b3e8fb6af171e /src/com/android/bluetooth/hid
parent4a53a55dc10d3a26c94e5844f7d4a2565a67142c (diff)
downloadandroid_packages_apps_Bluetooth-a25e9c65c2a0192b7b3d819e2b87704f1942aa2f.tar.gz
android_packages_apps_Bluetooth-a25e9c65c2a0192b7b3d819e2b87704f1942aa2f.tar.bz2
android_packages_apps_Bluetooth-a25e9c65c2a0192b7b3d819e2b87704f1942aa2f.zip
Changing the order of notification of connection state change, as it was causing a race condition, with the UI not being updated with the correct connection state.
Change-Id: I6f4c75e4eac4ae798cb7918a4f1b7458e1eaa4b0
Diffstat (limited to 'src/com/android/bluetooth/hid')
-rwxr-xr-xsrc/com/android/bluetooth/hid/HidService.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/com/android/bluetooth/hid/HidService.java b/src/com/android/bluetooth/hid/HidService.java
index c522c66cc..e0d7be796 100755
--- a/src/com/android/bluetooth/hid/HidService.java
+++ b/src/com/android/bluetooth/hid/HidService.java
@@ -492,14 +492,18 @@ public class HidService extends ProfileService {
}
mInputDevices.put(device, newState);
+ /* Notifying the connection state change of the profile before sending the intent for
+ connection state change, as it was causing a race condition, with the UI not being
+ updated with the correct connection state. */
+ if (DBG) log("Connection state " + device + ": " + prevState + "->" + newState);
+ notifyProfileConnectionStateChanged(device, BluetoothProfile.INPUT_DEVICE,
+ newState, prevState);
Intent intent = new Intent(BluetoothInputDevice.ACTION_CONNECTION_STATE_CHANGED);
intent.putExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, prevState);
intent.putExtra(BluetoothProfile.EXTRA_STATE, newState);
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
sendBroadcast(intent, BLUETOOTH_PERM);
- if (DBG) log("Connection state " + device + ": " + prevState + "->" + newState);
- notifyProfileConnectionStateChanged(device, BluetoothProfile.INPUT_DEVICE, newState, prevState);
}
private void broadcastProtocolMode(BluetoothDevice device, int protocolMode) {