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

Commit 015ab24c authored by Mehmet Murat Sevim's avatar Mehmet Murat Sevim Committed by Md Shahriar Hossain Sajib
Browse files

Add scan result logs.

Some GMSCore modules are missing some scan result despite the peer
device is discovered by the Android BT stack. These logs will help debug
such problems.

Bug: 154942993
Bug: 199827901
Test: IOP and BCST
Tag: #stability

Change-Id: I6bd98df09ea2beb695aa9b4ac63bde307e77b182
(cherry picked from commit db952a889cd494e20836dbfef47c60e79f7990a9)
parent f2ab01c0
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);
                }
            });