diff options
8 files changed, 253 insertions, 2 deletions
diff --git a/core/java/android/telephony/TelephonyCallback.java b/core/java/android/telephony/TelephonyCallback.java index 257f3b7dbf40..e90ae757abd2 100644 --- a/core/java/android/telephony/TelephonyCallback.java +++ b/core/java/android/telephony/TelephonyCallback.java @@ -582,6 +582,14 @@ public class TelephonyCallback { @RequiresPermission(Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int EVENT_LINK_CAPACITY_ESTIMATE_CHANGED = 37; + /** + * Event to norify the Anbr information from Radio to Ims. + * + * @see ImsCallSessionImplBase#callSessionNotifyAnbr. + * + * @hide + */ + public static final int EVENT_TRIGGER_NOTIFY_ANBR = 38; /** * @hide @@ -623,7 +631,8 @@ public class TelephonyCallback { EVENT_DATA_ENABLED_CHANGED, EVENT_ALLOWED_NETWORK_TYPE_LIST_CHANGED, EVENT_LEGACY_CALL_STATE_CHANGED, - EVENT_LINK_CAPACITY_ESTIMATE_CHANGED + EVENT_LINK_CAPACITY_ESTIMATE_CHANGED, + EVENT_TRIGGER_NOTIFY_ANBR }) @Retention(RetentionPolicy.SOURCE) public @interface TelephonyEvent { diff --git a/telephony/java/android/telephony/ims/ImsCallSession.java b/telephony/java/android/telephony/ims/ImsCallSession.java index d3d94b424899..98ed1fa5ddeb 100755 --- a/telephony/java/android/telephony/ims/ImsCallSession.java +++ b/telephony/java/android/telephony/ims/ImsCallSession.java @@ -520,6 +520,14 @@ public class ImsCallSession { @NonNull Set<RtpHeaderExtension> extensions) { // no-op } + + /** + * Called when radio to send ANBRQ message to the access network to query the desired + * bitrate. + */ + public void callSessionSendAnbrQuery(int mediaType, int direction, int bitsPerSecond) { + // no-op + } } private final IImsCallSession miSession; @@ -1224,6 +1232,27 @@ public class ImsCallSession { } /** + * Deliver the bitrate for the indicated media type, direction and bitrate to the upper layer. + * + * @param mediaType MediaType is used to identify media stream such as audio or video. + * @param direction Direction of this packet stream (e.g. uplink or downlink). + * @param bitsPerSecond This value is the bitrate received from the NW through the Recommended + * bitrate MAC Control Element message and ImsStack converts this value from MAC bitrate + * to audio/video codec bitrate (defined in TS26.114). + */ + public void callSessionNotifyAnbr(int mediaType, int direction, int bitsPerSecond) { + if (mClosed) { + return; + } + + try { + miSession.callSessionNotifyAnbr(mediaType, direction, bitsPerSecond); + } catch (RemoteException e) { + Log.e(TAG, "callSessionNotifyAnbr" + e); + } + } + + /** * A listener type for receiving notification on IMS call session events. * When an event is generated for an {@link IImsCallSession}, * the application is notified by having one of the methods called on @@ -1716,6 +1745,26 @@ public class ImsCallSession { } }, mListenerExecutor); } + + /** + * ANBR Query received. + * + * @param mediaType MediaType is used to identify media stream such as audio or video. + * @param direction Direction of this packet stream (e.g. uplink or downlink). + * @param bitsPerSecond This value is the bitrate requested by the other party UE through + * RTP CMR, RTCPAPP or TMMBR, and ImsStack converts this value to the MAC bitrate + * (defined in TS36.321, range: 0 ~ 8000 kbit/s). + */ + @Override + public void callSessionSendAnbrQuery(int mediaType, int direction, + int bitsPerSecond) { + Log.d(TAG, "callSessionSendAnbrQuery in ImsCallSession"); + TelephonyUtils.runWithCleanCallingIdentity(()-> { + if (mListener != null) { + mListener.callSessionSendAnbrQuery(mediaType, direction, bitsPerSecond); + } + }, mListenerExecutor); + } } /** diff --git a/telephony/java/android/telephony/ims/ImsCallSessionListener.java b/telephony/java/android/telephony/ims/ImsCallSessionListener.java index db99acfd9a35..93cea254ccfc 100644 --- a/telephony/java/android/telephony/ims/ImsCallSessionListener.java +++ b/telephony/java/android/telephony/ims/ImsCallSessionListener.java @@ -16,6 +16,8 @@ package android.telephony.ims; +import android.annotation.IntDef; +import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; @@ -25,9 +27,12 @@ import android.telephony.CallQuality; import android.telephony.ServiceState; import android.telephony.ims.aidl.IImsCallSessionListener; import android.telephony.ims.stub.ImsCallSessionImplBase; +import android.util.Log; import com.android.ims.internal.IImsCallSession; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.Objects; import java.util.Set; @@ -44,7 +49,7 @@ import java.util.Set; // ImsCallSessionListenerConverter is also changed. @SystemApi public class ImsCallSessionListener { - + private static final String TAG = "ImsCallSessionListener"; private final IImsCallSessionListener mListener; /** @hide */ @@ -808,5 +813,69 @@ public class ImsCallSessionListener { e.rethrowFromSystemServer(); } } + + /** @hide */ + @IntDef(flag = true, + value = { + MEDIA_STREAM_TYPE_AUDIO, + MEDIA_STREAM_TYPE_VIDEO, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface MediaStreamType {} + + /** + * Media Stream Type - Audio + * @hide + */ + public static final int MEDIA_STREAM_TYPE_AUDIO = 1; + /** + * Media Stream Type - Video + * @hide + */ + public static final int MEDIA_STREAM_TYPE_VIDEO = 2; + + /** @hide */ + @IntDef(flag = true, + value = { + MEDIA_STREAM_DIRECTION_UPLINK, + MEDIA_STREAM_DIRECTION_DOWNLINK, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface MediaStreamDirection {} + + /** + * Media Stream Direction - Uplink + * @hide + */ + public static final int MEDIA_STREAM_DIRECTION_UPLINK = 1; + /** + * Media Stream Direction - Downlink + * @hide + */ + public static final int MEDIA_STREAM_DIRECTION_DOWNLINK = 2; + + /** + * Access Network Bitrate Recommendation Query (ANBRQ), see 3GPP TS 26.114. + * This API triggers radio to send ANBRQ message to the access network to query the + * desired bitrate. + * + * @param mediaType {@link MediaStreamType} is used to identify media stream such as + * audio or video. + * @param direction {@link MediaStreamDirection} of this packet stream (e.g. uplink + * or downlink). + * @param bitsPerSecond This value is the bitrate requested by the other party UE through + * RTP CMR, RTCPAPP or TMMBR, and ImsStack converts this value to the MAC bitrate + * (defined in TS36.321, range: 0 ~ 8000 kbit/s). + * @hide + */ + public final void callSessionSendAnbrQuery(@MediaStreamType int mediaType, + @MediaStreamDirection int direction, @IntRange(from = 0) int bitsPerSecond) { + Log.d(TAG, "callSessionSendAnbrQuery in imscallsessonListener"); + try { + mListener.callSessionSendAnbrQuery(mediaType, direction, bitsPerSecond); + } catch (RemoteException e) { + e.rethrowFromSystemServer(); + } + } } diff --git a/telephony/java/android/telephony/ims/aidl/IImsCallSessionListener.aidl b/telephony/java/android/telephony/ims/aidl/IImsCallSessionListener.aidl index ed0375251ffb..b58a5c79b76c 100644 --- a/telephony/java/android/telephony/ims/aidl/IImsCallSessionListener.aidl +++ b/telephony/java/android/telephony/ims/aidl/IImsCallSessionListener.aidl @@ -171,4 +171,17 @@ oneway interface IImsCallSessionListener { * @param extensions the RTP header extensions received. */ void callSessionRtpHeaderExtensionsReceived(in List<RtpHeaderExtension> extensions); + + /** + * Access Network Bitrate Recommendation Query (ANBRQ), see 3GPP TS 26.114. + * This API triggers radio to send ANBRQ message to the access network to query the desired + * bitrate. + * + * @param mediaType MediaType is used to identify media stream such as audio or video. + * @param direction Direction of this packet stream (e.g. uplink or downlink). + * @param bitsPerSecond This value is the bitrate requested by the other party UE + * through RTP CMR, RTCPAPP or TMMBR, and ImsStack converts this value to the MAC bitrate + * (defined in TS36.321, range: 0 ~ 8000 kbit/s). + */ + void callSessionSendAnbrQuery(int mediaType, int direction, int bitsPerSecond); } diff --git a/telephony/java/android/telephony/ims/compat/stub/ImsCallSessionImplBase.java b/telephony/java/android/telephony/ims/compat/stub/ImsCallSessionImplBase.java index 8dcd711a96a9..798e8019502f 100755 --- a/telephony/java/android/telephony/ims/compat/stub/ImsCallSessionImplBase.java +++ b/telephony/java/android/telephony/ims/compat/stub/ImsCallSessionImplBase.java @@ -417,6 +417,21 @@ public class ImsCallSessionImplBase extends IImsCallSession.Stub { } /** + * Deliver the bitrate for the indicated media type, direction and bitrate to the upper layer. + * + * @param mediaType MediaType is used to identify media stream such as audio or video. + * @param direction Direction of this packet stream (e.g. uplink or downlink). + * @param bitsPerSecond This value is the bitrate received from the NW through the Recommended + * bitrate MAC Control Element message and ImsStack converts this value from MAC bitrate + * to audio/video codec bitrate (defined in TS26.114). + * @hide + */ + @Override + public void callSessionNotifyAnbr(int mediaType, int direction, int bitsPerSecond) { + // no-op; not supported in compat layer. + } + + /** * There are two different ImsCallSessionListeners that need to reconciled here, we need to * convert the "old" version of the com.android.ims.internal.IImsCallSessionListener to the * "new" version of the Listener android.telephony.ims.ImsCallSessionListener when calling @@ -662,5 +677,11 @@ public class ImsCallSessionImplBase extends IImsCallSession.Stub { public void callQualityChanged(CallQuality callQuality) throws RemoteException { mNewListener.callQualityChanged(callQuality); } + + @Override + public void callSessionSendAnbrQuery(int mediaType, int direction, + int bitsPerSecond) throws RemoteException { + mNewListener.callSessionSendAnbrQuery(mediaType, direction, bitsPerSecond); + } } } diff --git a/telephony/java/android/telephony/ims/stub/ImsCallSessionImplBase.java b/telephony/java/android/telephony/ims/stub/ImsCallSessionImplBase.java index f46938af2533..e46351dcf820 100644 --- a/telephony/java/android/telephony/ims/stub/ImsCallSessionImplBase.java +++ b/telephony/java/android/telephony/ims/stub/ImsCallSessionImplBase.java @@ -16,6 +16,8 @@ package android.telephony.ims.stub; +import android.annotation.IntDef; +import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.SystemApi; import android.os.Bundle; @@ -37,6 +39,8 @@ import com.android.ims.internal.IImsCallSession; import com.android.ims.internal.IImsVideoCallProvider; import com.android.internal.telephony.util.TelephonyUtils; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.util.List; import java.util.Set; import java.util.concurrent.CancellationException; @@ -68,6 +72,46 @@ public class ImsCallSessionImplBase implements AutoCloseable { */ public static final int USSD_MODE_REQUEST = 1; + /** @hide */ + @IntDef( + value = { + MEDIA_STREAM_TYPE_AUDIO, + MEDIA_STREAM_TYPE_VIDEO + }) + @Retention(RetentionPolicy.SOURCE) + public @interface MediaStreamType {} + + /** + * Media Stream Type - Audio + * @hide + */ + public static final int MEDIA_STREAM_TYPE_AUDIO = 1; + /** + * Media Stream Type - Video + * @hide + */ + public static final int MEDIA_STREAM_TYPE_VIDEO = 2; + + /** @hide */ + @IntDef( + value = { + MEDIA_STREAM_DIRECTION_UPLINK, + MEDIA_STREAM_DIRECTION_DOWNLINK + }) + @Retention(RetentionPolicy.SOURCE) + public @interface MediaStreamDirection {} + + /** + * Media Stream Direction - Uplink + * @hide + */ + public static final int MEDIA_STREAM_DIRECTION_UPLINK = 1; + /** + * Media Stream Direction - Downlink + * @hide + */ + public static final int MEDIA_STREAM_DIRECTION_DOWNLINK = 2; + /** * Defines IMS call session state. */ @@ -327,6 +371,12 @@ public class ImsCallSessionImplBase implements AutoCloseable { new ArraySet<RtpHeaderExtension>(extensions)), "sendRtpHeaderExtensions"); } + @Override + public void callSessionNotifyAnbr(int mediaType, int direction, int bitsPerSecond) { + executeMethodAsync(() -> ImsCallSessionImplBase.this.callSessionNotifyAnbr( + mediaType, direction, bitsPerSecond), "callSessionNotifyAnbr"); + } + // Call the methods with a clean calling identity on the executor and wait indefinitely for // the future to return. private void executeMethodAsync(Runnable r, String errorLogName) { @@ -730,6 +780,22 @@ public class ImsCallSessionImplBase implements AutoCloseable { public void sendRtpHeaderExtensions(@NonNull Set<RtpHeaderExtension> rtpHeaderExtensions) { } + /** + * Deliver the bitrate for the indicated media type, direction and bitrate to the upper layer. + * + * @param mediaType MediaType is used to identify media stream such as audio or video. + * @param direction Direction of this packet stream (e.g. uplink or downlink). + * @param bitsPerSecond This value is the bitrate received from the NW through the Recommended + * bitrate MAC Control Element message and ImsStack converts this value from MAC bitrate + * to audio/video codec bitrate (defined in TS26.114). + * @hide + */ + public void callSessionNotifyAnbr(@MediaStreamType int mediaType, + @MediaStreamDirection int direction, @IntRange(from = 0) int bitsPerSecond) { + // Base Implementation - Should be overridden by IMS service + Log.i(LOG_TAG, "ImsCallSessionImplBase callSessionNotifyAnbr - mediaType: " + mediaType); + } + /** @hide */ public IImsCallSession getServiceImpl() { return mServiceImpl; diff --git a/telephony/java/com/android/ims/internal/IImsCallSession.aidl b/telephony/java/com/android/ims/internal/IImsCallSession.aidl index d7cf2826e446..60a74788b709 100644 --- a/telephony/java/com/android/ims/internal/IImsCallSession.aidl +++ b/telephony/java/com/android/ims/internal/IImsCallSession.aidl @@ -307,4 +307,15 @@ interface IImsCallSession { * @param extensions the header extensions to be sent */ void sendRtpHeaderExtensions(in List<RtpHeaderExtension> extensions); + + /* + * Deliver the bitrate for the indicated media type, direction and bitrate to the upper layer. + * + * @param mediaType MediaType is used to identify media stream such as audio or video. + * @param direction Direction of this packet stream (e.g. uplink or downlink). + * @param bitsPerSecond This value is the bitrate received from the NW through the Recommended + * bitrate MAC Control Element message and ImsStack converts this value from MAC bitrate + * to audio/video codec bitrate (defined in TS26.114). + */ + void callSessionNotifyAnbr(int mediaType, int direction, int bitsPerSecond); } diff --git a/telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl b/telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl index 8afd85633322..9395fbd6a85e 100644 --- a/telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl +++ b/telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl @@ -194,4 +194,17 @@ oneway interface IImsCallSessionListener { * @param callQuality then updated call quality */ void callQualityChanged(in CallQuality callQuality); + + /** + * Access Network Bitrate Recommendation Query (ANBRQ), see 3GPP TS 26.114. + * This API triggers radio to send ANBRQ message to the access network to query the desired + * bitrate. + * + * @param mediaType MediaType is used to identify media stream such as audio or video. + * @param direction Direction of this packet stream (e.g. uplink or downlink). + * @param bitsPerSecond This value is the bitrate requested by the other party UE through + * RTP CMR, RTCPAPP or TMMBR, and ImsStack converts this value to the MAC bitrate + * (defined in TS36.321, range: 0 ~ 8000 kbit/s). + */ + void callSessionSendAnbrQuery(int mediaType, int direction, int bitsPerSecond); } |