Merge "Add scan result logs."

This commit is contained in:
Treehugger Robot
2021-12-16 04:29:41 +00:00
committed by Gerrit Code Review

View File

@@ -514,16 +514,27 @@ public final class BluetoothLeScanner {
@Override
public void onScanResult(final ScanResult scanResult) {
Attributable.setAttributionSource(scanResult, mAttributionSource);
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "onScanResult() - mScannerId=" + mScannerId);
}
if (VDBG) Log.d(TAG, "onScanResult() - " + scanResult.toString());
// Check null in case the scan has been stopped
synchronized (this) {
if (mScannerId <= 0) return;
if (mScannerId <= 0) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "Ignoring result as scan stopped.");
}
return;
};
}
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "onScanResult() - handler run");
}
mScanCallback.onScanResult(ScanSettings.CALLBACK_TYPE_ALL_MATCHES, scanResult);
}
});