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

Commit a89c1892 authored by Sandeep Samdaria's avatar Sandeep Samdaria
Browse files

Disable A2DP source for automotive under certain conditions

Problem: We need to enable the a2dp (source & sink) profiles
on car products. However, directly enabling the profiles w/o
enabling the trunk flags for concurrent support will result
in indeterministic behavior.

Solution: Disable a2dp source profile for automotive builds
only if a2dp sink profile is enabled and concurrent support
for a2dp profiles is not enabled.

Test: m
Bug: 329140775
Bug: 321806163
Change-Id: Icf3cf47f07e24ca75c65a0920dca9d464d5a4d7b
parent b5ebf2c1
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import com.android.bluetooth.avrcpcontroller.AvrcpControllerService;
import com.android.bluetooth.bas.BatteryService;
import com.android.bluetooth.bass_client.BassClientService;
import com.android.bluetooth.csip.CsipSetCoordinatorService;
import com.android.bluetooth.flags.Flags;
import com.android.bluetooth.gatt.GattService;
import com.android.bluetooth.hap.HapClientService;
import com.android.bluetooth.hearingaid.HearingAidService;
@@ -165,6 +166,16 @@ public class Config {
            }
        }

        // TODO: b/321806163 Cleanup post the flag cleanup.
        // Disable A2DP source profile for automotive devices only if sink is enabled and
        // concurrent support is not enabled.
        if (!Flags.a2dpConcurrentSourceSink()
                && Utils.isAutomotive(ctx)
                && A2dpSinkService.isEnabled()) {
            setProfileEnabled(BluetoothProfile.A2DP, false);
            setProfileEnabled(BluetoothProfile.AVRCP, false);
        }

        // Disable ASHA if BLE is not supported on this platform even if the platform enabled ASHA
        // accidentally
        if (!Utils.isBleSupported(ctx)) {