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

Commit 717fd961 authored by Rongxuan Liu's avatar Rongxuan Liu Committed by Gerrit Code Review
Browse files

Merge changes If13bd4b3,I9506690e into main

* changes:
  Remove leaudio_broadcast_audio_handover_policies flag
  Remove leaudio_broadcast_feature_support flag
parents 7fdc5de9 b81adc25
Loading
Loading
Loading
Loading
+12 −20
Original line number Diff line number Diff line
@@ -24,9 +24,7 @@ import static android.bluetooth.IBluetoothLeAudio.LE_AUDIO_GROUP_ID_INVALID;
import static com.android.bluetooth.flags.Flags.leaudioAllowedContextMask;
import static com.android.bluetooth.flags.Flags.leaudioBigDependsOnAudioState;
import static com.android.bluetooth.flags.Flags.leaudioBroadcastAssistantPeripheralEntrustment;
import static com.android.bluetooth.flags.Flags.leaudioBroadcastAudioHandoverPolicies;
import static com.android.bluetooth.flags.Flags.leaudioBroadcastExtractPeriodicScannerFromStateMachine;
import static com.android.bluetooth.flags.Flags.leaudioBroadcastFeatureSupport;
import static com.android.bluetooth.flags.Flags.leaudioBroadcastMonitorSourceSyncStatus;
import static com.android.bluetooth.flags.Flags.leaudioBroadcastResyncHelper;

