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

Commit 68a56c0c authored by Yuanru Qian's avatar Yuanru Qian
Browse files

Adding more loggings to further investigate ACL connection issues

Test: locally tested
Bug: N/A
Flag: EXEMPT logging update only
Change-Id: I5315612fbdd6914b51afd1bfef60d6731f78c358
parent 9ebb6cb8
Loading
Loading
Loading
Loading
+28 −7
Original line number Diff line number Diff line
@@ -145,8 +145,8 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
     * The value is reset if a disconnection happens.
     */
    private long mConnectAttempted = -1;
    private boolean isAclConnectedBrEdr = false;
    private boolean isAclConnectedLe = false;
    private boolean mIsAclConnectedBrEdr = false;
    private boolean mIsAclConnectedLe = false;

    // Active device state
    private boolean mIsActiveDeviceA2dp = false;
@@ -1080,7 +1080,9 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
            Log.d(
                    TAG,
                    "onUuidChanged: Time since last connect/manual disconnect="
                            + (SystemClock.elapsedRealtime() - lastConnectAttempted));
                            + (SystemClock.elapsedRealtime() - lastConnectAttempted)
                            + ", last connect attempt: "
                            + mConnectAttempted);
        }

        /*
@@ -1137,21 +1139,40 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
        boolean isUpdatedToConnected = state == BluetoothAdapter.STATE_CONNECTED;
        if (isUpdatedToConnected) {
            // Only update timestamp for the first ACL connection
            if (!isAclConnectedLe && !isAclConnectedBrEdr) {
            if (!mIsAclConnectedLe && !mIsAclConnectedBrEdr) {
                mConnectAttempted = SystemClock.elapsedRealtime();
                if (BluetoothUtils.D) {
                    Log.d(
                            TAG,
                            "onAclStateChanged: device "
                                    + mDevice.getAnonymizedAddress()
                                    + ", connect time is updated: "
                                    + mConnectAttempted
                                    + ", le connection status: "
                                    + mIsAclConnectedLe
                                    + ", br/edr connection status: "
                                    + mIsAclConnectedBrEdr);
                }
            }
        }

        if (transport == BluetoothDevice.TRANSPORT_LE) {
            isAclConnectedLe = isUpdatedToConnected;
            mIsAclConnectedLe = isUpdatedToConnected;
        } else {
            isAclConnectedBrEdr = isUpdatedToConnected;
            mIsAclConnectedBrEdr = isUpdatedToConnected;
        }

        if (!isUpdatedToConnected) {
            // Reset the connection time if both classic and LE are disconnected.
            if (!isAclConnectedLe && !isAclConnectedBrEdr) {
            if (!mIsAclConnectedLe && !mIsAclConnectedBrEdr) {
                mConnectAttempted = -1;
                if (BluetoothUtils.D) {
                    Log.d(
                            TAG,
                            "onAclStateChanged: device "
                                    + mDevice.getAnonymizedAddress()
                                    + ", connect time is reset");
                }
            }
        }
    }