Auto connect hf/a2dp when any one of them gets connected and timeout happens

Change-Id: I6249c2fceab87f91c6629d19f72268d000ecf61c
This commit is contained in:
Swaminatha Balaji
2012-05-09 01:44:38 -07:00
committed by Matthew Xie
parent 654a3ab77d
commit 00ec05985d
3 changed files with 79 additions and 9 deletions

View File

@@ -95,10 +95,6 @@ final class HeadsetProfile implements LocalBluetoothProfile {
return mIsProfileReady;
}
// TODO(): The calls must get queued if mService becomes null.
// It can happen when the phone app crashes for some reason.
// All callers should have service listeners. Dock Service is the only
// one right now.
HeadsetProfile(Context context, LocalBluetoothAdapter adapter,
CachedBluetoothDeviceManager deviceManager,
LocalBluetoothProfileManager profileManager) {
@@ -168,6 +164,14 @@ final class HeadsetProfile implements LocalBluetoothProfile {
}
}
public List<BluetoothDevice> getConnectedDevices() {
return mService.getDevicesMatchingConnectionStates(
new int[] {BluetoothProfile.STATE_CONNECTED,
BluetoothProfile.STATE_CONNECTING,
BluetoothProfile.STATE_DISCONNECTING});
}
// This function is added as the AUTO CONNECT priority could not be set by using setPreferred(),
// as setPreferred() takes only boolean input but getPreferred() supports interger output.
// Also this need not implemented by all profiles so this has been added here.