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

Commit e084f3e8 authored by Aritra Sen's avatar Aritra Sen
Browse files

Add metric to measure connection change latency metric observed for the system.

Bug: 296932947
Test: m -j $(nproc)
Change-Id: I7e5b44097f54b70a316f30a48b6a82dfac7b52ce
parent 1785dcf8
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -90,6 +90,7 @@ class AdapterProperties {
    private static final long DEFAULT_DISCOVERY_TIMEOUT_MS = 12800;
    @VisibleForTesting static final int BLUETOOTH_NAME_MAX_LENGTH_BYTES = 248;
    private static final int BD_ADDR_LEN = 6; // in bytes
    private static final int SYSTEM_CONNECTION_LATENCY_METRIC = 65536;

    private volatile String mName;
    private volatile byte[] mAddress;
@@ -779,6 +780,15 @@ class AdapterProperties {
                    + BluetoothProfile.getProfileName(profile)
                    + ", device=" + device + ", " + prevState + " -> " + state);
        }
        BluetoothStatsLog.write(
                BluetoothStatsLog.BLUETOOTH_CONNECTION_STATE_CHANGED,
                state,
                0 /* deprecated */,
                profile,
                mService.obfuscateAddress(device),
                mService.getMetricId(device),
                0,
                SYSTEM_CONNECTION_LATENCY_METRIC);
        if (!validateProfileConnectionState(state) || !validateProfileConnectionState(prevState)) {
            // Previously, an invalid state was broadcast anyway,
            // with the invalid state converted to -1 in the intent.