Loading android/app/src/com/android/bluetooth/btservice/PhonePolicy.java +14 −0 Original line number Diff line number Diff line Loading @@ -1020,6 +1020,7 @@ public class PhonePolicy implements AdapterService.BluetoothStateCallback { BatteryService batteryService = mFactory.getBatteryService(); HidHostService hidHostService = mFactory.getHidHostService(); BassClientService bcService = mFactory.getBassClientService(); HapClientService hapClientService = mFactory.getHapClientService(); if (hsService != null) { if (!mHeadsetRetrySet.contains(device) Loading Loading @@ -1120,6 +1121,19 @@ public class PhonePolicy implements AdapterService.BluetoothStateCallback { bcService.connect(device); } } if (Flags.connectHapOnOtherProfileConnect()) { if (hapClientService != null) { List<BluetoothDevice> connectedDevices = hapClientService.getConnectedDevices(); if (!connectedDevices.contains(device) && (hapClientService.getConnectionPolicy(device) == BluetoothProfile.CONNECTION_POLICY_ALLOWED) && (hapClientService.getConnectionState(device) == BluetoothProfile.STATE_DISCONNECTED)) { debugLog("Retrying connection to HAS with device " + device); hapClientService.connect(device); } } } } /** Loading android/app/src/com/android/bluetooth/hap/HapClientService.java +4 −1 Original line number Diff line number Diff line Loading @@ -280,7 +280,10 @@ public class HapClientService extends ProfileService { } } List<BluetoothDevice> getConnectedDevices() { /** * @return A list of connected {@link BluetoothDevice}. */ public List<BluetoothDevice> getConnectedDevices() { synchronized (mStateMachines) { List<BluetoothDevice> devices = new ArrayList<>(); for (HapClientStateMachine sm : mStateMachines.values()) { Loading Loading
android/app/src/com/android/bluetooth/btservice/PhonePolicy.java +14 −0 Original line number Diff line number Diff line Loading @@ -1020,6 +1020,7 @@ public class PhonePolicy implements AdapterService.BluetoothStateCallback { BatteryService batteryService = mFactory.getBatteryService(); HidHostService hidHostService = mFactory.getHidHostService(); BassClientService bcService = mFactory.getBassClientService(); HapClientService hapClientService = mFactory.getHapClientService(); if (hsService != null) { if (!mHeadsetRetrySet.contains(device) Loading Loading @@ -1120,6 +1121,19 @@ public class PhonePolicy implements AdapterService.BluetoothStateCallback { bcService.connect(device); } } if (Flags.connectHapOnOtherProfileConnect()) { if (hapClientService != null) { List<BluetoothDevice> connectedDevices = hapClientService.getConnectedDevices(); if (!connectedDevices.contains(device) && (hapClientService.getConnectionPolicy(device) == BluetoothProfile.CONNECTION_POLICY_ALLOWED) && (hapClientService.getConnectionState(device) == BluetoothProfile.STATE_DISCONNECTED)) { debugLog("Retrying connection to HAS with device " + device); hapClientService.connect(device); } } } } /** Loading
android/app/src/com/android/bluetooth/hap/HapClientService.java +4 −1 Original line number Diff line number Diff line Loading @@ -280,7 +280,10 @@ public class HapClientService extends ProfileService { } } List<BluetoothDevice> getConnectedDevices() { /** * @return A list of connected {@link BluetoothDevice}. */ public List<BluetoothDevice> getConnectedDevices() { synchronized (mStateMachines) { List<BluetoothDevice> devices = new ArrayList<>(); for (HapClientStateMachine sm : mStateMachines.values()) { Loading