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

Commit 94d90894 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes I8cd946e3,I9c124318,Ibcea4ddf,I276108e6,Ib18d07a6 into tm-qpr-dev

* changes:
  Add more configuration for single device with 2 ASEs
  Allow ringtone, media context type as input device for PTS mode
  Add more configurations support for PTS CAP test
  leaudio: Improve some unit tests
  Align the LE audio context type value and naming with SIG assigned number
parents 0f67379d 586547d0
Loading
Loading
Loading
Loading
+19 −15
Original line number Diff line number Diff line
@@ -159,20 +159,20 @@ public class LeAudioService extends ProfileService {
    private final Map<BluetoothDevice, Integer> mDeviceGroupIdMap = new ConcurrentHashMap<>();
    private final Map<BluetoothDevice, Integer> mDeviceAudioLocationMap = new ConcurrentHashMap<>();

    private final int mContextSupportingInputAudio =
            BluetoothLeAudio.CONTEXT_TYPE_COMMUNICATION | BluetoothLeAudio.CONTEXT_TYPE_MAN_MACHINE;

    private final int mContextSupportingOutputAudio = BluetoothLeAudio.CONTEXT_TYPE_COMMUNICATION |
            BluetoothLeAudio.CONTEXT_TYPE_MEDIA |
            BluetoothLeAudio.CONTEXT_TYPE_INSTRUCTIONAL |
            BluetoothLeAudio.CONTEXT_TYPE_ATTENTION_SEEKING |
            BluetoothLeAudio.CONTEXT_TYPE_IMMEDIATE_ALERT |
            BluetoothLeAudio.CONTEXT_TYPE_MAN_MACHINE |
            BluetoothLeAudio.CONTEXT_TYPE_EMERGENCY_ALERT |
            BluetoothLeAudio.CONTEXT_TYPE_RINGTONE |
            BluetoothLeAudio.CONTEXT_TYPE_TV |
            BluetoothLeAudio.CONTEXT_TYPE_LIVE |
            BluetoothLeAudio.CONTEXT_TYPE_GAME;
    private final int mContextSupportingInputAudio = BluetoothLeAudio.CONTEXT_TYPE_CONVERSATIONAL
            | BluetoothLeAudio.CONTEXT_TYPE_VOICE_ASSISTANTS;

    private final int mContextSupportingOutputAudio = BluetoothLeAudio.CONTEXT_TYPE_CONVERSATIONAL
            | BluetoothLeAudio.CONTEXT_TYPE_MEDIA
            | BluetoothLeAudio.CONTEXT_TYPE_GAME
            | BluetoothLeAudio.CONTEXT_TYPE_INSTRUCTIONAL
            | BluetoothLeAudio.CONTEXT_TYPE_VOICE_ASSISTANTS
            | BluetoothLeAudio.CONTEXT_TYPE_LIVE
            | BluetoothLeAudio.CONTEXT_TYPE_SOUND_EFFECTS
            | BluetoothLeAudio.CONTEXT_TYPE_NOTIFICATIONS
            | BluetoothLeAudio.CONTEXT_TYPE_RINGTONE
            | BluetoothLeAudio.CONTEXT_TYPE_ALERTS
            | BluetoothLeAudio.CONTEXT_TYPE_EMERGENCY_ALARM;

    private BroadcastReceiver mBondStateChangedReceiver;
    private BroadcastReceiver mConnectionStateChangedReceiver;
@@ -633,7 +633,11 @@ public class LeAudioService extends ProfileService {
    private Integer getAudioDirectionsFromActiveContextsMap(Integer activeContexts) {
        Integer supportedAudioDirections = 0;

        if ((activeContexts & mContextSupportingInputAudio) != 0) {
        if (((activeContexts & mContextSupportingInputAudio) != 0)
                || (Utils.isPtsTestMode()
                && (activeContexts
                & (BluetoothLeAudio.CONTEXT_TYPE_RINGTONE
                | BluetoothLeAudio.CONTEXT_TYPE_MEDIA)) != 0)) {
            supportedAudioDirections |= AUDIO_DIRECTION_INPUT_BIT;
        }
        if ((activeContexts & mContextSupportingOutputAudio) != 0) {
+2 −2
Original line number Diff line number Diff line
@@ -157,7 +157,7 @@ public class TbsGeneric {
        mTbsGatt = tbsGatt;

        int ccid = ContentControlIdKeeper.acquireCcid(new ParcelUuid(TbsGatt.UUID_GTBS),
                BluetoothLeAudio.CONTEXT_TYPE_COMMUNICATION);
                BluetoothLeAudio.CONTEXT_TYPE_CONVERSATIONAL);
        if (!isCcidValid(ccid)) {
            Log.e(TAG, " CCID is not valid");
            cleanup();
@@ -280,7 +280,7 @@ public class TbsGeneric {
        // Acquire CCID for TbsObject. The CCID is released on remove()
        Bearer bearer = new Bearer(token, callback, uci, uriSchemes, capabilities, providerName,
                technology, ContentControlIdKeeper.acquireCcid(new ParcelUuid(UUID.randomUUID()),
                        BluetoothLeAudio.CONTEXT_TYPE_COMMUNICATION));
                        BluetoothLeAudio.CONTEXT_TYPE_CONVERSATIONAL));
        if (isCcidValid(bearer.ccid)) {
            mBearerList.add(bearer);

+3 −3
Original line number Diff line number Diff line
@@ -1106,7 +1106,7 @@ public class LeAudioServiceTest {
        doReturn(true).when(mNativeInterface).connectLeAudio(any(BluetoothDevice.class));
        connectTestDevice(mSingleDevice, testGroupId);
        injectAudioConfChanged(testGroupId, BluetoothLeAudio.CONTEXT_TYPE_MEDIA |
                         BluetoothLeAudio.CONTEXT_TYPE_COMMUNICATION);
                         BluetoothLeAudio.CONTEXT_TYPE_CONVERSATIONAL);
        injectGroupStatusChange(testGroupId, BluetoothLeAudio.GROUP_STATUS_ACTIVE);

        String action = BluetoothLeAudio.ACTION_LE_AUDIO_ACTIVE_DEVICE_CHANGED;
@@ -1127,7 +1127,7 @@ public class LeAudioServiceTest {

        String action = BluetoothLeAudio.ACTION_LE_AUDIO_ACTIVE_DEVICE_CHANGED;
        Integer contexts = BluetoothLeAudio.CONTEXT_TYPE_MEDIA |
        BluetoothLeAudio.CONTEXT_TYPE_COMMUNICATION;
        BluetoothLeAudio.CONTEXT_TYPE_CONVERSATIONAL;
        injectAudioConfChanged(testGroupId, contexts);

        Intent intent = TestUtils.waitForNoIntent(TIMEOUT_MS, mDeviceQueueMap.get(mSingleDevice));
@@ -1189,7 +1189,7 @@ public class LeAudioServiceTest {
        connectTestDevice(mSingleDevice, testGroupId);

        injectAudioConfChanged(testGroupId, BluetoothLeAudio.CONTEXT_TYPE_MEDIA |
                                 BluetoothLeAudio.CONTEXT_TYPE_COMMUNICATION);
                                 BluetoothLeAudio.CONTEXT_TYPE_CONVERSATIONAL);

        sendEventAndVerifyIntentForGroupStatusChanged(testGroupId, LeAudioStackEvent.GROUP_STATUS_ACTIVE);
        sendEventAndVerifyIntentForGroupStatusChanged(testGroupId, LeAudioStackEvent.GROUP_STATUS_INACTIVE);
+27 −25
Original line number Diff line number Diff line
@@ -233,7 +233,7 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
     * Indicates conversation between humans as, for example, in telephony or video calls.
     * @hide
     */
    public static final int CONTEXT_TYPE_COMMUNICATION = 0x0002;
    public static final int CONTEXT_TYPE_CONVERSATIONAL = 0x0002;

    /**
     * Indicates media as, for example, in music, public radio, podcast or video soundtrack.
@@ -242,64 +242,66 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
    public static final int CONTEXT_TYPE_MEDIA = 0x0004;

    /**
     * Indicates instructional audio as, for example, in navigation, traffic announcements
     * or user guidance.
     * Indicates audio associated with a video gaming.
     * @hide
     */
    public static final int CONTEXT_TYPE_INSTRUCTIONAL = 0x0008;
    public static final int CONTEXT_TYPE_GAME = 0x0008;

    /**
     * Indicates attention seeking audio as, for example, in beeps signalling arrival of a message
     * or keyboard clicks.
     * Indicates instructional audio as, for example, in navigation, announcements or user
     * guidance.
     * @hide
     */
    public static final int CONTEXT_TYPE_ATTENTION_SEEKING = 0x0010;
    public static final int CONTEXT_TYPE_INSTRUCTIONAL = 0x0010;

    /**
     * Indicates immediate alerts as, for example, in a low battery alarm, timer expiry or alarm
     * clock.
     * Indicates man machine communication as, for example, with voice recognition or virtual
     * assistant.
     * @hide
     */
    public static final int CONTEXT_TYPE_IMMEDIATE_ALERT = 0x0020;
    public static final int CONTEXT_TYPE_VOICE_ASSISTANTS = 0x0020;

    /**
     * Indicates man machine communication as, for example, with voice recognition or virtual
     * assistant.
     * Indicates audio associated with a live audio stream.
     *
     * @hide
     */
    public static final int CONTEXT_TYPE_MAN_MACHINE = 0x0040;
    public static final int CONTEXT_TYPE_LIVE = 0x0040;

    /**
     * Indicates emergency alerts as, for example, with fire alarms or other urgent alerts.
     * Indicates sound effects as, for example, in keyboard, touch feedback; menu and user
     * interface sounds, and other system sounds.
     * @hide
     */
    public static final int CONTEXT_TYPE_EMERGENCY_ALERT = 0x0080;
    public static final int CONTEXT_TYPE_SOUND_EFFECTS = 0x0080;

    /**
     * Indicates ringtone as in a call alert.
     * Indicates notification and reminder sounds, attention-seeking audio, for example, in beeps
     * signaling the arrival of a message.
     * @hide
     */
    public static final int CONTEXT_TYPE_RINGTONE = 0x0100;
    public static final int CONTEXT_TYPE_NOTIFICATIONS = 0x0100;


    /**
     * Indicates audio associated with a television program and/or with metadata conforming to the
     * Bluetooth Broadcast TV profile.
     * Indicates ringtone as in a call alert.
     * @hide
     */
    public static final int CONTEXT_TYPE_TV = 0x0200;
    public static final int CONTEXT_TYPE_RINGTONE = 0x0200;

    /**
     * Indicates audio associated with a low latency live audio stream.
     *
     * Indicates alerts and timers, immediate alerts as, for example, in a low battery alarm,
     * timer expiry or alarm clock.
     * @hide
     */
    public static final int CONTEXT_TYPE_LIVE = 0x0400;
    public static final int CONTEXT_TYPE_ALERTS = 0x0400;


    /**
     * Indicates audio associated with a video game stream.
     * Indicates emergency alarm as, for example, with fire alarms or other urgent alerts.
     * @hide
     */
    public static final int CONTEXT_TYPE_GAME = 0x0800;
    public static final int CONTEXT_TYPE_EMERGENCY_ALARM = 0x0800;

    /**
     * This represents an invalid group ID.
+72 −0
Original line number Diff line number Diff line
@@ -167,6 +167,11 @@
            "codec_config_name": "SingleDev_OneChanMonoSnk_16_1",
            "qos_config_name": ["QoS_Config_16_1_2"]
        },
        {
            "name": "DualDev_OneChanMonoSnk_16_2_Server_Preferred",
            "codec_config_name": "DualDev_OneChanMonoSnk_16_2",
            "qos_config_name": ["QoS_Config_Server_Preferred"]
        },
        {
            "name": "SingleDev_OneChanMonoSnk_16_2_Server_Preferred",
            "codec_config_name": "SingleDev_OneChanMonoSnk_16_2",
@@ -1693,6 +1698,73 @@
                }
            ]
        },
        {
            "name": "DualDev_OneChanMonoSnk_16_2",
            "subconfigurations": [
                {
                    "device_cnt": 2,
                    "ase_cnt": 2,
                    "direction": "SINK",
                    "configuration_strategy": "MONO_ONE_CIS_PER_DEVICE",
                    "codec_id": {
                        "coding_format": 6,
                        "vendor_company_id": 0,
                        "vendor_codec_id": 0
                    },
                    "codec_configuration": [
                        {
                            "name": "sampling_frequency",
                            "type": 1,
                            "compound_value": {
                                "value": [
                                    3
                                ]
                            }
                        },
                        {
                            "name": "frame_duration",
                            "type": 2,
                            "compound_value": {
                                "value": [
                                    1
                                ]
                            }
                        },
                        {
                            "name": "audio_channel_allocation",
                            "type": 3,
                            "compound_value": {
                                "value": [
                                    1,
                                    0,
                                    0,
                                    0
                                ]
                            }
                        },
                        {
                            "name": "octets_per_codec_frame",
                            "type": 4,
                            "compound_value": {
                                "value": [
                                    40,
                                    0
                                ]
                            }
                        },
                        {
                            "name": "codec_frame_blocks_per_sdu",
                            "type": 5,
                            "compound_value": {
                                "value": [
                                    1
                                ]
                            }
                        }
                    ]
                }
            ]
        },
        {
            "name": "SingleDev_OneChanMonoSnk_16_2",
            "subconfigurations": [
Loading