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

Commit 0e092797 authored by Rongxuan Liu's avatar Rongxuan Liu Committed by Automerger Merge Worker
Browse files

Merge "leaudio: Enable inband ringtone for broadcast handover case" into main am: d59e15f0

parents 9295a738 d59e15f0
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -2832,7 +2832,12 @@ public class LeAudioService extends ProfileService {
                            + " ringtone supported: "
                            + " ringtone supported: "
                            + ringtoneContextAvailable);
                            + ringtoneContextAvailable);


            boolean isRingtoneEnabled = (groupDescriptor.isActive() && ringtoneContextAvailable);
            /* Enable ringtone for active Unciast group or in broadcast handover mode */
            boolean isRingtoneEnabled =
                    ((groupDescriptor.isActive()
                                    || isPrimaryGroup(groupId)
                                    || isBroadcastReadyToBeReActivated())
                            && ringtoneContextAvailable);


            Log.d(
            Log.d(
                    TAG,
                    TAG,
+8 −1
Original line number Original line Diff line number Diff line
@@ -45,6 +45,7 @@ import com.android.bluetooth.btservice.AdapterService;
import com.android.bluetooth.btservice.ServiceFactory;
import com.android.bluetooth.btservice.ServiceFactory;
import com.android.bluetooth.btservice.storage.DatabaseManager;
import com.android.bluetooth.btservice.storage.DatabaseManager;
import com.android.bluetooth.flags.Flags;
import com.android.bluetooth.flags.Flags;
import com.android.bluetooth.tbs.TbsService;


import org.junit.After;
import org.junit.After;
import org.junit.Assert;
import org.junit.Assert;
@@ -88,6 +89,7 @@ public class LeAudioBroadcastServiceTest {
    @Mock private LeAudioNativeInterface mLeAudioNativeInterface;
    @Mock private LeAudioNativeInterface mLeAudioNativeInterface;
    @Mock private LeAudioTmapGattServer mTmapGattServer;
    @Mock private LeAudioTmapGattServer mTmapGattServer;
    @Mock private BassClientService mBassClientService;
    @Mock private BassClientService mBassClientService;
    @Mock private TbsService mTbsService;
    @Spy private LeAudioObjectsFactory mObjectsFactory = LeAudioObjectsFactory.getInstance();
    @Spy private LeAudioObjectsFactory mObjectsFactory = LeAudioObjectsFactory.getInstance();
    @Spy private ServiceFactory mServiceFactory = new ServiceFactory();
    @Spy private ServiceFactory mServiceFactory = new ServiceFactory();


@@ -215,6 +217,7 @@ public class LeAudioBroadcastServiceTest {


        mService.mAudioManager = mAudioManager;
        mService.mAudioManager = mAudioManager;
        mService.mServiceFactory = mServiceFactory;
        mService.mServiceFactory = mServiceFactory;
        mService.mTbsService = mTbsService;
        when(mServiceFactory.getBassClientService()).thenReturn(mBassClientService);
        when(mServiceFactory.getBassClientService()).thenReturn(mBassClientService);
        // Set up the State Changed receiver
        // Set up the State Changed receiver
        IntentFilter filter = new IntentFilter();
        IntentFilter filter = new IntentFilter();
@@ -725,7 +728,7 @@ public class LeAudioBroadcastServiceTest {
        int direction = 3;
        int direction = 3;
        int snkAudioLocation = 3;
        int snkAudioLocation = 3;
        int srcAudioLocation = 4;
        int srcAudioLocation = 4;
        int availableContexts = 5;
        int availableContexts = 5 + BluetoothLeAudio.CONTEXT_TYPE_RINGTONE;


        /* Initialize native */
        /* Initialize native */
        LeAudioStackEvent stackEvent =
        LeAudioStackEvent stackEvent =
@@ -896,6 +899,8 @@ public class LeAudioBroadcastServiceTest {
        create_event.valueInt2 = LeAudioStackEvent.GROUP_STATUS_ACTIVE;
        create_event.valueInt2 = LeAudioStackEvent.GROUP_STATUS_ACTIVE;
        mService.messageFromNative(create_event);
        mService.messageFromNative(create_event);


        verify(mTbsService, times(1)).setInbandRingtoneSupport(eq(mDevice));

        /* Verify Unicast input and output devices changed from null to mDevice */
        /* Verify Unicast input and output devices changed from null to mDevice */
        verify(mAudioManager, times(2))
        verify(mAudioManager, times(2))
                .handleBluetoothActiveDeviceChanged(
                .handleBluetoothActiveDeviceChanged(
@@ -971,6 +976,8 @@ public class LeAudioBroadcastServiceTest {
        create_event.valueInt1 = broadcastId;
        create_event.valueInt1 = broadcastId;
        create_event.valueInt2 = LeAudioStackEvent.BROADCAST_STATE_STREAMING;
        create_event.valueInt2 = LeAudioStackEvent.BROADCAST_STATE_STREAMING;
        mService.messageFromNative(create_event);
        mService.messageFromNative(create_event);

        verify(mTbsService, times(0)).clearInbandRingtoneSupport(eq(mDevice));
    }
    }


    @Test
    @Test