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

Commit a75cf68a authored by Andre Eisenbach's avatar Andre Eisenbach
Browse files

Ensure LE scan clients are removed when the related app dies

Use the passed in ScanClient in handleStopScan() to ensure that the
client appDied flag is in the correct state to ensure proper removal of
the client application reference.

Bug: 30681588
Change-Id: I0e0067a8e21ebd5f89870a7054b1f4092fe63ae1
parent 98ee3add
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -253,10 +253,6 @@ public class ScanManager {
            if (client == null) return;

            if (mRegularScanClients.contains(client)) {
                // The ScanClient passed in just holds the clientIf. We retrieve the real client,
                // which may have workSource set.
                client = mScanNative.getRegularScanClient(client.clientIf);
                if (client == null) return;

                mScanNative.stopRegularScan(client);

@@ -270,7 +266,11 @@ public class ScanManager {

                // Update BatteryStats with this workload.
                try {
                    mBatteryStats.noteBleScanStopped(client.workSource);
                    // The ScanClient passed in just holds the clientIf. We retrieve the real client,
                    // which may have workSource set.
                    ScanClient workClient = mScanNative.getRegularScanClient(client.clientIf);
                    if (workClient != null)
                        mBatteryStats.noteBleScanStopped(workClient.workSource);
                } catch (RemoteException e) {
                    /* ignore */
                }