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

Commit a39f87da authored by yqian's avatar yqian Committed by Yuanru Qian
Browse files

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

Test: locally tested
Bug: b/387228455
Flag: EXEMPT minor fix

Change-Id: I7535302404aaad83dcd72f28331f72ded10001cd
parent bca73325
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -585,6 +585,7 @@ public class BluetoothEventManager {
                    Log.w(TAG, "ActiveDeviceChangedHandler: unknown action " + action);
                    return;
            }
            activeDevice.onAclStateChanged(state);
            dispatchAclStateChanged(activeDevice, state);
        }
    }
+8 −14
Original line number Diff line number Diff line
@@ -390,7 +390,6 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
    }

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

        mConnectAttempted = SystemClock.elapsedRealtime();
        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) {
        if (!ensurePaired()) {
            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() {
        return mBondTimestamp;
    }