From 9d48f7ed161cb7c201b91f21fb1be36522a562e0 Mon Sep 17 00:00:00 2001 From: Ajay Panicker Date: Fri, 26 Feb 2016 16:03:10 -0800 Subject: [PATCH] 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 --- src/com/android/bluetooth/gatt/ContextMap.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/com/android/bluetooth/gatt/ContextMap.java b/src/com/android/bluetooth/gatt/ContextMap.java index 88a29b15..657f6589 100644 --- a/src/com/android/bluetooth/gatt/ContextMap.java +++ b/src/com/android/bluetooth/gatt/ContextMap.java @@ -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(); -- 2.11.0