Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 44acf911 authored by Rongxuan Liu's avatar Rongxuan Liu Committed by Automerger Merge Worker
Browse files

Merge "Unify the use of getConnectionState return value" into main am: f4ab12ef am: d6e0843b

parents b6d9fa54 d6e0843b
Loading
Loading
Loading
Loading
+1 −9
Original line number Diff line number Diff line
@@ -243,14 +243,6 @@ 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),
@@ -2948,7 +2940,7 @@ public class AdapterService extends Service {
            if (service == null
                    || !Utils.checkConnectPermissionForDataDelivery(
                            service, attributionSource, "AdapterService getConnectionState")) {
                return CONNECTION_STATE_DISCONNECTED;
                return BluetoothDevice.CONNECTION_STATE_DISCONNECTED;
            }

            return service.getConnectionState(device);
+1 −1
Original line number Diff line number Diff line
@@ -654,7 +654,7 @@ class PhonePolicy implements AdapterService.BluetoothStateCallback {

        /* Make sure that device is still connected before connecting other profiles */
        if (mAdapterService.getConnectionState(device)
                == AdapterService.CONNECTION_STATE_DISCONNECTED) {
                == BluetoothDevice.CONNECTION_STATE_DISCONNECTED) {
            debugLog("processConnectOtherProfiles: device is not connected anymore " + device);
            return;
        }
+2 −2
Original line number Diff line number Diff line
@@ -462,7 +462,7 @@ public class PhonePolicyTest {

        // ACL is connected, lets simulate this.
        when(mAdapterService.getConnectionState(bondedDevices[0]))
                .thenReturn(AdapterService.CONNECTION_STATE_ENCRYPTED_BREDR);
                .thenReturn(BluetoothDevice.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
@@ -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(AdapterService.CONNECTION_STATE_DISCONNECTED);
                .thenReturn(BluetoothDevice.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
+22 −5
Original line number Diff line number Diff line
@@ -99,12 +99,29 @@ public final class BluetoothDevice implements Parcelable, Attributable {
    private static final boolean DBG = false;

    /**
     * Connection state bitmask as returned by getConnectionState.
     * Connection state bitmask disconnected bit as returned by getConnectionState.
     *
     * @hide
     */
    public static final int CONNECTION_STATE_DISCONNECTED = 0;
    /**
     * Connection state bitmask connected bit as returned by getConnectionState.
     *
     * @hide
     */
    public static final int CONNECTION_STATE_CONNECTED = 1;
    /**
     * Connection state bitmask encrypted BREDR bit as returned by getConnectionState.
     *
     * @hide
     */
    public static final int CONNECTION_STATE_ENCRYPTED_BREDR = 2;
    /**
     * Connection state bitmask encrypted LE bit as returned by getConnectionState.
     *
     * @hide
     */
    private static final int CONNECTION_STATE_DISCONNECTED = 0;
    private static final int CONNECTION_STATE_CONNECTED = 1;
    private static final int CONNECTION_STATE_ENCRYPTED_BREDR = 2;
    private static final int CONNECTION_STATE_ENCRYPTED_LE = 4;
    public static final int CONNECTION_STATE_ENCRYPTED_LE = 4;

    /**
     * Sentinel error value for this class. Guaranteed to not equal any other