Merge "Fix AudioGroupTest on Q"

This commit is contained in:
Treehugger Robot
2020-03-25 10:09:54 +00:00
committed by Gerrit Code Review

View File

@@ -21,9 +21,12 @@ import android.net.rtp.AudioCodec;
import android.net.rtp.AudioGroup;
import android.net.rtp.AudioStream;
import android.net.rtp.RtpStream;
import android.os.Build;
import android.platform.test.annotations.AppModeFull;
import android.test.AndroidTestCase;
import androidx.core.os.BuildCompat;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
@@ -62,7 +65,10 @@ public class AudioGroupTest extends AndroidTestCase {
mSocketB.connect(mStreamB.getLocalAddress(), mStreamB.getLocalPort());
mStreamB.associate(mSocketB.getLocalAddress(), mSocketB.getLocalPort());
mGroup = new AudioGroup(mContext);
// BuildCompat.isAtLeastR is documented to return false on release SDKs (including R)
mGroup = Build.VERSION.SDK_INT > Build.VERSION_CODES.Q || BuildCompat.isAtLeastR()
? new AudioGroup(mContext)
: new AudioGroup(); // Constructor with context argument was introduced in R
}
@Override