diff options
| -rw-r--r-- | core/java/android/bluetooth/BluetoothDeviceProfileState.java | 8 | ||||
| -rw-r--r-- | core/java/android/server/BluetoothService.java | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/core/java/android/bluetooth/BluetoothDeviceProfileState.java b/core/java/android/bluetooth/BluetoothDeviceProfileState.java index 3eadff915b4a..80a80bd6617f 100644 --- a/core/java/android/bluetooth/BluetoothDeviceProfileState.java +++ b/core/java/android/bluetooth/BluetoothDeviceProfileState.java @@ -82,7 +82,7 @@ public final class BluetoothDeviceProfileState extends HierarchicalStateMachine public static final int TRANSITION_TO_STABLE = 102; public static final int CONNECT_OTHER_PROFILES = 103; - private static final int AUTO_CONNECT_DELAY = 6000; // 6 secs + private static final int CONNECT_OTHER_PROFILES_DELAY = 4000; // 4 secs private BondedDevice mBondedDevice = new BondedDevice(); private OutgoingHandsfree mOutgoingHandsfree = new OutgoingHandsfree(); @@ -152,7 +152,7 @@ public final class BluetoothDeviceProfileState extends HierarchicalStateMachine } else if (action.equals(BluetoothDevice.ACTION_ACL_CONNECTED)) { Message msg = new Message(); msg.what = AUTO_CONNECT_PROFILES; - sendMessageDelayed(msg, AUTO_CONNECT_DELAY); + sendMessage(msg); } else if (action.equals(BluetoothDevice.ACTION_ACL_DISCONNECTED)) { // This is technically not needed, but we can get stuck sometimes. // For example, if incoming A2DP fails, we are not informed by Bluez @@ -1019,7 +1019,7 @@ public final class BluetoothDeviceProfileState extends HierarchicalStateMachine Message msg = new Message(); msg.what = CONNECT_OTHER_PROFILES; msg.arg1 = CONNECT_A2DP_OUTGOING; - sendMessageDelayed(msg, AUTO_CONNECT_DELAY); + sendMessageDelayed(msg, CONNECT_OTHER_PROFILES_DELAY); } break; case CONNECT_A2DP_INCOMING: @@ -1031,7 +1031,7 @@ public final class BluetoothDeviceProfileState extends HierarchicalStateMachine Message msg = new Message(); msg.what = CONNECT_OTHER_PROFILES; msg.arg1 = CONNECT_HFP_OUTGOING; - sendMessageDelayed(msg, AUTO_CONNECT_DELAY); + sendMessageDelayed(msg, CONNECT_OTHER_PROFILES_DELAY); } break; default: diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java index 76f0d72e22fd..1f19f9ec1de4 100644 --- a/core/java/android/server/BluetoothService.java +++ b/core/java/android/server/BluetoothService.java @@ -420,6 +420,11 @@ public class BluetoothService extends IBluetooth.Stub { BluetoothDevice.UNBOND_REASON_AUTH_CANCELED); } + // Stop the profile state machine for bonded devices. + for (String address : mBondState.listInState(BluetoothDevice.BOND_BONDED)) { + removeProfileState(address); + } + // update mode Intent intent = new Intent(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED); intent.putExtra(BluetoothAdapter.EXTRA_SCAN_MODE, BluetoothAdapter.SCAN_MODE_NONE); @@ -2714,10 +2719,9 @@ public class BluetoothService extends IBluetooth.Stub { for (String path : bonds) { String address = getAddressFromObjectPath(path); BluetoothDeviceProfileState state = addProfileState(address); - // Allow 8 secs for SDP records to get registered. Message msg = new Message(); msg.what = BluetoothDeviceProfileState.AUTO_CONNECT_PROFILES; - state.sendMessageDelayed(msg, 8000); + state.sendMessage(msg); } } |