Loading src/com/android/bluetooth/gatt/AppScanStats.java +8 −4 Original line number Original line Diff line number Diff line Loading @@ -44,14 +44,16 @@ import com.android.bluetooth.btservice.BluetoothProto; boolean opportunistic; boolean opportunistic; boolean timeout; boolean timeout; boolean background; boolean background; boolean filtered; int results; int results; public LastScan(long timestamp, long duration, public LastScan(long timestamp, long duration, boolean opportunistic, boolean background, boolean opportunistic, boolean background) { boolean filtered) { this.duration = duration; this.duration = duration; this.timestamp = timestamp; this.timestamp = timestamp; this.opportunistic = opportunistic; this.opportunistic = opportunistic; this.background = background; this.background = background; this.filtered = filtered; this.results = 0; this.results = 0; } } } } Loading Loading @@ -90,7 +92,7 @@ import com.android.bluetooth.btservice.BluetoothProto; results++; results++; } } synchronized void recordScanStart(ScanSettings settings) { synchronized void recordScanStart(ScanSettings settings, boolean filtered) { if (isScanning) if (isScanning) return; return; Loading @@ -98,7 +100,7 @@ import com.android.bluetooth.btservice.BluetoothProto; isScanning = true; isScanning = true; startTime = System.currentTimeMillis(); startTime = System.currentTimeMillis(); LastScan scan = new LastScan(startTime, 0, false, false); LastScan scan = new LastScan(startTime, 0, false, false, filtered); if (settings != null) { if (settings != null) { scan.opportunistic = settings.getScanMode() == ScanSettings.SCAN_MODE_OPPORTUNISTIC; scan.opportunistic = settings.getScanMode() == ScanSettings.SCAN_MODE_OPPORTUNISTIC; scan.background = (settings.getCallbackType() & ScanSettings.CALLBACK_TYPE_FIRST_MATCH) != 0; scan.background = (settings.getCallbackType() & ScanSettings.CALLBACK_TYPE_FIRST_MATCH) != 0; Loading Loading @@ -209,6 +211,7 @@ import com.android.bluetooth.btservice.BluetoothProto; if (lastScan.opportunistic) sb.append(" (Opportunistic)"); if (lastScan.opportunistic) sb.append(" (Opportunistic)"); if (lastScan.background) sb.append(" (Background)"); if (lastScan.background) sb.append(" (Background)"); if (lastScan.timeout) sb.append(" (Forced-Opportunistic)"); if (lastScan.timeout) sb.append(" (Forced-Opportunistic)"); if (lastScan.filtered) sb.append(" (Filtered)"); } } sb.append("\n"); sb.append("\n"); Loading Loading @@ -237,6 +240,7 @@ import com.android.bluetooth.btservice.BluetoothProto; if (scan.opportunistic) sb.append("Opp "); if (scan.opportunistic) sb.append("Opp "); if (scan.background) sb.append("Back "); if (scan.background) sb.append("Back "); if (scan.timeout) sb.append("Forced "); if (scan.timeout) sb.append("Forced "); if (scan.filtered) sb.append("Filter "); sb.append(scan.results + " results"); sb.append(scan.results + " results"); sb.append("\n"); sb.append("\n"); } } Loading src/com/android/bluetooth/gatt/GattService.java +3 −1 Original line number Original line Diff line number Diff line Loading @@ -1350,7 +1350,9 @@ public class GattService extends ProfileService { return; return; } } scanClient.stats = app; scanClient.stats = app; app.recordScanStart(settings); boolean isFilteredScan = (filters != null) && !filters.isEmpty(); app.recordScanStart(settings, isFilteredScan); } } mScanManager.startScan(scanClient); mScanManager.startScan(scanClient); Loading Loading
src/com/android/bluetooth/gatt/AppScanStats.java +8 −4 Original line number Original line Diff line number Diff line Loading @@ -44,14 +44,16 @@ import com.android.bluetooth.btservice.BluetoothProto; boolean opportunistic; boolean opportunistic; boolean timeout; boolean timeout; boolean background; boolean background; boolean filtered; int results; int results; public LastScan(long timestamp, long duration, public LastScan(long timestamp, long duration, boolean opportunistic, boolean background, boolean opportunistic, boolean background) { boolean filtered) { this.duration = duration; this.duration = duration; this.timestamp = timestamp; this.timestamp = timestamp; this.opportunistic = opportunistic; this.opportunistic = opportunistic; this.background = background; this.background = background; this.filtered = filtered; this.results = 0; this.results = 0; } } } } Loading Loading @@ -90,7 +92,7 @@ import com.android.bluetooth.btservice.BluetoothProto; results++; results++; } } synchronized void recordScanStart(ScanSettings settings) { synchronized void recordScanStart(ScanSettings settings, boolean filtered) { if (isScanning) if (isScanning) return; return; Loading @@ -98,7 +100,7 @@ import com.android.bluetooth.btservice.BluetoothProto; isScanning = true; isScanning = true; startTime = System.currentTimeMillis(); startTime = System.currentTimeMillis(); LastScan scan = new LastScan(startTime, 0, false, false); LastScan scan = new LastScan(startTime, 0, false, false, filtered); if (settings != null) { if (settings != null) { scan.opportunistic = settings.getScanMode() == ScanSettings.SCAN_MODE_OPPORTUNISTIC; scan.opportunistic = settings.getScanMode() == ScanSettings.SCAN_MODE_OPPORTUNISTIC; scan.background = (settings.getCallbackType() & ScanSettings.CALLBACK_TYPE_FIRST_MATCH) != 0; scan.background = (settings.getCallbackType() & ScanSettings.CALLBACK_TYPE_FIRST_MATCH) != 0; Loading Loading @@ -209,6 +211,7 @@ import com.android.bluetooth.btservice.BluetoothProto; if (lastScan.opportunistic) sb.append(" (Opportunistic)"); if (lastScan.opportunistic) sb.append(" (Opportunistic)"); if (lastScan.background) sb.append(" (Background)"); if (lastScan.background) sb.append(" (Background)"); if (lastScan.timeout) sb.append(" (Forced-Opportunistic)"); if (lastScan.timeout) sb.append(" (Forced-Opportunistic)"); if (lastScan.filtered) sb.append(" (Filtered)"); } } sb.append("\n"); sb.append("\n"); Loading Loading @@ -237,6 +240,7 @@ import com.android.bluetooth.btservice.BluetoothProto; if (scan.opportunistic) sb.append("Opp "); if (scan.opportunistic) sb.append("Opp "); if (scan.background) sb.append("Back "); if (scan.background) sb.append("Back "); if (scan.timeout) sb.append("Forced "); if (scan.timeout) sb.append("Forced "); if (scan.filtered) sb.append("Filter "); sb.append(scan.results + " results"); sb.append(scan.results + " results"); sb.append("\n"); sb.append("\n"); } } Loading
src/com/android/bluetooth/gatt/GattService.java +3 −1 Original line number Original line Diff line number Diff line Loading @@ -1350,7 +1350,9 @@ public class GattService extends ProfileService { return; return; } } scanClient.stats = app; scanClient.stats = app; app.recordScanStart(settings); boolean isFilteredScan = (filters != null) && !filters.isEmpty(); app.recordScanStart(settings, isFilteredScan); } } mScanManager.startScan(scanClient); mScanManager.startScan(scanClient); Loading