OSDN Git Service

Fix logic for repeated record scan calls
authorAjay Panicker <apanicke@google.com>
Sat, 27 Feb 2016 00:03:10 +0000 (16:03 -0800)
committerAjay Panicker <apanicke@google.com>
Sat, 27 Feb 2016 01:11:10 +0000 (17:11 -0800)
If recordStartScan or recordStopScan is called multiple times,
there are issues where logged values are incorrect.

Bug: 27294154
Change-Id: Ie049e917ae26fec4c50874ed703e404146c15044

src/com/android/bluetooth/gatt/ContextMap.java

index 88a29b1..657f658 100644 (file)
@@ -79,6 +79,9 @@ import com.android.bluetooth.btservice.BluetoothProto;
         }
 
         void recordScanStart(ScanSettings settings) {
+            if (isScanning)
+                return;
+
             this.scansStarted++;
             isScanning = true;
             startTime = System.currentTimeMillis();
@@ -106,6 +109,9 @@ import com.android.bluetooth.btservice.BluetoothProto;
         }
 
         void recordScanStop() {
+            if (!isScanning)
+              return;
+
             this.scansStopped++;
             isScanning = false;
             stopTime = System.currentTimeMillis();