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

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

Merge changes Ie441f6a1,Iff255a92 into main am: 8b8cad09

parents c769a74c 8b8cad09
Loading
Loading
Loading
Loading
+17 −6
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ public class LeAudioService extends ProfileService {
    private BluetoothDevice mExposedActiveDevice;
    private LeAudioCodecConfig mLeAudioCodecConfig;
    private final Object mGroupLock = new Object();
    private final FeatureFlags mFeatureFlags = new FeatureFlagsImpl();
    private FeatureFlags mFeatureFlags = new FeatureFlagsImpl();
    ServiceFactory mServiceFactory = new ServiceFactory();

    LeAudioNativeInterface mLeAudioNativeInterface;
@@ -502,6 +502,11 @@ public class LeAudioService extends ProfileService {
        sLeAudioService = instance;
    }

    @VisibleForTesting
    void setFeatureFlags(FeatureFlags featureFlags) {
        mFeatureFlags = featureFlags;
    }

    VolumeControlService getVolumeControlService() {
        if (mVolumeControlService == null) {
            mVolumeControlService = mServiceFactory.getVolumeControlService();
@@ -1843,12 +1848,18 @@ public class LeAudioService extends ProfileService {
                                1);
                break;
            case LeAudioStackEvent.HEALTH_RECOMMENDATION_ACTION_INACTIVATE_GROUP:
                if (mFeatureFlags.leaudioUnicastInactivateDeviceBasedOnContext()) {
                    LeAudioGroupDescriptor groupDescriptor = getGroupDescriptor(groupId);
                    if (groupDescriptor != null && groupDescriptor.mIsActive) {
                    Log.i(TAG, "Group " + groupId + " is inactivated due to blocked media context");
                        Log.i(
                                TAG,
                                "Group "
                                        + groupId
                                        + " is inactivated due to blocked media context");
                        groupDescriptor.mInactivatedDueToContextType = true;
                        setActiveGroupWithDevice(null, true);
                    }
                }
            default:
                break;
        }
+9 −0
Original line number Diff line number Diff line
@@ -62,6 +62,8 @@ import com.android.bluetooth.btservice.AdapterService;
import com.android.bluetooth.btservice.ServiceFactory;
import com.android.bluetooth.btservice.storage.DatabaseManager;
import com.android.bluetooth.csip.CsipSetCoordinatorService;
import com.android.bluetooth.flags.FakeFeatureFlagsImpl;
import com.android.bluetooth.flags.Flags;
import com.android.bluetooth.hap.HapClientService;
import com.android.bluetooth.hfp.HeadsetService;
import com.android.bluetooth.mcp.McpService;
@@ -109,6 +111,7 @@ public class LeAudioServiceTest {
    private boolean onGroupStatusCallbackCalled = false;
    private boolean onGroupCodecConfChangedCallbackCalled = false;
    private BluetoothLeAudioCodecStatus testCodecStatus = null;
    private FakeFeatureFlagsImpl mFakeFlagsImpl;

    private BroadcastReceiver mLeAudioIntentReceiver;

@@ -1538,6 +1541,12 @@ public class LeAudioServiceTest {

    @Test
    public void testMediaContextUnavailableForAWhile() {

        mFakeFlagsImpl = new FakeFeatureFlagsImpl();
        mFakeFlagsImpl.setFlag(Flags.FLAG_LEAUDIO_UNICAST_INACTIVATE_DEVICE_BASED_ON_CONTEXT, true);
        mFakeFlagsImpl.setFlag(Flags.FLAG_AUDIO_ROUTING_CENTRALIZATION, true);
        mService.setFeatureFlags(mFakeFlagsImpl);

        doReturn(true).when(mNativeInterface).connectLeAudio(any(BluetoothDevice.class));
        connectTestDevice(mSingleDevice, testGroupId);

+7 −0
Original line number Diff line number Diff line
@@ -27,3 +27,10 @@ flag {
    description: "Support le audio broadcast audio routing policies"
    bug: "308171251"
}

flag {
    name: "leaudio_unicast_inactivate_device_based_on_context"
    namespace: "bluetooth"
    description: "Inactivate audio device when stream cannot be created due to unavailable context type"
    bug: "313054788"
}