From: Ajay Panicker Date: Sat, 27 Feb 2016 00:03:10 +0000 (-0800) Subject: Fix logic for repeated record scan calls X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=9d48f7ed161cb7c201b91f21fb1be36522a562e0;p=android-x86%2Fpackages-apps-Bluetooth.git 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 --- 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();