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

Commit 57b29c4b authored by Rongxuan Liu's avatar Rongxuan Liu Committed by Automerger Merge Worker
Browse files

Merge "le_audio: Allow broadcast handover fallback device clear" into main am:...

Merge "le_audio: Allow broadcast handover fallback device clear" into main am: e903f4e3 am: c5988b1f

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



Change-Id: I983eea16bec47d5c53d9ccca61cc295cb321b117
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents a8f8dc3e c5988b1f
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -2255,17 +2255,30 @@ public class LeAudioService extends ProfileService {
                        + ", mExposedActiveDevice: "
                        + mExposedActiveDevice);

        LeAudioGroupDescriptor groupDescriptor = getGroupDescriptor(currentlyActiveGroupId);
        if (isBroadcastActive()
                && currentlyActiveGroupId == LE_AUDIO_GROUP_ID_INVALID
                && mUnicastGroupIdDeactivatedForBroadcastTransition != LE_AUDIO_GROUP_ID_INVALID
                && groupId != LE_AUDIO_GROUP_ID_INVALID) {
                && mUnicastGroupIdDeactivatedForBroadcastTransition != LE_AUDIO_GROUP_ID_INVALID) {
            // If broadcast is ongoing and need to update unicast fallback active group
            // we need to update the cached group id and skip changing the active device
            updateFallbackUnicastGroupIdForBroadcast(groupId);

            /* In case of removing fallback unicast group, monitoring input device should be
             * removed from active devices.
             */
            if (groupDescriptor != null && groupId == LE_AUDIO_GROUP_ID_INVALID) {
                updateActiveDevices(
                        groupId,
                        groupDescriptor.mDirection,
                        AUDIO_DIRECTION_NONE,
                        false,
                        groupDescriptor.mHasFallbackDeviceWhenGettingInactive,
                        false);
            }

            return true;
        }

        LeAudioGroupDescriptor groupDescriptor = getGroupDescriptor(currentlyActiveGroupId);
        if (groupDescriptor != null && groupId == currentlyActiveGroupId) {
            /* Make sure active group is already exposed to audio framework.
             * If not, lets wait for it and don't sent additional intent.
+6 −0
Original line number Diff line number Diff line
@@ -1683,6 +1683,12 @@ public class LeAudioServiceTest {
        // Verify only update the fallback group and not proceed to change active
        assertThat(mService.setActiveDevice(mSingleDevice)).isTrue();
        assertThat(mService.mUnicastGroupIdDeactivatedForBroadcastTransition).isEqualTo(groupId);

        // Verify only update the fallback group to INVALID and not proceed to change active
        assertThat(mService.setActiveDevice(null)).isTrue();
        assertThat(mService.mUnicastGroupIdDeactivatedForBroadcastTransition)
                .isEqualTo(BluetoothLeAudio.GROUP_ID_INVALID);

        verify(mNativeInterface, times(0)).groupSetActive(anyInt());
    }