Merge "Fix AudioGroupTest on Q" am: 0899d0b658 am: 9fe9f02b01 am: c8c433112d am: df1457564e am: ec7ff05062

Change-Id: Ia6c411ded5be9b1954be36f049d48a305d8ecee1
This commit is contained in:
Treehugger Robot
2020-03-25 11:44:26 +00:00
committed by Automerger Merge Worker

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