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

Commit 788f683d authored by Yuanru Qian's avatar Yuanru Qian Committed by Android (Google) Code Review
Browse files

Merge "update the timestamp of the connection status based on ACL event update...

Merge "update the timestamp of the connection status based on ACL event update instead of click actions. The current implementation caused discrepancy in different calling apps" into main
parents 0c4aeff0 a39f87da
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -585,6 +585,7 @@ public class BluetoothEventManager {
                    Log.w(TAG, "ActiveDeviceChangedHandler: unknown action " + action);
                    Log.w(TAG, "ActiveDeviceChangedHandler: unknown action " + action);
                    return;
                    return;
            }
            }
            activeDevice.onAclStateChanged(state);
            dispatchAclStateChanged(activeDevice, state);
            dispatchAclStateChanged(activeDevice, state);
        }
        }
    }
    }
+8 −14
Original line number Original line Diff line number Diff line
@@ -390,7 +390,6 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
    }
    }


    public void disconnect() {
    public void disconnect() {
        mConnectAttempted = -1;
        synchronized (mProfileLock) {
        synchronized (mProfileLock) {
            if (getGroupId() != BluetoothCsipSetCoordinator.GROUP_ID_INVALID) {
            if (getGroupId() != BluetoothCsipSetCoordinator.GROUP_ID_INVALID) {
                for (CachedBluetoothDevice member : getMemberDevice()) {
                for (CachedBluetoothDevice member : getMemberDevice()) {
@@ -442,7 +441,6 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
            return;
            return;
        }
        }


        mConnectAttempted = SystemClock.elapsedRealtime();
        connectDevice();
        connectDevice();
    }
    }


@@ -556,18 +554,6 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
        }
        }
    }
    }


    /**
     * Connect this device to the specified profile.
     *
     * @param profile the profile to use with the remote device
     */
    public void connectProfile(LocalBluetoothProfile profile) {
        mConnectAttempted = SystemClock.elapsedRealtime();
        connectInt(profile);
        // Refresh the UI based on profile.connect() call
        refresh();
    }

    synchronized void connectInt(LocalBluetoothProfile profile) {
    synchronized void connectInt(LocalBluetoothProfile profile) {
        if (!ensurePaired()) {
        if (!ensurePaired()) {
            return;
            return;
@@ -1120,6 +1106,14 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
        }
        }
    }
    }


    void onAclStateChanged(int state) {
        if (state == BluetoothAdapter.STATE_DISCONNECTED) {
            mConnectAttempted = -1;
        } else {
            mConnectAttempted = SystemClock.elapsedRealtime();
        }
    }

    public Timestamp getBondTimestamp() {
    public Timestamp getBondTimestamp() {
        return mBondTimestamp;
        return mBondTimestamp;
    }
    }