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

Commit 5ff01eac authored by Ajay Panicker's avatar Ajay Panicker Committed by Andre Eisenbach
Browse files

Fix logic for repeated record scan calls

If recordStartScan or recordStopScan is called multiple times,
there are issues where logged values are incorrect.

Bug: 27294154
Change-Id: Ie049e917ae26fec4c50874ed703e404146c15044
parent c0c1bcdc
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -79,9 +79,13 @@ import com.android.bluetooth.btservice.BluetoothProto;
        }

        void recordScanStart(ScanSettings settings) {
            if (isScanning)
                return;

            this.scansStarted++;
            isScanning = true;
            startTime = System.currentTimeMillis();

            if (settings != null) {
                isOpportunisticScan = settings.getScanMode() == ScanSettings.SCAN_MODE_OPPORTUNISTIC;
                isBackgroundScan = (settings.getCallbackType() & ScanSettings.CALLBACK_TYPE_FIRST_MATCH) != 0;
@@ -106,6 +110,9 @@ import com.android.bluetooth.btservice.BluetoothProto;
        }

        void recordScanStop() {
            if (!isScanning)
              return;

            this.scansStopped++;
            isScanning = false;
            stopTime = System.currentTimeMillis();