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

Commit a342218e authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Fix concurrency issues on state machine shutdown"

parents 570864b1 adc9ed0f
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -216,8 +216,13 @@ public class A2dpService extends ProfileService {
        }

        if (mStateMachinesThread != null) {
            try {
                mStateMachinesThread.quitSafely();
                mStateMachinesThread.join();
                mStateMachinesThread = null;
            } catch (InterruptedException e) {
                // Do not rethrow as we are shutting down anyway
            }
        }
        // Step 2: Reset maximum number of connected audio devices
        mMaxConnectedAudioDevices = 1;
+7 −2
Original line number Diff line number Diff line
@@ -182,8 +182,13 @@ public class CsipSetCoordinatorService extends ProfileService {
        }

        if (mStateMachinesThread != null) {
            try {
                mStateMachinesThread.quitSafely();
                mStateMachinesThread.join();
                mStateMachinesThread = null;
            } catch (InterruptedException e) {
                // Do not rethrow as we are shutting down anyway
            }
        }

        mDeviceGroupIdMap.clear();
+7 −2
Original line number Diff line number Diff line
@@ -208,8 +208,13 @@ public class HapClientService extends ProfileService {
        mPresetsMap.clear();

        if (mStateMachinesThread != null) {
            try {
                mStateMachinesThread.quitSafely();
                mStateMachinesThread.join();
                mStateMachinesThread = null;
            } catch (InterruptedException e) {
                // Do not rethrow as we are shutting down anyway
            }
        }

        // Clear AdapterService
+7 −2
Original line number Diff line number Diff line
@@ -189,8 +189,13 @@ public class HearingAidService extends ProfileService {
        mHiSyncIdConnectedMap.clear();

        if (mStateMachinesThread != null) {
            try {
                mStateMachinesThread.quitSafely();
                mStateMachinesThread.join();
                mStateMachinesThread = null;
            } catch (InterruptedException e) {
                // Do not rethrow as we are shutting down anyway
            }
        }

        // Clear AdapterService, HearingAidNativeInterface
+8 −2
Original line number Diff line number Diff line
@@ -236,8 +236,14 @@ public class HeadsetService extends ProfileService {
        // Step 3: Destroy system interface
        mSystemInterface.stop();
        // Step 2: Stop handler thread
        try {
            mStateMachinesThread.quitSafely();
            mStateMachinesThread.join();
            mStateMachinesThread = null;
        } catch (InterruptedException e) {
            // Do not rethrow as we are shutting down anyway
        }

        mStateMachinesThreadHandler = null;
        // Step 1: Clear
        synchronized (mStateMachines) {
Loading