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

Commit f2ea696d authored by Liang Li's avatar Liang Li Committed by lianglli
Browse files

Check if client.stats is null before calling AppScanStats.recordScanRadioStart

Also add null status check for client.stats before setting the value for client.stats.isAppDead

Bug: 326310753
Bug: 331624239
Bug: 328303508
Test: m com.android.btservices
Change-Id: I7055b428f686d9419b1e6309a2e74a4e439acaa4
parent 86f579fb
Loading
Loading
Loading
Loading
+14 −12
Original line number Diff line number Diff line
@@ -1085,7 +1085,8 @@ public class ScanManager {
                    mNativeInterface.gattSetScanParameters(
                            client.scannerId, scanInterval, scanWindow, scanPhyMask);
                    mNativeInterface.gattClientScan(true);
                    if (!AppScanStats.recordScanRadioStart(
                    if (client.stats != null
                            && !AppScanStats.recordScanRadioStart(
                                    client.scanModeApp,
                                    client.scannerId,
                                    client.stats,
@@ -1130,7 +1131,8 @@ public class ScanManager {
                Log.d(TAG, "start gattClientScanNative from startRegularScan()");
                mNativeInterface.gattClientScan(true);
                if (!Flags.bleScanAdvMetricsRedesign()) {
                    if (!AppScanStats.recordScanRadioStart(
                    if (client.stats != null
                            && !AppScanStats.recordScanRadioStart(
                                    client.settings.getScanMode(),
                                    client.scannerId,
                                    client.stats,
+6 −2
Original line number Diff line number Diff line
@@ -587,7 +587,9 @@ public class TransitionalScanHelper {
            return;
        }
        client.appDied = true;
        if (client.stats != null) {
            client.stats.isAppDead = true;
        }
        stopScanInternal(client.scannerId);
    }

@@ -1474,7 +1476,9 @@ public class TransitionalScanHelper {
                    handleDeadScanClient(client);
                } else {
                    client.appDied = true;
                    if (client.stats != null) {
                        client.stats.isAppDead = true;
                    }
                    stopScanInternal(client.scannerId);
                }
            }