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

Commit a09ba5d3 authored by Joseph Pirozzo's avatar Joseph Pirozzo
Browse files

Stop HfpClientConnectionService on shutdown.

Stop the HfpClientConnectionService when shutting down HfpClientService
via the stopService call rather than startService with an extra.  This
eliminates the chance of the service getting leaked.

Bug: 79258377
Test: Cycle bluetooth adapter; runtest bluetooth
Change-Id: I3c07932d06823ebc7ad081b44879b50ce804bb8a
parent 4b4a5c7e
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -116,6 +116,11 @@ public class HeadsetClientService extends ProfileService {
            Log.w(TAG, "stop() called without start()");
            return false;
        }

        // Stop the HfpClientConnectionService.
        Intent stopIntent = new Intent(this, HfpClientConnectionService.class);
        sHeadsetClientService.stopService(stopIntent);

        setHeadsetClientService(null);

        unregisterReceiver(mBroadcastReceiver);
@@ -128,11 +133,6 @@ public class HeadsetClientService extends ProfileService {
            it.remove();
        }

        // Stop the HfpClientConnectionService.
        Intent stopIntent = new Intent(this, HfpClientConnectionService.class);
        stopIntent.putExtra(HFP_CLIENT_STOP_TAG, true);
        startService(stopIntent);

        // Stop the handler thread
        mSmThread.quit();
        mSmThread = null;