Loading android/app/src/com/android/bluetooth/btservice/AdapterService.java +9 −1 Original line number Diff line number Diff line Loading @@ -229,6 +229,14 @@ public class AdapterService extends Service { private static final int CONTROLLER_ENERGY_UPDATE_TIMEOUT_MILLIS = 30; /** * Connection state bitmask as returned by getConnectionState. */ public static final int CONNECTION_STATE_DISCONNECTED = 0; public static final int CONNECTION_STATE_CONNECTED = 1; public static final int CONNECTION_STATE_ENCRYPTED_BREDR = 2; public static final int CONNECTION_STATE_ENCRYPTED_LE = 4; // Report ID definition public enum BqrQualityReportId { QUALITY_REPORT_ID_MONITOR_MODE(0x01), Loading Loading @@ -2899,7 +2907,7 @@ public class AdapterService extends Service { if (service == null || !Utils.checkConnectPermissionForDataDelivery( service, attributionSource, "AdapterService getConnectionState")) { return BluetoothProfile.STATE_DISCONNECTED; return CONNECTION_STATE_DISCONNECTED; } return service.getConnectionState(device); Loading android/app/src/com/android/bluetooth/btservice/PhonePolicy.java +2 −1 Original line number Diff line number Diff line Loading @@ -653,7 +653,8 @@ class PhonePolicy implements AdapterService.BluetoothStateCallback { } /* Make sure that device is still connected before connecting other profiles */ if (mAdapterService.getConnectionState(device) != BluetoothAdapter.STATE_CONNECTED) { if (mAdapterService.getConnectionState(device) == AdapterService.CONNECTION_STATE_DISCONNECTED) { debugLog("processConnectOtherProfiles: device is not connected anymore " + device); return; } Loading android/app/tests/unit/src/com/android/bluetooth/btservice/PhonePolicyTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -462,7 +462,7 @@ public class PhonePolicyTest { // ACL is connected, lets simulate this. when(mAdapterService.getConnectionState(bondedDevices[0])) .thenReturn(BluetoothProfile.STATE_CONNECTED); .thenReturn(AdapterService.CONNECTION_STATE_ENCRYPTED_BREDR); // We send a connection successful for one profile since the re-connect *only* works if we // have already connected successfully over one of the profiles Loading Loading @@ -507,7 +507,7 @@ public class PhonePolicyTest { // ACL is disconnected just after HEADSET profile got connected and connectOtherProfile // was scheduled. Lets simulate this. when(mAdapterService.getConnectionState(bondedDevices[0])) .thenReturn(BluetoothProfile.STATE_DISCONNECTED); .thenReturn(AdapterService.CONNECTION_STATE_DISCONNECTED); // We send a connection successful for one profile since the re-connect *only* works if we // have already connected successfully over one of the profiles Loading Loading
android/app/src/com/android/bluetooth/btservice/AdapterService.java +9 −1 Original line number Diff line number Diff line Loading @@ -229,6 +229,14 @@ public class AdapterService extends Service { private static final int CONTROLLER_ENERGY_UPDATE_TIMEOUT_MILLIS = 30; /** * Connection state bitmask as returned by getConnectionState. */ public static final int CONNECTION_STATE_DISCONNECTED = 0; public static final int CONNECTION_STATE_CONNECTED = 1; public static final int CONNECTION_STATE_ENCRYPTED_BREDR = 2; public static final int CONNECTION_STATE_ENCRYPTED_LE = 4; // Report ID definition public enum BqrQualityReportId { QUALITY_REPORT_ID_MONITOR_MODE(0x01), Loading Loading @@ -2899,7 +2907,7 @@ public class AdapterService extends Service { if (service == null || !Utils.checkConnectPermissionForDataDelivery( service, attributionSource, "AdapterService getConnectionState")) { return BluetoothProfile.STATE_DISCONNECTED; return CONNECTION_STATE_DISCONNECTED; } return service.getConnectionState(device); Loading
android/app/src/com/android/bluetooth/btservice/PhonePolicy.java +2 −1 Original line number Diff line number Diff line Loading @@ -653,7 +653,8 @@ class PhonePolicy implements AdapterService.BluetoothStateCallback { } /* Make sure that device is still connected before connecting other profiles */ if (mAdapterService.getConnectionState(device) != BluetoothAdapter.STATE_CONNECTED) { if (mAdapterService.getConnectionState(device) == AdapterService.CONNECTION_STATE_DISCONNECTED) { debugLog("processConnectOtherProfiles: device is not connected anymore " + device); return; } Loading
android/app/tests/unit/src/com/android/bluetooth/btservice/PhonePolicyTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -462,7 +462,7 @@ public class PhonePolicyTest { // ACL is connected, lets simulate this. when(mAdapterService.getConnectionState(bondedDevices[0])) .thenReturn(BluetoothProfile.STATE_CONNECTED); .thenReturn(AdapterService.CONNECTION_STATE_ENCRYPTED_BREDR); // We send a connection successful for one profile since the re-connect *only* works if we // have already connected successfully over one of the profiles Loading Loading @@ -507,7 +507,7 @@ public class PhonePolicyTest { // ACL is disconnected just after HEADSET profile got connected and connectOtherProfile // was scheduled. Lets simulate this. when(mAdapterService.getConnectionState(bondedDevices[0])) .thenReturn(BluetoothProfile.STATE_DISCONNECTED); .thenReturn(AdapterService.CONNECTION_STATE_DISCONNECTED); // We send a connection successful for one profile since the re-connect *only* works if we // have already connected successfully over one of the profiles Loading