Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ecd5de90 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add scan result logs." am: 00d81639 am: eb9fe6b5

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1836926

Change-Id: Icf9555e02568fb010ed35e8719cb2e99af50be8d
parents 30d5d442 eb9fe6b5
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -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);
                }
            });