diff options
| author | Jaikumar Ganesh <jaikumar@google.com> | 2010-12-13 15:54:33 -0800 |
|---|---|---|
| committer | Jaikumar Ganesh <jaikumar@google.com> | 2010-12-13 15:58:44 -0800 |
| commit | 2d1fc4e3f5eb612f9ef8a50080310ced1dfaaadf (patch) | |
| tree | af2b13996933f473f8b2310517c1d7bde00972aa | |
| parent | ffdd591a829af7fddd36a7b80d2a3b8188c871a6 (diff) | |
| download | frameworks_base-2d1fc4e3f5eb612f9ef8a50080310ced1dfaaadf.zip frameworks_base-2d1fc4e3f5eb612f9ef8a50080310ced1dfaaadf.tar.gz frameworks_base-2d1fc4e3f5eb612f9ef8a50080310ced1dfaaadf.tar.bz2 | |
Remove delay with auto connection.
SDP records are now registered with a dbus call so we don't have to wait
for initiating auto connections.
Also reduce time to connect other profiles case by 2 secs.
Change-Id: I8f0eab6a95d3bfaf11a8eb7495a024949639d7fc
| -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 3eadff9..80a80bd 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 76f0d72..1f19f9e 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); } } |
