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

Commit 5951129b authored by Ömer Faruk Yılmaz's avatar Ömer Faruk Yılmaz Committed by Omair Kamil
Browse files

Properly set mGattService before other profile services such as

LeAudioService are initialized as they depend on it

Test: atest DckScanTest
Bug: 353110058
Bug: 351943578
Bug: 313335632
Bug: 267361243
Bug: 327503826
Change-Id: Id0a828c7a3e2c90e66049ac6932c04d0eb922496
parent c36e5aea
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -1551,6 +1551,12 @@ public class AdapterService extends Service {
                addProfile(profileService);
                profileService.start();
                profileService.setAvailable(true);
                // With `Flags.scanManagerRefactor()` GattService initialization is pushed back to
                // `ON` state instead of `BLE_ON`. Here we ensure mGattService is set prior
                // to other Profiles using it.
                if (profileId == BluetoothProfile.GATT && Flags.scanManagerRefactor()) {
                    mGattService = GattService.getGattService();
                }
                onProfileServiceStateChanged(profileService, BluetoothAdapter.STATE_ON);
            } else {
                Log.e(
@@ -1997,9 +2003,6 @@ public class AdapterService extends Service {
        mLeAudioService = LeAudioService.getLeAudioService();
        mBassClientService = BassClientService.getBassClientService();
        mBatteryService = BatteryService.getBatteryService();
        if (Flags.scanManagerRefactor()) {
            mGattService = GattService.getGattService();
        }
    }

    @BluetoothAdapter.RfcommListenerResult
+6 −2
Original line number Diff line number Diff line
@@ -92,6 +92,9 @@ public class Config {
        if (Flags.leaudioSynchronizeStart()) {
            PROFILE_SERVICES_AND_FLAGS =
                    new ProfileConfig[] {
                        // Prioritize GattService startup by making it the first Profile to
                        // boot. This resolves dependency issues for some Profiles.
                        new ProfileConfig(GattService.isEnabled(), BluetoothProfile.GATT),
                        new ProfileConfig(A2dpService.isEnabled(), BluetoothProfile.A2DP),
                        new ProfileConfig(A2dpSinkService.isEnabled(), BluetoothProfile.A2DP_SINK),
                        new ProfileConfig(AvrcpTargetService.isEnabled(), BluetoothProfile.AVRCP),
@@ -115,7 +118,6 @@ public class Config {
                        new ProfileConfig(
                                HidDeviceService.isEnabled(), BluetoothProfile.HID_DEVICE),
                        new ProfileConfig(HidHostService.isEnabled(), BluetoothProfile.HID_HOST),
                        new ProfileConfig(GattService.isEnabled(), BluetoothProfile.GATT),
                        new ProfileConfig(TbsService.isEnabled(), BluetoothProfile.LE_CALL_CONTROL),
                        new ProfileConfig(BluetoothMapService.isEnabled(), BluetoothProfile.MAP),
                        new ProfileConfig(
@@ -137,6 +139,9 @@ public class Config {
        } else {
            PROFILE_SERVICES_AND_FLAGS =
                    new ProfileConfig[] {
                        // Prioritize GattService startup by making it the first Profile to
                        // boot. This resolves dependency issues for some Profiles.
                        new ProfileConfig(GattService.isEnabled(), BluetoothProfile.GATT),
                        new ProfileConfig(A2dpService.isEnabled(), BluetoothProfile.A2DP),
                        new ProfileConfig(A2dpSinkService.isEnabled(), BluetoothProfile.A2DP_SINK),
                        new ProfileConfig(AvrcpTargetService.isEnabled(), BluetoothProfile.AVRCP),
@@ -160,7 +165,6 @@ public class Config {
                        new ProfileConfig(
                                HidDeviceService.isEnabled(), BluetoothProfile.HID_DEVICE),
                        new ProfileConfig(HidHostService.isEnabled(), BluetoothProfile.HID_HOST),
                        new ProfileConfig(GattService.isEnabled(), BluetoothProfile.GATT),
                        new ProfileConfig(LeAudioService.isEnabled(), BluetoothProfile.LE_AUDIO),
                        new ProfileConfig(
                                LeAudioService.isBroadcastEnabled(),