// This method does not check for error conditon (newState == prevState)
private void broadcastConnectionState(BluetoothDevice device, int newState, int prevState) {
+ /* 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);
+ mService.notifyProfileConnectionStateChanged(device, BluetoothProfile.A2DP,
+ newState, prevState);
Intent intent = new Intent(BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED);
intent.putExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, prevState);
intent.putExtra(BluetoothProfile.EXTRA_STATE, newState);
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
mContext.sendBroadcast(intent, ProfileService.BLUETOOTH_PERM);
- if (DBG) log("Connection state " + device + ": " + prevState + "->" + newState);
- mService.notifyProfileConnectionStateChanged(device, BluetoothProfile.A2DP, newState, prevState);
}
private void broadcastAudioState(BluetoothDevice device, int state, int prevState) {
// This method does not check for error conditon (newState == prevState)
private void broadcastConnectionState(BluetoothDevice device, int newState, int prevState) {
+ if (DBG) log("Connection state " + device + ": " + prevState + "->" + 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. */
+ mService.notifyProfileConnectionStateChanged(device, BluetoothProfile.HEADSET,
+ newState, prevState);
Intent intent = new Intent(BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED);
intent.putExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, prevState);
intent.putExtra(BluetoothProfile.EXTRA_STATE, newState);
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
mService.sendBroadcast(intent, HeadsetService.BLUETOOTH_PERM);
- if (DBG) log("Connection state " + device + ": " + prevState + "->" + newState);
- mService.notifyProfileConnectionStateChanged(device, BluetoothProfile.HEADSET, newState, prevState);
}
private void broadcastAudioState(BluetoothDevice device, int newState, int prevState) {
}
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) {
panDevice.mIface = iface;
}
+ /* 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.d(TAG, "Pan Device state : device: " + device + " State:" +
+ prevState + "->" + state);
+ notifyProfileConnectionStateChanged(device, BluetoothProfile.PAN, state, prevState);
Intent intent = new Intent(BluetoothPan.ACTION_CONNECTION_STATE_CHANGED);
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
intent.putExtra(BluetoothPan.EXTRA_PREVIOUS_STATE, prevState);
intent.putExtra(BluetoothPan.EXTRA_STATE, state);
intent.putExtra(BluetoothPan.EXTRA_LOCAL_ROLE, local_role);
sendBroadcast(intent, BLUETOOTH_PERM);
-
- if (DBG) Log.d(TAG, "Pan Device state : device: " + device + " State:" +
- prevState + "->" + state);
- notifyProfileConnectionStateChanged(device, BluetoothProfile.PAN, state, prevState);
}
// configured when we start tethering