Skip to content

Commit 40e6c21

Browse files
author
Jaikumar Ganesh
committed
Do Not Merge Connect other profiles when priority is auto connect.
ACL auto connection was removed so other profiles won't auto connect when priority was auto connect. Reduced connect other profiles time delay. Bug: 3281016 Change-Id: Ic56ca6e95f618f02bc316d1f80014e58c4b6c3bc
1 parent 07e6f61 commit 40e6c21

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

core/java/android/bluetooth/BluetoothDeviceProfileState.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public final class BluetoothDeviceProfileState extends HierarchicalStateMachine
7575
public static final int CONNECT_OTHER_PROFILES = 103;
7676

7777
private static final int AUTO_CONNECT_DELAY = 6000; // 6 secs
78+
private static final int CONNECT_OTHER_PROFILES_DELAY = 4000; // 4 secs
7879

7980
private BondedDevice mBondedDevice = new BondedDevice();
8081
private OutgoingHandsfree mOutgoingHandsfree = new OutgoingHandsfree();
@@ -765,23 +766,26 @@ private void handleConnectionOfOtherProfiles(int command) {
765766
case CONNECT_HFP_INCOMING:
766767
// Connect A2DP if there is no incoming connection
767768
// If the priority is OFF - don't auto connect.
768-
// If the priority is AUTO_CONNECT, auto connect code takes care.
769-
if (mA2dpService.getSinkPriority(mDevice) == BluetoothA2dp.PRIORITY_ON) {
769+
if (mA2dpService.getSinkPriority(mDevice) == BluetoothA2dp.PRIORITY_ON ||
770+
mA2dpService.getSinkPriority(mDevice) ==
771+
BluetoothA2dp.PRIORITY_AUTO_CONNECT) {
770772
Message msg = new Message();
771773
msg.what = CONNECT_OTHER_PROFILES;
772774
msg.arg1 = CONNECT_A2DP_OUTGOING;
773-
sendMessageDelayed(msg, AUTO_CONNECT_DELAY);
775+
sendMessageDelayed(msg, CONNECT_OTHER_PROFILES_DELAY);
774776
}
775777
break;
776778
case CONNECT_A2DP_INCOMING:
777779
// This is again against spec. HFP incoming connections should be made
778780
// before A2DP, so we should not hit this case. But many devices
779781
// don't follow this.
780-
if (mHeadsetService.getPriority(mDevice) == BluetoothHeadset.PRIORITY_ON) {
782+
if (mHeadsetService.getPriority(mDevice) == BluetoothHeadset.PRIORITY_ON
783+
|| mHeadsetService.getPriority(mDevice) ==
784+
BluetoothHeadset.PRIORITY_AUTO_CONNECT) {
781785
Message msg = new Message();
782786
msg.what = CONNECT_OTHER_PROFILES;
783787
msg.arg1 = CONNECT_HFP_OUTGOING;
784-
sendMessageDelayed(msg, AUTO_CONNECT_DELAY);
788+
sendMessageDelayed(msg, CONNECT_OTHER_PROFILES_DELAY);
785789
}
786790
break;
787791
default:

0 commit comments

Comments
 (0)