Move offered RTP header extension types API.
Moved from ImsCallProfile to MmtelFeature.
Test: Update CTS tests and unit tests.
Bug: 163085177
Change-Id: I9b16b6b17beb1032469d19a214ada0476376d383
diff --git a/api/system-current.txt b/api/system-current.txt
index 042e2dc..bc39596 100755
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -11802,7 +11802,6 @@
method public int getEmergencyServiceCategories();
method @NonNull public java.util.List<java.lang.String> getEmergencyUrns();
method public android.telephony.ims.ImsStreamMediaProfile getMediaProfile();
- method @NonNull public java.util.Set<android.telephony.ims.RtpHeaderExtensionType> getOfferedRtpHeaderExtensionTypes();
method @NonNull public android.os.Bundle getProprietaryCallExtras();
method public int getRestrictCause();
method public int getServiceType();
@@ -11824,7 +11823,6 @@
method public void setEmergencyServiceCategories(int);
method public void setEmergencyUrns(@NonNull java.util.List<java.lang.String>);
method public void setHasKnownUserIntentEmergency(boolean);
- method public void setOfferedRtpHeaderExtensionTypes(@NonNull java.util.Set<android.telephony.ims.RtpHeaderExtensionType>);
method public void updateCallExtras(android.telephony.ims.ImsCallProfile);
method public void updateCallType(android.telephony.ims.ImsCallProfile);
method public void updateMediaProfile(android.telephony.ims.ImsCallProfile);
@@ -12333,6 +12331,7 @@
public class MmTelFeature extends android.telephony.ims.feature.ImsFeature {
ctor public MmTelFeature();
method public void changeEnabledCapabilities(@NonNull android.telephony.ims.feature.CapabilityChangeRequest, @NonNull android.telephony.ims.feature.ImsFeature.CapabilityCallbackProxy);
+ method public void changeOfferedRtpHeaderExtensionTypes(@NonNull java.util.Set<android.telephony.ims.RtpHeaderExtensionType>);
method @Nullable public android.telephony.ims.ImsCallProfile createCallProfile(int, int);
method @Nullable public android.telephony.ims.stub.ImsCallSessionImplBase createCallSession(@NonNull android.telephony.ims.ImsCallProfile);
method @NonNull public android.telephony.ims.stub.ImsEcbmImplBase getEcbm();
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index f36f4f3..2ebbf6d 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -10684,7 +10684,6 @@
method public int getEmergencyServiceCategories();
method @NonNull public java.util.List<java.lang.String> getEmergencyUrns();
method public android.telephony.ims.ImsStreamMediaProfile getMediaProfile();
- method @NonNull public java.util.Set<android.telephony.ims.RtpHeaderExtensionType> getOfferedRtpHeaderExtensionTypes();
method @NonNull public android.os.Bundle getProprietaryCallExtras();
method public int getRestrictCause();
method public int getServiceType();
@@ -10706,7 +10705,6 @@
method public void setEmergencyServiceCategories(int);
method public void setEmergencyUrns(@NonNull java.util.List<java.lang.String>);
method public void setHasKnownUserIntentEmergency(boolean);
- method public void setOfferedRtpHeaderExtensionTypes(@NonNull java.util.Set<android.telephony.ims.RtpHeaderExtensionType>);
method public void updateCallExtras(android.telephony.ims.ImsCallProfile);
method public void updateCallType(android.telephony.ims.ImsCallProfile);
method public void updateMediaProfile(android.telephony.ims.ImsCallProfile);
@@ -11215,6 +11213,7 @@
public class MmTelFeature extends android.telephony.ims.feature.ImsFeature {
ctor public MmTelFeature();
method public void changeEnabledCapabilities(@NonNull android.telephony.ims.feature.CapabilityChangeRequest, @NonNull android.telephony.ims.feature.ImsFeature.CapabilityCallbackProxy);
+ method public void changeOfferedRtpHeaderExtensionTypes(@NonNull java.util.Set<android.telephony.ims.RtpHeaderExtensionType>);
method @Nullable public android.telephony.ims.ImsCallProfile createCallProfile(int, int);
method @Nullable public android.telephony.ims.stub.ImsCallSessionImplBase createCallSession(@NonNull android.telephony.ims.ImsCallProfile);
method @NonNull public android.telephony.ims.stub.ImsEcbmImplBase getEcbm();
diff --git a/telephony/java/android/telephony/ims/ImsCallProfile.java b/telephony/java/android/telephony/ims/ImsCallProfile.java
index 9a55cec..1b51936 100644
--- a/telephony/java/android/telephony/ims/ImsCallProfile.java
+++ b/telephony/java/android/telephony/ims/ImsCallProfile.java
@@ -450,8 +450,6 @@
/** Indicates if we have known the intent of the user for the call is emergency */
private boolean mHasKnownUserIntentEmergency = false;
- private Set<RtpHeaderExtensionType> mOfferedRtpHeaderExtensionTypes = new ArraySet<>();
-
private Set<RtpHeaderExtensionType> mAcceptedRtpHeaderExtensionTypes = new ArraySet<>();
/**
@@ -692,7 +690,6 @@
out.writeBoolean(mHasKnownUserIntentEmergency);
out.writeInt(mRestrictCause);
out.writeInt(mCallerNumberVerificationStatus);
- out.writeArray(mOfferedRtpHeaderExtensionTypes.toArray());
out.writeArray(mAcceptedRtpHeaderExtensionTypes.toArray());
}
@@ -708,9 +705,6 @@
mHasKnownUserIntentEmergency = in.readBoolean();
mRestrictCause = in.readInt();
mCallerNumberVerificationStatus = in.readInt();
- Object[] offered = in.readArray(RtpHeaderExtensionType.class.getClassLoader());
- mOfferedRtpHeaderExtensionTypes = Arrays.stream(offered)
- .map(o -> (RtpHeaderExtensionType) o).collect(Collectors.toSet());
Object[] accepted = in.readArray(RtpHeaderExtensionType.class.getClassLoader());
mAcceptedRtpHeaderExtensionTypes = Arrays.stream(accepted)
.map(o -> (RtpHeaderExtensionType) o).collect(Collectors.toSet());
@@ -1106,46 +1100,13 @@
}
/**
- * For an incoming or outgoing call, indicates the {@link RtpHeaderExtensionType}s which the
- * caller is offering to make available.
- * <p>
- * For outgoing calls, an {@link ImsService} will reserve
- * {@link RtpHeaderExtensionType#getLocalIdentifier()} identifiers the telephony stack has
- * proposed to use and not use these same local identifiers. The offered header extension
- * types for an outgoing call can be found in the
- * {@link ImsCallProfile#getOfferedRtpHeaderExtensionTypes()} and will be available to the
- * {@link ImsService} in {@link MmTelFeature#createCallSession(ImsCallProfile)}.
- * The {@link ImsService} sets the accepted {@link #setAcceptedRtpHeaderExtensionTypes(Set)}
- * when the SDP offer/accept process has completed.
- * <p>
- * According to RFC8285, RTP header extensions available to a call are determined using the
- * offer/accept phase of the SDP protocol (see RFC4566).
- *
- * @return the {@link RtpHeaderExtensionType}s which were offered by other end of the call.
- */
- public @NonNull Set<RtpHeaderExtensionType> getOfferedRtpHeaderExtensionTypes() {
- return mOfferedRtpHeaderExtensionTypes;
- }
-
- /**
- * Sets the offered {@link RtpHeaderExtensionType}s for this call.
- * <p>
- * According to RFC8285, RTP header extensions available to a call are determined using the
- * offer/accept phase of the SDP protocol (see RFC4566).
- *
- * @param rtpHeaderExtensions the {@link RtpHeaderExtensionType}s which are offered.
- */
- public void setOfferedRtpHeaderExtensionTypes(@NonNull Set<RtpHeaderExtensionType>
- rtpHeaderExtensions) {
- mOfferedRtpHeaderExtensionTypes.clear();
- mOfferedRtpHeaderExtensionTypes.addAll(rtpHeaderExtensions);
- }
-
- /**
* Gets the {@link RtpHeaderExtensionType}s which have been accepted by both ends of the call.
* <p>
* According to RFC8285, RTP header extensions available to a call are determined using the
* offer/accept phase of the SDP protocol (see RFC4566).
+ * <p>
+ * The offered header extension types supported by the framework and exposed to the
+ * {@link ImsService} via {@link MmTelFeature#changeOfferedRtpHeaderExtensionTypes(Set)}.
*
* @return the {@link RtpHeaderExtensionType}s which were accepted by the other end of the call.
*/
diff --git a/telephony/java/android/telephony/ims/aidl/IImsMmTelFeature.aidl b/telephony/java/android/telephony/ims/aidl/IImsMmTelFeature.aidl
index b9a6b3c..37fec7a 100644
--- a/telephony/java/android/telephony/ims/aidl/IImsMmTelFeature.aidl
+++ b/telephony/java/android/telephony/ims/aidl/IImsMmTelFeature.aidl
@@ -21,6 +21,7 @@
import android.telephony.ims.aidl.IImsSmsListener;
import android.telephony.ims.aidl.IImsCapabilityCallback;
import android.telephony.ims.feature.CapabilityChangeRequest;
+import android.telephony.ims.RtpHeaderExtensionType;
import android.telephony.ims.ImsCallProfile;
import com.android.ims.internal.IImsCallSession;
@@ -29,6 +30,8 @@
import com.android.ims.internal.IImsRegistrationListener;
import com.android.ims.internal.IImsUt;
+import java.util.List;
+
/**
* See MmTelFeature for more information.
* {@hide}
@@ -37,6 +40,7 @@
void setListener(IImsMmTelListener l);
int getFeatureState();
ImsCallProfile createCallProfile(int callSessionType, int callType);
+ void changeOfferedRtpHeaderExtensionTypes(in List<RtpHeaderExtensionType> types);
IImsCallSession createCallSession(in ImsCallProfile profile);
int shouldProcessCall(in String[] uris);
IImsUt getUtInterface();
diff --git a/telephony/java/android/telephony/ims/feature/MmTelFeature.java b/telephony/java/android/telephony/ims/feature/MmTelFeature.java
index d7b0e0f0..e570fb6 100644
--- a/telephony/java/android/telephony/ims/feature/MmTelFeature.java
+++ b/telephony/java/android/telephony/ims/feature/MmTelFeature.java
@@ -27,6 +27,8 @@
import android.telephony.ims.ImsCallProfile;
import android.telephony.ims.ImsCallSession;
import android.telephony.ims.ImsReasonInfo;
+import android.telephony.ims.ImsService;
+import android.telephony.ims.RtpHeaderExtensionType;
import android.telephony.ims.aidl.IImsCapabilityCallback;
import android.telephony.ims.aidl.IImsMmTelFeature;
import android.telephony.ims.aidl.IImsMmTelListener;
@@ -37,6 +39,7 @@
import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.telephony.ims.stub.ImsSmsImplBase;
import android.telephony.ims.stub.ImsUtImplBase;
+import android.util.ArraySet;
import com.android.ims.internal.IImsCallSession;
import com.android.ims.internal.IImsEcbm;
@@ -45,6 +48,8 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import java.util.List;
+import java.util.Set;
/**
* Base implementation for Voice and SMS (IR-92) and Video (IR-94) IMS support.
@@ -93,6 +98,18 @@
}
@Override
+ public void changeOfferedRtpHeaderExtensionTypes(List<RtpHeaderExtensionType> types)
+ throws RemoteException {
+ synchronized (mLock) {
+ try {
+ MmTelFeature.this.changeOfferedRtpHeaderExtensionTypes(new ArraySet<>(types));
+ } catch (Exception e) {
+ throw new RemoteException(e.getMessage());
+ }
+ }
+ }
+
+ @Override
public IImsCallSession createCallSession(ImsCallProfile profile) throws RemoteException {
synchronized (mLock) {
return createCallSessionInterface(profile);
@@ -623,6 +640,24 @@
}
/**
+ * Called by the framework to report a change to the RTP header extension types which should be
+ * offered during SDP negotiation (see RFC8285 for more information).
+ * <p>
+ * The {@link ImsService} should report the RTP header extensions which were accepted during
+ * SDP negotiation using {@link ImsCallProfile#setAcceptedRtpHeaderExtensionTypes(Set)}.
+ *
+ * @param extensionTypes The RTP header extensions the framework wishes to offer during
+ * outgoing and incoming call setup. An empty list indicates that there
+ * are no framework defined RTP header extension types to offer.
+ * @hide
+ */
+ @SystemApi
+ public void changeOfferedRtpHeaderExtensionTypes(
+ @NonNull Set<RtpHeaderExtensionType> extensionTypes) {
+ // Base implementation - should be overridden if RTP header extension handling is supported.
+ }
+
+ /**
* @hide
*/
public IImsCallSession createCallSessionInterface(ImsCallProfile profile)