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

Commit cf8a9172 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Set state machine thread join timeout" am: b3ef18f9

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

Change-Id: I265a7795217eb92c1a13e76f95238419a3f5f2a7
parents 38e72c89 b3ef18f9
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -88,6 +88,9 @@ public class A2dpService extends ProfileService {
    // Protect setActiveDevice() so all invoked is handled squentially
    private final Object mActiveSwitchingGuard = new Object();

    // Timeout for state machine thread join, to prevent potential ANR.
    private static final int SM_THREAD_JOIN_TIMEOUT_MS = 1000;

    // Upper limit of all A2DP devices: Bonded or Connected
    private static final int MAX_A2DP_STATE_MACHINES = 50;
    // Upper limit of all A2DP devices that are Connected or Connecting
@@ -218,7 +221,7 @@ public class A2dpService extends ProfileService {
        if (mStateMachinesThread != null) {
            try {
                mStateMachinesThread.quitSafely();
                mStateMachinesThread.join();
                mStateMachinesThread.join(SM_THREAD_JOIN_TIMEOUT_MS);
                mStateMachinesThread = null;
            } catch (InterruptedException e) {
                // Do not rethrow as we are shutting down anyway
+4 −1
Original line number Diff line number Diff line
@@ -67,6 +67,9 @@ public class CsipSetCoordinatorService extends ProfileService {
    private static final boolean DBG = false;
    private static final String TAG = "CsipSetCoordinatorService";

    // Timeout for state machine thread join, to prevent potential ANR.
    private static final int SM_THREAD_JOIN_TIMEOUT_MS = 1000;

    // Upper limit of all CSIP devices: Bonded or Connected
    private static final int MAX_CSIS_STATE_MACHINES = 10;
    private static CsipSetCoordinatorService sCsipSetCoordinatorService;
@@ -184,7 +187,7 @@ public class CsipSetCoordinatorService extends ProfileService {
        if (mStateMachinesThread != null) {
            try {
                mStateMachinesThread.quitSafely();
                mStateMachinesThread.join();
                mStateMachinesThread.join(SM_THREAD_JOIN_TIMEOUT_MS);
                mStateMachinesThread = null;
            } catch (InterruptedException e) {
                // Do not rethrow as we are shutting down anyway
+4 −1
Original line number Diff line number Diff line
@@ -61,6 +61,9 @@ public class HearingAidService extends ProfileService {
    private static final boolean DBG = true;
    private static final String TAG = "HearingAidService";

    // Timeout for state machine thread join, to prevent potential ANR.
    private static final int SM_THREAD_JOIN_TIMEOUT_MS = 1000;

    // Upper limit of all HearingAid devices: Bonded or Connected
    private static final int MAX_HEARING_AID_STATE_MACHINES = 10;
    private static HearingAidService sHearingAidService;
@@ -191,7 +194,7 @@ public class HearingAidService extends ProfileService {
        if (mStateMachinesThread != null) {
            try {
                mStateMachinesThread.quitSafely();
                mStateMachinesThread.join();
                mStateMachinesThread.join(SM_THREAD_JOIN_TIMEOUT_MS);
                mStateMachinesThread = null;
            } catch (InterruptedException e) {
                // Do not rethrow as we are shutting down anyway
+4 −1
Original line number Diff line number Diff line
@@ -99,6 +99,9 @@ public class HeadsetService extends ProfileService {
            {BluetoothProfile.STATE_CONNECTING, BluetoothProfile.STATE_CONNECTED};
    private static final int DIALING_OUT_TIMEOUT_MS = 10000;

    // Timeout for state machine thread join, to prevent potential ANR.
    private static final int SM_THREAD_JOIN_TIMEOUT_MS = 1000;

    private int mMaxHeadsetConnections = 1;
    private BluetoothDevice mActiveDevice;
    private AdapterService mAdapterService;
@@ -238,7 +241,7 @@ public class HeadsetService extends ProfileService {
        // Step 2: Stop handler thread
        try {
            mStateMachinesThread.quitSafely();
            mStateMachinesThread.join();
            mStateMachinesThread.join(SM_THREAD_JOIN_TIMEOUT_MS);
            mStateMachinesThread = null;
        } catch (InterruptedException e) {
            // Do not rethrow as we are shutting down anyway
+4 −1
Original line number Diff line number Diff line
@@ -66,6 +66,9 @@ public class LeAudioService extends ProfileService {
    private static final boolean DBG = true;
    private static final String TAG = "LeAudioService";

    // Timeout for state machine thread join, to prevent potential ANR.
    private static final int SM_THREAD_JOIN_TIMEOUT_MS = 1000;

    // Upper limit of all LeAudio devices: Bonded or Connected
    private static final int MAX_LE_AUDIO_STATE_MACHINES = 10;
    private static LeAudioService sLeAudioService;
@@ -262,7 +265,7 @@ public class LeAudioService extends ProfileService {
        if (mStateMachinesThread != null) {
            try {
                mStateMachinesThread.quitSafely();
                mStateMachinesThread.join();
                mStateMachinesThread.join(SM_THREAD_JOIN_TIMEOUT_MS);
                mStateMachinesThread = null;
            } catch (InterruptedException e) {
                // Do not rethrow as we are shutting down anyway
Loading