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

Change-Id: I3efa7104b72d573f2a420982a2e4666f10481d4b
This commit is contained in:
Treehugger Robot
2020-03-25 10:49:39 +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