summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-11-05 12:33:17 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-11-05 12:33:17 +0000
commit34a6c1628f2e1d6cfe1294ec3e387a21f337aaba (patch)
treed97a54e72949294cde1f4fb6482130ac4cb8b3e6
parent50e3ac9499e69e724eb84c2ca84b0ce824df46e1 (diff)
parentb09d367d45642264db40c2b04e12eff793b7c97b (diff)
downloadvoip-android10-mainline-networking-release.tar.gz
Snap for 5988121 from b09d367d45642264db40c2b04e12eff793b7c97b to qt-aml-networking-releaseandroid-mainline-10.0.0_r6android10-mainline-networking-release
Change-Id: I745671a323c4d0feec8e93069cbd6b9b320f40f3
-rw-r--r--src/java/android/net/rtp/AudioGroup.java17
-rw-r--r--src/java/android/net/sip/SipAudioCall.java2
-rw-r--r--src/jni/rtp/Android.bp4
3 files changed, 21 insertions, 2 deletions
diff --git a/src/java/android/net/rtp/AudioGroup.java b/src/java/android/net/rtp/AudioGroup.java
index 15390d3..b9b70f4 100644
--- a/src/java/android/net/rtp/AudioGroup.java
+++ b/src/java/android/net/rtp/AudioGroup.java
@@ -16,7 +16,9 @@
package android.net.rtp;
+import android.annotation.Nullable;
import android.app.ActivityThread;
+import android.content.Context;
import android.media.AudioManager;
import java.util.HashMap;
@@ -96,14 +98,27 @@ public class AudioGroup {
private int mMode = MODE_ON_HOLD;
private long mNative;
+ private Context mContext;
static {
System.loadLibrary("rtp_jni");
}
/**
* Creates an empty AudioGroup.
+ * @deprecated Replaced by {@link #AudioGroup(Context)}
*/
+ @Deprecated
public AudioGroup() {
+ this(null);
+ }
+
+ /**
+ * Creates an empty AudioGroup.
+ * @param context Context used to get package name. If context is null, app ops checks will
+ * fail and as a result {@link AudioStream#join(AudioGroup)} may fail.
+ */
+ public AudioGroup(@Nullable Context context) {
+ mContext = context;
mStreams = new HashMap<AudioStream, Long>();
}
@@ -153,7 +168,7 @@ public class AudioGroup {
long id = nativeAdd(stream.getMode(), stream.getSocket(),
stream.getRemoteAddress().getHostAddress(),
stream.getRemotePort(), codecSpec, stream.getDtmfType(),
- ActivityThread.currentOpPackageName());
+ mContext != null ? mContext.getOpPackageName() : null);
mStreams.put(stream, id);
} catch (NullPointerException e) {
throw new IllegalStateException(e);
diff --git a/src/java/android/net/sip/SipAudioCall.java b/src/java/android/net/sip/SipAudioCall.java
index ea943e9..f1eb35b 100644
--- a/src/java/android/net/sip/SipAudioCall.java
+++ b/src/java/android/net/sip/SipAudioCall.java
@@ -1081,7 +1081,7 @@ public class SipAudioCall {
// don't create an AudioGroup here; doing so will fail if
// there's another AudioGroup out there that's active
} else {
- if (audioGroup == null) audioGroup = new AudioGroup();
+ if (audioGroup == null) audioGroup = new AudioGroup(mContext);
stream.join(audioGroup);
}
setAudioGroupMode();
diff --git a/src/jni/rtp/Android.bp b/src/jni/rtp/Android.bp
index bdd5071..6443900 100644
--- a/src/jni/rtp/Android.bp
+++ b/src/jni/rtp/Android.bp
@@ -26,6 +26,10 @@ cc_library_shared {
"G711Codec.cpp",
"GsmCodec.cpp",
],
+ header_libs: [
+ "libmedia_headers",
+ ],
+
shared_libs: [
"libnativehelper",
"libcutils",