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

Commit 9d5f1a22 authored by Rongxuan Liu's avatar Rongxuan Liu Committed by Automerger Merge Worker
Browse files

Merge "Remove the limit of state machines in Bluetooth BLE profiles" into main...

Merge "Remove the limit of state machines in Bluetooth BLE profiles" into main am: c89f484e am: f7f9d40b

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



Change-Id: I9be0a7ead7a592816456b098f6559eaffcf57094
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents a7be6035 f7f9d40b
Loading
Loading
Loading
Loading
+1 −9
Original line number Diff line number Diff line
@@ -55,7 +55,6 @@ public class BatteryService extends ProfileService {
    // Timeout for state machine thread join, to prevent potential ANR.
    private static final int SM_THREAD_JOIN_TIMEOUT_MS = 1_000;

    private static final int MAX_BATTERY_STATE_MACHINES = 10;
    private static BatteryService sBatteryService;
    private AdapterService mAdapterService;
    private DatabaseManager mDatabaseManager;
@@ -411,14 +410,7 @@ public class BatteryService extends ProfileService {
            if (sm != null) {
                return sm;
            }
            // Limit the maximum number of state machines to avoid DoS attack
            if (mStateMachines.size() >= MAX_BATTERY_STATE_MACHINES) {
                Log.e(
                        TAG,
                        "Maximum number of Battery state machines reached: "
                                + MAX_BATTERY_STATE_MACHINES);
                return null;
            }

            Log.d(TAG, "Creating a new state machine for " + device);
            sm = BatteryStateMachine.make(device, this, mStateMachinesThread.getLooper());
            mStateMachines.put(device, sm);
+1 −9
Original line number Diff line number Diff line
@@ -99,7 +99,6 @@ import java.util.concurrent.ConcurrentHashMap;
/** Broacast Assistant Scan Service */
public class BassClientService extends ProfileService {
    private static final String TAG = BassClientService.class.getSimpleName();
    private static final int MAX_BASS_CLIENT_STATE_MACHINES = 10;
    private static final int MAX_ACTIVE_SYNCED_SOURCES_NUM = 4;
    private static final int MAX_BIS_DISCOVERY_TRIES_NUM = 5;

@@ -1160,14 +1159,7 @@ public class BassClientService extends ProfileService {
            if (stateMachine != null) {
                return stateMachine;
            }
            // Limit the maximum number of state machines to avoid DoS attack
            if (mStateMachines.size() >= MAX_BASS_CLIENT_STATE_MACHINES) {
                Log.e(
                        TAG,
                        "Maximum number of Bassclient state machines reached: "
                                + MAX_BASS_CLIENT_STATE_MACHINES);
                return null;
            }

            log("Creating a new state machine for " + device);
            stateMachine =
                    BassObjectsFactory.getInstance()
+1 −10
Original line number Diff line number Diff line
@@ -73,8 +73,6 @@ public class CsipSetCoordinatorService extends ProfileService {
    // 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;

    private Handler mHandler = null;
@@ -904,14 +902,7 @@ public class CsipSetCoordinatorService extends ProfileService {
            if (sm != null) {
                return sm;
            }
            // Limit the maximum number of state machines to avoid DoS attack
            if (mStateMachines.size() >= MAX_CSIS_STATE_MACHINES) {
                Log.e(
                        TAG,
                        "Maximum number of CSIS state machines reached: "
                                + MAX_CSIS_STATE_MACHINES);
                return null;
            }

            Log.d(TAG, "Creating a new state machine for " + device);
            sm =
                    CsipSetCoordinatorStateMachine.make(
+1 −10
Original line number Diff line number Diff line
@@ -75,8 +75,6 @@ public class VolumeControlService extends ProfileService {
    // Timeout for state machine thread join, to prevent potential ANR.
    private static final int SM_THREAD_JOIN_TIMEOUT_MS = 1000;

    // Upper limit of all VolumeControl devices: Bonded or Connected
    private static final int MAX_VC_STATE_MACHINES = 10;
    private static final int LE_AUDIO_MAX_VOL = 255;

    private static VolumeControlService sVolumeControlService;
@@ -1209,14 +1207,7 @@ public class VolumeControlService extends ProfileService {
            if (sm != null) {
                return sm;
            }
            // Limit the maximum number of state machines to avoid DoS attack
            if (mStateMachines.size() >= MAX_VC_STATE_MACHINES) {
                Log.e(
                        TAG,
                        "Maximum number of VolumeControl state machines reached: "
                                + MAX_VC_STATE_MACHINES);
                return null;
            }

            Log.d(TAG, "Creating a new state machine for " + device);
            sm =
                    VolumeControlStateMachine.make(