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

Commit c1f0025b authored by Jakub Tyszkowski (xWF)'s avatar Jakub Tyszkowski (xWF) Committed by Automerger Merge Worker
Browse files

Merge "Csip: Improve multithreaded access to state machines" into main am:...

Merge "Csip: Improve multithreaded access to state machines" into main am: a8eeda6c am: d51c9d1a

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/3311428



Change-Id: I3537815639cdcb7980adacb9a5b7b4aa81a7023c
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents de21381e d51c9d1a
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ import com.android.bluetooth.btservice.ProfileService;
import com.android.bluetooth.btservice.ServiceFactory;
import com.android.bluetooth.btservice.storage.DatabaseManager;
import com.android.bluetooth.le_audio.LeAudioService;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;

import java.util.ArrayList;
@@ -85,6 +86,7 @@ public class CsipSetCoordinatorService extends ProfileService {

    @VisibleForTesting CsipSetCoordinatorNativeInterface mCsipSetCoordinatorNativeInterface;

    @GuardedBy("mStateMachines")
    private final Map<BluetoothDevice, CsipSetCoordinatorStateMachine> mStateMachines =
            new HashMap<>();

@@ -143,8 +145,11 @@ public class CsipSetCoordinatorService extends ProfileService {
        // Get LE Audio service (can be null)
        mLeAudioService = mServiceFactory.getLeAudioService();

        // Start handler thread for state machines
        synchronized (mStateMachines) {
            mStateMachines.clear();
        }

        // Start handler thread for state machines
        mStateMachinesThread = new HandlerThread("CsipSetCoordinatorService.StateMachines");
        mStateMachinesThread.start();

@@ -1181,9 +1186,11 @@ public class CsipSetCoordinatorService extends ProfileService {
    @Override
    public void dump(StringBuilder sb) {
        super.dump(sb);
        synchronized (mStateMachines) {
            for (CsipSetCoordinatorStateMachine sm : mStateMachines.values()) {
                sm.dump(sb);
            }
        }
        ProfileService.println(sb, "mFoundSetMemberToGroupId: ");
        for (Map.Entry<BluetoothDevice, Integer> entry : mFoundSetMemberToGroupId.entrySet()) {
            ProfileService.println(