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

Commit 3a6da96e 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 d03111b3 39878115
Loading
Loading
Loading
Loading
+13 −0
Original line number Original line Diff line number Diff line
@@ -2969,9 +2969,22 @@ public interface CommandsInterface {
     * @param mediaType Media type is used to identify media stream such as audio or video.
     * @param mediaType Media type is used to identify media stream such as audio or video.
     * @param direction Direction of this packet stream (e.g. uplink or downlink).
     * @param direction Direction of this packet stream (e.g. uplink or downlink).
     * @param bitsPerSecond The bit rate requested by the opponent UE.
     * @param bitsPerSecond The bit rate requested by the opponent UE.
     * @param result Callback message to receive the result.
     */
     */
    default void sendAnbrQuery(int mediaType, int direction, int bitsPerSecond, Message result) {}
    default void sendAnbrQuery(int mediaType, int direction, int bitsPerSecond, Message result) {}


    /**
     * Notifies the recommended bit rate for the indicated logical channel and direction.
     *
     * @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 The recommended bit rate for the UE for a specific logical channel and
     *        a specific direction by NW.
     * @param result Callback message to receive the result.
     */
    default void triggerNotifyAnbr(int mediaType, int direction, int bitsPerSecond,
                Message result) {}

    /**
    /**
     * Set the UE's ability to accept/reject null ciphered and/or null integrity-protected
     * Set the UE's ability to accept/reject null ciphered and/or null integrity-protected
     * connections.
     * connections.
+8 −0
Original line number Original line Diff line number Diff line
@@ -3452,6 +3452,14 @@ public class GsmCdmaPhone extends Phone {
                }
                }
                break;
                break;


            case EVENT_TRIGGER_NOTIFY_ANBR:
                logd("EVENT_TRIGGER_NOTIFY_ANBR");
                ar = (AsyncResult) msg.obj;
                if (ar.exception == null) {
                    mImsPhone.triggerNotifyAnbr(((int[]) ar.result)[0], ((int[]) ar.result)[1],
                            ((int[]) ar.result)[2]);
                }
                break;
            default:
            default:
                super.handleMessage(msg);
                super.handleMessage(msg);
        }
        }
+15 −2
Original line number Original line Diff line number Diff line
@@ -25,8 +25,8 @@ import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences;
import android.hardware.radio.modem.ImeiInfo;
import android.content.res.Configuration;
import android.content.res.Configuration;
import android.hardware.radio.modem.ImeiInfo;
import android.net.Uri;
import android.net.Uri;
import android.os.AsyncResult;
import android.os.AsyncResult;
import android.os.Build;
import android.os.Build;
@@ -245,8 +245,9 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    protected static final int EVENT_IMS_DEREGISTRATION_TRIGGERED = 65;
    protected static final int EVENT_IMS_DEREGISTRATION_TRIGGERED = 65;
    protected static final int EVENT_SET_NULL_CIPHER_AND_INTEGRITY_DONE = 66;
    protected static final int EVENT_SET_NULL_CIPHER_AND_INTEGRITY_DONE = 66;
    protected static final int EVENT_GET_DEVICE_IMEI_DONE = 67;
    protected static final int EVENT_GET_DEVICE_IMEI_DONE = 67;
    protected static final int EVENT_TRIGGER_NOTIFY_ANBR = 68;


    protected static final int EVENT_LAST = EVENT_GET_DEVICE_IMEI_DONE;
    protected static final int EVENT_LAST = EVENT_TRIGGER_NOTIFY_ANBR;


    // For shared prefs.
    // For shared prefs.
    private static final String GSM_ROAMING_LIST_OVERRIDE_PREFIX = "gsm_roaming_list_";
    private static final String GSM_ROAMING_LIST_OVERRIDE_PREFIX = "gsm_roaming_list_";
@@ -4989,6 +4990,18 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        mCi.triggerEpsFallback(reason, response);
        mCi.triggerEpsFallback(reason, response);
    }
    }


    /**
     * Notifies the recommended bit rate for the indicated logical channel and direction.
     *
     * @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 The recommended bit rate for the UE for a specific logical channel and
     *        a specific direction by NW.
     */
    public void triggerNotifyAnbr(int mediaType, int direction, int bitsPerSecond) {
        mCi.triggerNotifyAnbr(mediaType, direction, bitsPerSecond, null);
    }

    /**
    /**
     * Sets the emergency mode
     * Sets the emergency mode
     *
     *
+5 −0
Original line number Original line Diff line number Diff line
@@ -2757,6 +2757,11 @@ public class ImsPhone extends ImsPhoneBase {
        mDefaultPhone.updateImsCallStatus(imsCallInfo, response);
        mDefaultPhone.updateImsCallStatus(imsCallInfo, response);
    }
    }


    @Override
    public void triggerNotifyAnbr(int mediaType, int direction, int bitsPerSecond) {
        mCT.triggerNotifyAnbr(mediaType, direction, bitsPerSecond);
    }

    @Override
    @Override
    public void dump(FileDescriptor fd, PrintWriter printWriter, String[] args) {
    public void dump(FileDescriptor fd, PrintWriter printWriter, String[] args) {
        IndentingPrintWriter pw = new IndentingPrintWriter(printWriter, "  ");
        IndentingPrintWriter pw = new IndentingPrintWriter(printWriter, "  ");
+42 −0
Original line number Original line Diff line number Diff line
@@ -4319,6 +4319,26 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                conn.receivedRtpHeaderExtensions(rtpHeaderExtensionData);
                conn.receivedRtpHeaderExtensions(rtpHeaderExtensionData);
            }
            }
        }
        }

        /**
         * 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 imsCall The ImsCall the data was received on.
         * @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 onCallSessionSendAnbrQuery(ImsCall imsCall, int mediaType, int direction,
                int bitsPerSecond) {
            log("onCallSessionSendAnbrQuery mediaType=" + mediaType + ", direction="
                    + direction + ", bitPerSecond=" + bitsPerSecond);
            handleSendAnbrQuery(mediaType, direction, bitsPerSecond);
        }
    };
    };


    /**
    /**
@@ -5837,6 +5857,28 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
        return connList.toArray(new SrvccConnection[0]);
        return connList.toArray(new SrvccConnection[0]);
    }
    }


    /** Send the mediaType, direction, bitrate for ANBR Query to the radio */
    public void handleSendAnbrQuery(int mediaType, int direction, int bitsPerSecond) {
        mPhone.getDefaultPhone().mCi.sendAnbrQuery(mediaType, direction, bitsPerSecond, null);
    }


    /**
     * Notifies the recommended bit rate for the indicated logical channel and direction.
     *
     * @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 The recommended bit rate for the UE for a specific logical channel and
     *        a specific direction by NW.
     */
    public void triggerNotifyAnbr(int mediaType, int direction, int bitsPerSecond) {
        ImsCall activeCall = mForegroundCall.getFirstConnection().getImsCall();

        if (activeCall != null) {
            activeCall.callSessionNotifyAnbr(mediaType, direction, bitsPerSecond);
        }
    }

    private boolean isCallProfileSupported(SrvccCall profile) {
    private boolean isCallProfileSupported(SrvccCall profile) {
        if (profile == null) return false;
        if (profile == null) return false;