Merge "Add a new system Api for ANBR - callSessionSendAnbrQuery - callSessionNotifyAnbr"
This commit is contained in:
committed by
Android (Google) Code Review
commit
d21ac1432e
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
@@ -1223,6 +1231,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},
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -416,6 +416,21 @@ public class ImsCallSessionImplBase extends IImsCallSession.Stub {
|
||||
// no-op; not supported in compat layer.
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user