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

Commit b1221ae0 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add MULTICHANNEL_GROUP to AidlConversion" into main

parents 6cbb391b e688f630
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -705,6 +705,10 @@ public class AidlConversion {
                aidl.type = AudioDeviceType.OUT_BROADCAST;
                aidl.connection = AudioDeviceDescription.CONNECTION_BT_LE;
                break;
            case AudioSystem.DEVICE_OUT_MULTICHANNEL_GROUP:
                aidl.type = AudioDeviceType.OUT_MULTICHANNEL_GROUP;
                aidl.connection = AudioDeviceDescription.CONNECTION_VIRTUAL;
                break;
            case AudioSystem.DEVICE_IN_BUILTIN_MIC:
                aidl.type = AudioDeviceType.IN_MICROPHONE;
                break;
+22 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.media.audio.common;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
@@ -504,6 +505,27 @@ public final class AidlConversionUnitTests {
        assertEquals(AudioDeviceType.OUT_DEVICE, port.ext.getDevice().device.type.type);
    }

    @Test
    public void testAudioDeviceDescriptionConversion() {
        for (int nativeDeviceType : AudioSystem.DEVICE_OUT_ALL_SET) {
            assertNotEquals(
                    AidlConversion.api2aidl_NativeType_AudioDeviceDescription(nativeDeviceType)
                            .type,
                    AudioDeviceType.NONE);
        }

        for (int nativeDeviceType : AudioSystem.DEVICE_IN_ALL_SET) {
            if (nativeDeviceType == AudioSystem.DEVICE_IN_COMMUNICATION
                    || nativeDeviceType == AudioSystem.DEVICE_IN_AMBIENT) {
                continue;
            }
            assertNotEquals(
                    AidlConversion.api2aidl_NativeType_AudioDeviceDescription(nativeDeviceType)
                            .type,
                    AudioDeviceType.NONE);
        }
    }

    private static AudioFormatDescription createPcm16FormatAidl() {
        final AudioFormatDescription aidl = new AudioFormatDescription();
        aidl.type = AudioFormatType.PCM;