Loading android/app/src/com/android/bluetooth/btservice/Config.java +95 −30 Original line number Diff line number Diff line Loading @@ -86,36 +86,101 @@ public class Config { }; /** List of profile services with the profile-supported resource flag and bit mask. */ private static final ProfileConfig[] PROFILE_SERVICES_AND_FLAGS = { private static final ProfileConfig[] PROFILE_SERVICES_AND_FLAGS; static { if (Flags.leaudioSynchronizeStart()) { PROFILE_SERVICES_AND_FLAGS = new ProfileConfig[] { new ProfileConfig(A2dpService.isEnabled(), BluetoothProfile.A2DP), new ProfileConfig(A2dpSinkService.isEnabled(), BluetoothProfile.A2DP_SINK), new ProfileConfig(AvrcpTargetService.isEnabled(), BluetoothProfile.AVRCP), new ProfileConfig(AvrcpControllerService.isEnabled(), BluetoothProfile.AVRCP_CONTROLLER), new ProfileConfig( BassClientService.isEnabled(), BluetoothProfile.LE_AUDIO_BROADCAST_ASSISTANT), AvrcpControllerService.isEnabled(), BluetoothProfile.AVRCP_CONTROLLER), new ProfileConfig( BassClientService.isEnabled(), BluetoothProfile.LE_AUDIO_BROADCAST_ASSISTANT), new ProfileConfig(BatteryService.isEnabled(), BluetoothProfile.BATTERY), new ProfileConfig( CsipSetCoordinatorService.isEnabled(), BluetoothProfile.CSIP_SET_COORDINATOR), new ProfileConfig(HapClientService.isEnabled(), BluetoothProfile.HAP_CLIENT), CsipSetCoordinatorService.isEnabled(), BluetoothProfile.CSIP_SET_COORDINATOR), new ProfileConfig( HapClientService.isEnabled(), BluetoothProfile.HAP_CLIENT), new ProfileConfig(HeadsetService.isEnabled(), BluetoothProfile.HEADSET), new ProfileConfig(HeadsetClientService.isEnabled(), BluetoothProfile.HEADSET_CLIENT), new ProfileConfig(HearingAidService.isEnabled(), BluetoothProfile.HEARING_AID), new ProfileConfig(HidDeviceService.isEnabled(), BluetoothProfile.HID_DEVICE), new ProfileConfig( HeadsetClientService.isEnabled(), BluetoothProfile.HEADSET_CLIENT), new ProfileConfig( HearingAidService.isEnabled(), BluetoothProfile.HEARING_AID), 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( MapClientService.isEnabled(), BluetoothProfile.MAP_CLIENT), new ProfileConfig(McpService.isEnabled(), BluetoothProfile.MCP_SERVER), new ProfileConfig(BluetoothOppService.isEnabled(), BluetoothProfile.OPP), new ProfileConfig(PanService.isEnabled(), BluetoothProfile.PAN), new ProfileConfig(BluetoothPbapService.isEnabled(), BluetoothProfile.PBAP), new ProfileConfig( PbapClientService.isEnabled(), BluetoothProfile.PBAP_CLIENT), new ProfileConfig(SapService.isEnabled(), BluetoothProfile.SAP), new ProfileConfig( VolumeControlService.isEnabled(), BluetoothProfile.VOLUME_CONTROL), new ProfileConfig(LeAudioService.isEnabled(), BluetoothProfile.LE_AUDIO), new ProfileConfig(LeAudioService.isBroadcastEnabled(), BluetoothProfile.LE_AUDIO_BROADCAST), new ProfileConfig( LeAudioService.isBroadcastEnabled(), BluetoothProfile.LE_AUDIO_BROADCAST), }; } else { PROFILE_SERVICES_AND_FLAGS = new ProfileConfig[] { new ProfileConfig(A2dpService.isEnabled(), BluetoothProfile.A2DP), new ProfileConfig(A2dpSinkService.isEnabled(), BluetoothProfile.A2DP_SINK), new ProfileConfig(AvrcpTargetService.isEnabled(), BluetoothProfile.AVRCP), new ProfileConfig( AvrcpControllerService.isEnabled(), BluetoothProfile.AVRCP_CONTROLLER), new ProfileConfig( BassClientService.isEnabled(), BluetoothProfile.LE_AUDIO_BROADCAST_ASSISTANT), new ProfileConfig(BatteryService.isEnabled(), BluetoothProfile.BATTERY), new ProfileConfig( CsipSetCoordinatorService.isEnabled(), BluetoothProfile.CSIP_SET_COORDINATOR), new ProfileConfig( HapClientService.isEnabled(), BluetoothProfile.HAP_CLIENT), new ProfileConfig(HeadsetService.isEnabled(), BluetoothProfile.HEADSET), new ProfileConfig( HeadsetClientService.isEnabled(), BluetoothProfile.HEADSET_CLIENT), new ProfileConfig( HearingAidService.isEnabled(), BluetoothProfile.HEARING_AID), 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(), BluetoothProfile.LE_AUDIO_BROADCAST), new ProfileConfig(TbsService.isEnabled(), BluetoothProfile.LE_CALL_CONTROL), new ProfileConfig(BluetoothMapService.isEnabled(), BluetoothProfile.MAP), new ProfileConfig(MapClientService.isEnabled(), BluetoothProfile.MAP_CLIENT), new ProfileConfig( MapClientService.isEnabled(), BluetoothProfile.MAP_CLIENT), new ProfileConfig(McpService.isEnabled(), BluetoothProfile.MCP_SERVER), new ProfileConfig(BluetoothOppService.isEnabled(), BluetoothProfile.OPP), new ProfileConfig(PanService.isEnabled(), BluetoothProfile.PAN), new ProfileConfig(BluetoothPbapService.isEnabled(), BluetoothProfile.PBAP), new ProfileConfig(PbapClientService.isEnabled(), BluetoothProfile.PBAP_CLIENT), new ProfileConfig( PbapClientService.isEnabled(), BluetoothProfile.PBAP_CLIENT), new ProfileConfig(SapService.isEnabled(), BluetoothProfile.SAP), new ProfileConfig(VolumeControlService.isEnabled(), BluetoothProfile.VOLUME_CONTROL), new ProfileConfig( VolumeControlService.isEnabled(), BluetoothProfile.VOLUME_CONTROL), }; } } /** A test function to allow for dynamic enabled */ @VisibleForTesting Loading android/app/src/com/android/bluetooth/le_audio/LeAudioService.java +14 −4 Original line number Diff line number Diff line Loading @@ -478,12 +478,20 @@ public class LeAudioService extends ProfileService { // Setup codec config mLeAudioCodecConfig = new LeAudioCodecConfig(this); if (!Flags.leaudioSynchronizeStart()) { // Delay the call to init by posting it. This ensures TBS and MCS are fully initialized // before we start accepting connections mHandler.post(this::init); return; } mNativeInterface.init(mLeAudioCodecConfig.getCodecConfigOffloading()); if (leaudioUseAudioModeListener()) { mAudioManager.addOnModeChangedListener(getMainExecutor(), mAudioModeChangeListener); } } // TODO: b/341385684 -- Delete the init method as it has been inlined in start private void init() { if (!isAvailable()) { Log.e(TAG, " Service disabled before init"); Loading Loading @@ -520,7 +528,9 @@ public class LeAudioService extends ProfileService { clearBroadcastTimeoutCallback(); if (!Flags.leaudioSynchronizeStart()) { mHandler.removeCallbacks(this::init); } removeActiveDevice(false); if (mTmapGattServer == null) { Loading android/app/src/com/android/bluetooth/mcp/McpService.java +5 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.util.Log; import com.android.bluetooth.Utils; import com.android.bluetooth.btservice.ProfileService; import com.android.bluetooth.flags.Flags; import com.android.bluetooth.le_audio.LeAudioService; import com.android.internal.annotations.VisibleForTesting; Loading Loading @@ -99,6 +100,10 @@ public class McpService extends ProfileService { // Mark service as started setMcpService(this); if (Flags.leaudioSynchronizeStart()) { mGmcs.init(); return; } mHandler.post( () -> { if (isAvailable()) { Loading Loading
android/app/src/com/android/bluetooth/btservice/Config.java +95 −30 Original line number Diff line number Diff line Loading @@ -86,36 +86,101 @@ public class Config { }; /** List of profile services with the profile-supported resource flag and bit mask. */ private static final ProfileConfig[] PROFILE_SERVICES_AND_FLAGS = { private static final ProfileConfig[] PROFILE_SERVICES_AND_FLAGS; static { if (Flags.leaudioSynchronizeStart()) { PROFILE_SERVICES_AND_FLAGS = new ProfileConfig[] { new ProfileConfig(A2dpService.isEnabled(), BluetoothProfile.A2DP), new ProfileConfig(A2dpSinkService.isEnabled(), BluetoothProfile.A2DP_SINK), new ProfileConfig(AvrcpTargetService.isEnabled(), BluetoothProfile.AVRCP), new ProfileConfig(AvrcpControllerService.isEnabled(), BluetoothProfile.AVRCP_CONTROLLER), new ProfileConfig( BassClientService.isEnabled(), BluetoothProfile.LE_AUDIO_BROADCAST_ASSISTANT), AvrcpControllerService.isEnabled(), BluetoothProfile.AVRCP_CONTROLLER), new ProfileConfig( BassClientService.isEnabled(), BluetoothProfile.LE_AUDIO_BROADCAST_ASSISTANT), new ProfileConfig(BatteryService.isEnabled(), BluetoothProfile.BATTERY), new ProfileConfig( CsipSetCoordinatorService.isEnabled(), BluetoothProfile.CSIP_SET_COORDINATOR), new ProfileConfig(HapClientService.isEnabled(), BluetoothProfile.HAP_CLIENT), CsipSetCoordinatorService.isEnabled(), BluetoothProfile.CSIP_SET_COORDINATOR), new ProfileConfig( HapClientService.isEnabled(), BluetoothProfile.HAP_CLIENT), new ProfileConfig(HeadsetService.isEnabled(), BluetoothProfile.HEADSET), new ProfileConfig(HeadsetClientService.isEnabled(), BluetoothProfile.HEADSET_CLIENT), new ProfileConfig(HearingAidService.isEnabled(), BluetoothProfile.HEARING_AID), new ProfileConfig(HidDeviceService.isEnabled(), BluetoothProfile.HID_DEVICE), new ProfileConfig( HeadsetClientService.isEnabled(), BluetoothProfile.HEADSET_CLIENT), new ProfileConfig( HearingAidService.isEnabled(), BluetoothProfile.HEARING_AID), 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( MapClientService.isEnabled(), BluetoothProfile.MAP_CLIENT), new ProfileConfig(McpService.isEnabled(), BluetoothProfile.MCP_SERVER), new ProfileConfig(BluetoothOppService.isEnabled(), BluetoothProfile.OPP), new ProfileConfig(PanService.isEnabled(), BluetoothProfile.PAN), new ProfileConfig(BluetoothPbapService.isEnabled(), BluetoothProfile.PBAP), new ProfileConfig( PbapClientService.isEnabled(), BluetoothProfile.PBAP_CLIENT), new ProfileConfig(SapService.isEnabled(), BluetoothProfile.SAP), new ProfileConfig( VolumeControlService.isEnabled(), BluetoothProfile.VOLUME_CONTROL), new ProfileConfig(LeAudioService.isEnabled(), BluetoothProfile.LE_AUDIO), new ProfileConfig(LeAudioService.isBroadcastEnabled(), BluetoothProfile.LE_AUDIO_BROADCAST), new ProfileConfig( LeAudioService.isBroadcastEnabled(), BluetoothProfile.LE_AUDIO_BROADCAST), }; } else { PROFILE_SERVICES_AND_FLAGS = new ProfileConfig[] { new ProfileConfig(A2dpService.isEnabled(), BluetoothProfile.A2DP), new ProfileConfig(A2dpSinkService.isEnabled(), BluetoothProfile.A2DP_SINK), new ProfileConfig(AvrcpTargetService.isEnabled(), BluetoothProfile.AVRCP), new ProfileConfig( AvrcpControllerService.isEnabled(), BluetoothProfile.AVRCP_CONTROLLER), new ProfileConfig( BassClientService.isEnabled(), BluetoothProfile.LE_AUDIO_BROADCAST_ASSISTANT), new ProfileConfig(BatteryService.isEnabled(), BluetoothProfile.BATTERY), new ProfileConfig( CsipSetCoordinatorService.isEnabled(), BluetoothProfile.CSIP_SET_COORDINATOR), new ProfileConfig( HapClientService.isEnabled(), BluetoothProfile.HAP_CLIENT), new ProfileConfig(HeadsetService.isEnabled(), BluetoothProfile.HEADSET), new ProfileConfig( HeadsetClientService.isEnabled(), BluetoothProfile.HEADSET_CLIENT), new ProfileConfig( HearingAidService.isEnabled(), BluetoothProfile.HEARING_AID), 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(), BluetoothProfile.LE_AUDIO_BROADCAST), new ProfileConfig(TbsService.isEnabled(), BluetoothProfile.LE_CALL_CONTROL), new ProfileConfig(BluetoothMapService.isEnabled(), BluetoothProfile.MAP), new ProfileConfig(MapClientService.isEnabled(), BluetoothProfile.MAP_CLIENT), new ProfileConfig( MapClientService.isEnabled(), BluetoothProfile.MAP_CLIENT), new ProfileConfig(McpService.isEnabled(), BluetoothProfile.MCP_SERVER), new ProfileConfig(BluetoothOppService.isEnabled(), BluetoothProfile.OPP), new ProfileConfig(PanService.isEnabled(), BluetoothProfile.PAN), new ProfileConfig(BluetoothPbapService.isEnabled(), BluetoothProfile.PBAP), new ProfileConfig(PbapClientService.isEnabled(), BluetoothProfile.PBAP_CLIENT), new ProfileConfig( PbapClientService.isEnabled(), BluetoothProfile.PBAP_CLIENT), new ProfileConfig(SapService.isEnabled(), BluetoothProfile.SAP), new ProfileConfig(VolumeControlService.isEnabled(), BluetoothProfile.VOLUME_CONTROL), new ProfileConfig( VolumeControlService.isEnabled(), BluetoothProfile.VOLUME_CONTROL), }; } } /** A test function to allow for dynamic enabled */ @VisibleForTesting Loading
android/app/src/com/android/bluetooth/le_audio/LeAudioService.java +14 −4 Original line number Diff line number Diff line Loading @@ -478,12 +478,20 @@ public class LeAudioService extends ProfileService { // Setup codec config mLeAudioCodecConfig = new LeAudioCodecConfig(this); if (!Flags.leaudioSynchronizeStart()) { // Delay the call to init by posting it. This ensures TBS and MCS are fully initialized // before we start accepting connections mHandler.post(this::init); return; } mNativeInterface.init(mLeAudioCodecConfig.getCodecConfigOffloading()); if (leaudioUseAudioModeListener()) { mAudioManager.addOnModeChangedListener(getMainExecutor(), mAudioModeChangeListener); } } // TODO: b/341385684 -- Delete the init method as it has been inlined in start private void init() { if (!isAvailable()) { Log.e(TAG, " Service disabled before init"); Loading Loading @@ -520,7 +528,9 @@ public class LeAudioService extends ProfileService { clearBroadcastTimeoutCallback(); if (!Flags.leaudioSynchronizeStart()) { mHandler.removeCallbacks(this::init); } removeActiveDevice(false); if (mTmapGattServer == null) { Loading
android/app/src/com/android/bluetooth/mcp/McpService.java +5 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.util.Log; import com.android.bluetooth.Utils; import com.android.bluetooth.btservice.ProfileService; import com.android.bluetooth.flags.Flags; import com.android.bluetooth.le_audio.LeAudioService; import com.android.internal.annotations.VisibleForTesting; Loading Loading @@ -99,6 +100,10 @@ public class McpService extends ProfileService { // Mark service as started setMcpService(this); if (Flags.leaudioSynchronizeStart()) { mGmcs.init(); return; } mHandler.post( () -> { if (isAvailable()) { Loading