Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d21ac143 authored by Hwayoung Helen Kim's avatar Hwayoung Helen Kim Committed by Android (Google) Code Review
Browse files

Merge "Add a new system Api for ANBR - callSessionSendAnbrQuery - callSessionNotifyAnbr"

parents 46a23cd0 6a6e2252
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -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 {
+49 −0
Original line number Diff line number Diff line
@@ -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);
        }
    }

    /**
+70 −1
Original line number Diff line number Diff line
@@ -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();
        }
    }
}
+13 −0
Original line number Diff line number Diff line
@@ -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);
}
+21 −0
Original line number Diff line number Diff line
@@ -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);
        }
    }
}
Loading