@@ -278,8 +276,7 @@ public class BassClientService extends ProfileService {
    }

    public static boolean isEnabled() {
        return leaudioBroadcastFeatureSupport()
                && BluetoothProperties.isProfileBapBroadcastAssistEnabled().orElse(false);
        return BluetoothProperties.isProfileBapBroadcastAssistEnabled().orElse(false);
    }

    private static class SourceSyncRequest {
@@ -3247,7 +3244,6 @@ public class BassClientService extends ProfileService {
    }

    private boolean isAllowedToAddSource() {
        if (leaudioBroadcastAudioHandoverPolicies()) {
        /* Check if should wait for status update */
        if (mUnicastSourceStreamStatus.isEmpty()) {
            /* Assistant was not active, inform about activation */
@@ -3266,10 +3262,6 @@ public class BassClientService extends ProfileService {
        return mUnicastSourceStreamStatus.get() == STATUS_LOCAL_STREAM_SUSPENDED;
    }

        /* Don't block if this is not a handover case */
        return true;
    }

    /** Return true if there is any non primary device receiving broadcast */
    private boolean isAudioSharingModeOn(Integer broadcastId) {
        if (mLocalBroadcastReceivers == null) {
+0 −5
Original line number Diff line number Diff line
@@ -1263,11 +1263,6 @@ public class ActiveDeviceManager implements AdapterService.BluetoothStateCallbac
     * @return {@code true} if is broadcasting audio, {@code false} otherwise
     */
    private boolean isBroadcastingAudio() {
        if (!Flags.leaudioBroadcastAudioHandoverPolicies()) {
            // disable this if feature flag is false
            return false;
        }

        final LeAudioService leAudioService = mFactory.getLeAudioService();
        return leAudioService != null && !leAudioService.getAllBroadcastMetadata().isEmpty();
    }
+12 −32
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import static com.android.bluetooth.bass_client.BassConstants.INVALID_BROADCAST_
import static com.android.bluetooth.flags.Flags.leaudioAllowedContextMask;
import static com.android.bluetooth.flags.Flags.leaudioBigDependsOnAudioState;
import static com.android.bluetooth.flags.Flags.leaudioBroadcastAssistantPeripheralEntrustment;
import static com.android.bluetooth.flags.Flags.leaudioBroadcastFeatureSupport;
import static com.android.bluetooth.flags.Flags.leaudioUseAudioModeListener;
import static com.android.modules.utils.build.SdkLevel.isAtLeastU;

@@ -508,8 +507,7 @@ public class LeAudioService extends ProfileService {
    }

    public static boolean isBroadcastEnabled() {
        return leaudioBroadcastFeatureSupport()
                && BluetoothProperties.isProfileBapBroadcastSourceEnabled().orElse(false);
        return BluetoothProperties.isProfileBapBroadcastSourceEnabled().orElse(false);
    }

    private boolean registerTmap() {
@@ -1177,9 +1175,7 @@ public class LeAudioService extends ProfileService {
                        "Unicast group is active, queueing Broadcast creation, while the Unicast"
                                + " group is deactivated.");
                mCreateBroadcastQueue.add(broadcastSettings);
                if (Flags.leaudioBroadcastAudioHandoverPolicies()) {
                mNativeInterface.setUnicastMonitorMode(LeAudioStackEvent.DIRECTION_SINK, true);
                }
                removeActiveDevice(true);

                return;
@@ -1424,10 +1420,8 @@ public class LeAudioService extends ProfileService {
        }

        Log.d(TAG, "destroyBroadcast");
        if (Flags.leaudioBroadcastAudioHandoverPolicies()) {
        mIsSinkStreamMonitorModeEnabled = false;
        mNativeInterface.setUnicastMonitorMode(LeAudioStackEvent.DIRECTION_SINK, false);
        }
        mLeAudioBroadcasterNativeInterface.destroyBroadcast(broadcastId);
    }

@@ -2237,8 +2231,7 @@ public class LeAudioService extends ProfileService {
            if (notifyAndUpdateInactiveOutDeviceOnly
                    && ((newSupportedAudioDirections & AUDIO_DIRECTION_INPUT_BIT) != 0)) {
                newInDevice = getLeadDeviceForTheGroup(groupId);
            } else if (Flags.leaudioBroadcastAudioHandoverPolicies()
                    && mIsSinkStreamMonitorModeEnabled) {
            } else if (mIsSinkStreamMonitorModeEnabled) {
                mIsSinkStreamMonitorModeEnabled = false;
                mNativeInterface.setUnicastMonitorMode(LeAudioStackEvent.DIRECTION_SINK, false);
            }
@@ -2792,8 +2785,7 @@ public class LeAudioService extends ProfileService {
             */
            boolean leaveConnectedInputDevice = false;
            Integer newDirections = AUDIO_DIRECTION_NONE;
            if (Flags.leaudioBroadcastAudioHandoverPolicies()
                    && isBroadcastReadyToBeReActivated()) {
            if (isBroadcastReadyToBeReActivated()) {
                leaveConnectedInputDevice = true;
                newDirections |= AUDIO_DIRECTION_INPUT_BIT;

@@ -2881,10 +2873,6 @@ public class LeAudioService extends ProfileService {
    }

    private boolean isGroupReceivingBroadcast(int groupId) {
        if (!Flags.leaudioBroadcastAudioHandoverPolicies()) {
            return false;
        }

        BassClientService bassClientService = getBassClientService();
        if (bassClientService == null) {
            return false;
@@ -3897,11 +3885,9 @@ public class LeAudioService extends ProfileService {
            }

            // Notify broadcast assistant
            if (Flags.leaudioBroadcastAudioHandoverPolicies()) {
            if (bassClientService != null) {
                bassClientService.notifyBroadcastStateChanged(descriptor.mState, broadcastId);
            }
            }
        } else if (stackEvent.type == LeAudioStackEvent.EVENT_TYPE_BROADCAST_METADATA_CHANGED) {
            int broadcastId = stackEvent.valueInt1;
            if (stackEvent.broadcastMetadata == null) {
@@ -3943,10 +3929,8 @@ public class LeAudioService extends ProfileService {
            if (mAwaitingBroadcastCreateResponse && !areAllGroupsInNotActiveState()) {
                /* Broadcast would be created once unicast group became inactive */
                Log.i(TAG, "Unicast group is active, deactivate due to pending broadcast");
                if (Flags.leaudioBroadcastAudioHandoverPolicies()) {
                mIsSinkStreamMonitorModeEnabled = true;
                mNativeInterface.setUnicastMonitorMode(LeAudioStackEvent.DIRECTION_SINK, true);
                }
                removeActiveDevice(true);
            }
        } else if (stackEvent.type == LeAudioStackEvent.EVENT_TYPE_NATIVE_INITIALIZED) {
@@ -4289,9 +4273,7 @@ public class LeAudioService extends ProfileService {

        if (!leaudioUseAudioModeListener()) {
            /* For setting inCall mode */
            if (Flags.leaudioBroadcastAudioHandoverPolicies()
                    && inCall
                    && !areBroadcastsAllStopped()) {
            if (inCall && !areBroadcastsAllStopped()) {
                mQueuedInCallValue = Optional.of(true);

                /* Request activation of unicast group */
@@ -4306,9 +4288,7 @@ public class LeAudioService extends ProfileService {

        if (!leaudioUseAudioModeListener()) {
            /* For clearing inCall mode */
            if (Flags.leaudioBroadcastAudioHandoverPolicies()
                    && !inCall
                    && mBroadcastIdDeactivatedForUnicastTransition.isPresent()) {
            if (!inCall && mBroadcastIdDeactivatedForUnicastTransition.isPresent()) {
                handleUnicastStreamStatusChange(
                        LeAudioStackEvent.DIRECTION_SINK,
                        LeAudioStackEvent.STATUS_LOCAL_STREAM_SUSPENDED);
+0 −6
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ import com.android.bluetooth.BluetoothEventLogger;
import com.android.bluetooth.Utils;
import com.android.bluetooth.a2dp.A2dpService;
import com.android.bluetooth.btservice.AdapterService;
import com.android.bluetooth.flags.Flags;
import com.android.bluetooth.hearingaid.HearingAidService;
import com.android.bluetooth.le_audio.LeAudioService;
import com.android.internal.annotations.VisibleForTesting;
@@ -2166,11 +2165,6 @@ public class MediaControlGattService implements MediaControlGattServiceInterface
     * @return {@code true} if is broadcasting audio, {@code false} otherwise
     */
    private boolean isBroadcastActive() {
        if (!Flags.leaudioBroadcastFeatureSupport()) {
            // disable this if feature flag is false
            return false;
        }

        return mLeAudioService != null && mLeAudioService.isBroadcastActive();
    }

+3 −5
Original line number Diff line number Diff line
@@ -1394,12 +1394,10 @@ public class BassClientServiceTest {
    }

    private void handleHandoverSupport() {
        if (Flags.leaudioBroadcastAudioHandoverPolicies()) {
        /* Unicast finished streaming */
        mBassClientService.handleUnicastSourceStreamStatusChange(
                2 /* STATUS_LOCAL_STREAM_SUSPENDED */);
    }
    }

    private void verifyAddSourceForGroup(BluetoothLeBroadcastMetadata meta) {
        // Add broadcast source
Loading