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

Commit 28e39e92 authored by Omair Kamil's avatar Omair Kamil Committed by Gerrit Code Review
Browse files

Merge "Check that ScanClient#stats is not null before dereferencing it." into main

parents a23f9b68 826c31a6
Loading
Loading
Loading
Loading
+15 −6
Original line number Diff line number Diff line
@@ -837,7 +837,9 @@ public class ScanManager {
            if (!mScanNative.isDowngradedScanClient(client)) {
                return false;
            }
            if (client.stats != null) {
                client.stats.setScanDowngrade(client.scannerId, false);
            }
            Log.d(TAG, "revertDowngradeScanModeFromMaxDuty() for " + client);
            if (mScreenOn) {
                return updateScanModeScreenOn(client);
@@ -1349,7 +1351,8 @@ public class ScanManager {
        }

        void regularScanTimeout(ScanClient client) {
            if (!isExemptFromScanTimeout(client) && client.stats.isScanningTooLong()) {
            if (!isExemptFromScanTimeout(client)
                    && (client.stats == null || client.stats.isScanningTooLong())) {
                Log.d(TAG, "regularScanTimeout - client scan time was too long");
                if (client.filters == null || client.filters.isEmpty()) {
                    Log.w(TAG,
@@ -1368,9 +1371,11 @@ public class ScanManager {
                    int maxScanMode = SCAN_MODE_FORCE_DOWNGRADED;
                    client.updateScanMode(getMinScanMode(scanMode, maxScanMode));
                }
                if (client.stats != null) {
                    client.stats.setScanTimeout(client.scannerId);
                    client.stats.recordScanTimeoutCountMetrics();
                }
            }

            // The scan should continue for background scans
            configureRegularScanParams();
@@ -1512,7 +1517,9 @@ public class ScanManager {
                                    TAG,
                                    "No hardware resources for onfound/onlost filter "
                                            + trackEntries);
                            if (client.stats != null) {
                                client.stats.recordTrackingHwFilterNotAvailableCountMetrics();
                            }
                            try {
                                mScanHelper.onScanManagerErrorCallback(
                                        scannerId, ScanCallback.SCAN_FAILED_INTERNAL_ERROR);
@@ -1611,7 +1618,9 @@ public class ScanManager {
                return true;
            }
            if (client.filters.size() > mFilterIndexStack.size()) {
                if (client.stats != null) {
                    client.stats.recordHwFilterNotAvailableCountMetrics();
                }
                return true;
            }
            return false;