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

Commit dd151f0e authored by Brad Ebinger's avatar Brad Ebinger
Browse files

Add NetworkType alternatives to IMS APIs

Some IMS APIs were using ServiceState instead of
TelephonyManager.NETWORK_TYPE_* constants.

This CL cleans this API surface up.

Bug: 147726372
Test: atest CtsTelephonyTestCases; atest FrameworksTelephonyTests
Change-Id: Ic00b83f2d0d8950855d43edc49ad24ce577943af
parent ece12a89
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -11405,7 +11405,8 @@ package android.telephony.ims {
    field public static final String EXTRA_ADDITIONAL_CALL_INFO = "AdditionalCallInfo";
    field public static final String EXTRA_ADDITIONAL_SIP_INVITE_FIELDS = "android.telephony.ims.extra.ADDITIONAL_SIP_INVITE_FIELDS";
    field public static final String EXTRA_CALL_DISCONNECT_CAUSE = "android.telephony.ims.extra.CALL_DISCONNECT_CAUSE";
    field public static final String EXTRA_CALL_RAT_TYPE = "CallRadioTech";
    field public static final String EXTRA_CALL_NETWORK_TYPE = "android.telephony.ims.extra.CALL_NETWORK_TYPE";
    field @Deprecated public static final String EXTRA_CALL_RAT_TYPE = "CallRadioTech";
    field public static final String EXTRA_CHILD_NUMBER = "ChildNum";
    field public static final String EXTRA_CNA = "cna";
    field public static final String EXTRA_CNAP = "cnap";
@@ -11437,8 +11438,8 @@ package android.telephony.ims {
    method public void callSessionConferenceExtendReceived(android.telephony.ims.stub.ImsCallSessionImplBase, android.telephony.ims.ImsCallProfile);
    method public void callSessionConferenceExtended(android.telephony.ims.stub.ImsCallSessionImplBase, android.telephony.ims.ImsCallProfile);
    method public void callSessionConferenceStateUpdated(android.telephony.ims.ImsConferenceState);
    method public void callSessionHandover(int, int, android.telephony.ims.ImsReasonInfo);
    method public void callSessionHandoverFailed(int, int, android.telephony.ims.ImsReasonInfo);
    method @Deprecated public void callSessionHandover(int, int, android.telephony.ims.ImsReasonInfo);
    method @Deprecated public void callSessionHandoverFailed(int, int, android.telephony.ims.ImsReasonInfo);
    method public void callSessionHeld(android.telephony.ims.ImsCallProfile);
    method public void callSessionHoldFailed(android.telephony.ims.ImsReasonInfo);
    method public void callSessionHoldReceived(android.telephony.ims.ImsCallProfile);
@@ -11446,7 +11447,7 @@ package android.telephony.ims {
    method public void callSessionInitiatedFailed(android.telephony.ims.ImsReasonInfo);
    method public void callSessionInviteParticipantsRequestDelivered();
    method public void callSessionInviteParticipantsRequestFailed(android.telephony.ims.ImsReasonInfo);
    method public void callSessionMayHandover(int, int);
    method @Deprecated public void callSessionMayHandover(int, int);
    method public void callSessionMergeComplete(android.telephony.ims.stub.ImsCallSessionImplBase);
    method public void callSessionMergeFailed(android.telephony.ims.ImsReasonInfo);
    method public void callSessionMergeStarted(android.telephony.ims.stub.ImsCallSessionImplBase, android.telephony.ims.ImsCallProfile);
@@ -11468,6 +11469,9 @@ package android.telephony.ims {
    method public void callSessionUpdateReceived(android.telephony.ims.ImsCallProfile);
    method public void callSessionUpdated(android.telephony.ims.ImsCallProfile);
    method public void callSessionUssdMessageReceived(int, String);
    method public void onHandover(int, int, @Nullable android.telephony.ims.ImsReasonInfo);
    method public void onHandoverFailed(int, int, @NonNull android.telephony.ims.ImsReasonInfo);
    method public void onMayHandover(int, int);
  }
  public final class ImsConferenceState implements android.os.Parcelable {
+8 −4
Original line number Diff line number Diff line
@@ -3418,7 +3418,8 @@ package android.telephony.ims {
    field public static final String EXTRA_ADDITIONAL_CALL_INFO = "AdditionalCallInfo";
    field public static final String EXTRA_ADDITIONAL_SIP_INVITE_FIELDS = "android.telephony.ims.extra.ADDITIONAL_SIP_INVITE_FIELDS";
    field public static final String EXTRA_CALL_DISCONNECT_CAUSE = "android.telephony.ims.extra.CALL_DISCONNECT_CAUSE";
    field public static final String EXTRA_CALL_RAT_TYPE = "CallRadioTech";
    field public static final String EXTRA_CALL_NETWORK_TYPE = "android.telephony.ims.extra.CALL_NETWORK_TYPE";
    field @Deprecated public static final String EXTRA_CALL_RAT_TYPE = "CallRadioTech";
    field public static final String EXTRA_CHILD_NUMBER = "ChildNum";
    field public static final String EXTRA_CNA = "cna";
    field public static final String EXTRA_CNAP = "cnap";
@@ -3451,8 +3452,8 @@ package android.telephony.ims {
    method public void callSessionConferenceExtendReceived(android.telephony.ims.stub.ImsCallSessionImplBase, android.telephony.ims.ImsCallProfile);
    method public void callSessionConferenceExtended(android.telephony.ims.stub.ImsCallSessionImplBase, android.telephony.ims.ImsCallProfile);
    method public void callSessionConferenceStateUpdated(android.telephony.ims.ImsConferenceState);
    method public void callSessionHandover(int, int, android.telephony.ims.ImsReasonInfo);
    method public void callSessionHandoverFailed(int, int, android.telephony.ims.ImsReasonInfo);
    method @Deprecated public void callSessionHandover(int, int, android.telephony.ims.ImsReasonInfo);
    method @Deprecated public void callSessionHandoverFailed(int, int, android.telephony.ims.ImsReasonInfo);
    method public void callSessionHeld(android.telephony.ims.ImsCallProfile);
    method public void callSessionHoldFailed(android.telephony.ims.ImsReasonInfo);
    method public void callSessionHoldReceived(android.telephony.ims.ImsCallProfile);
@@ -3460,7 +3461,7 @@ package android.telephony.ims {
    method public void callSessionInitiatedFailed(android.telephony.ims.ImsReasonInfo);
    method public void callSessionInviteParticipantsRequestDelivered();
    method public void callSessionInviteParticipantsRequestFailed(android.telephony.ims.ImsReasonInfo);
    method public void callSessionMayHandover(int, int);
    method @Deprecated public void callSessionMayHandover(int, int);
    method public void callSessionMergeComplete(android.telephony.ims.stub.ImsCallSessionImplBase);
    method public void callSessionMergeFailed(android.telephony.ims.ImsReasonInfo);
    method public void callSessionMergeStarted(android.telephony.ims.stub.ImsCallSessionImplBase, android.telephony.ims.ImsCallProfile);
@@ -3482,6 +3483,9 @@ package android.telephony.ims {
    method public void callSessionUpdateReceived(android.telephony.ims.ImsCallProfile);
    method public void callSessionUpdated(android.telephony.ims.ImsCallProfile);
    method public void callSessionUssdMessageReceived(int, String);
    method public void onHandover(int, int, @Nullable android.telephony.ims.ImsReasonInfo);
    method public void onHandoverFailed(int, int, @NonNull android.telephony.ims.ImsReasonInfo);
    method public void onMayHandover(int, int);
  }

  public final class ImsConferenceState implements android.os.Parcelable {
+15 −0
Original line number Diff line number Diff line
@@ -302,15 +302,30 @@ public final class ImsCallProfile implements Parcelable {
     *      updateImsCallRatFromExtras(Bundle)} to determine whether to set the
     * {@link android.telecom.TelecomManager#EXTRA_CALL_NETWORK_TYPE} extra value and
     * {@link android.telecom.Connection#PROPERTY_WIFI} property on a connection.
     * @deprecated the constants associated with this extra are hidden, instead use
     * {@link #EXTRA_CALL_NETWORK_TYPE}.
     */
    @Deprecated
    public static final String EXTRA_CALL_RAT_TYPE = "CallRadioTech";

    /**
     * Extra key with an {@code int} value which can be set in {@link #setCallExtraInt(String, int)}
     * to indicate the network type used for a call.
     * <p>
     * Valid values are defined by {@code TelephonyManager.NETWORK_TYPE_*} constants. An example may
     * be {@link android.telephony.TelephonyManager#NETWORK_TYPE_LTE}.
     */
    public static final String EXTRA_CALL_NETWORK_TYPE =
            "android.telephony.ims.extra.CALL_NETWORK_TYPE";

    /**
     * Similar to {@link #EXTRA_CALL_RAT_TYPE}, except with a lowercase 'c'.  Used to ensure
     * compatibility with modems that are non-compliant with the {@link #EXTRA_CALL_RAT_TYPE}
     * extra key.  Should be removed when the non-compliant modems are fixed.
     * @hide
     * @deprecated Use {@link #EXTRA_CALL_NETWORK_TYPE} instead.
     */
    @Deprecated
    public static final String EXTRA_CALL_RAT_TYPE_ALT = "callRadioTech";

    /** @hide */
+28 −31
Original line number Diff line number Diff line
@@ -25,8 +25,6 @@ import android.util.Log;
import com.android.ims.internal.IImsCallSession;
import com.android.ims.internal.IImsVideoCallProvider;

import java.util.Objects;

/**
 * Provides the call initiation/termination, and media exchange between two IMS endpoints.
 * It directly communicates with IMS service which implements the IMS protocol behavior.
@@ -346,7 +344,7 @@ public class ImsCallSession {
        }

        /**
         * Called when an {@link ImsCallSession} may handover from one radio technology to another.
         * Called when an {@link ImsCallSession} may handover from one network type to another.
         * For example, the session may handover from WIFI to LTE if conditions are right.
         * <p>
         * If handover is attempted,
@@ -355,24 +353,24 @@ public class ImsCallSession {
         * called to indicate the success or failure of the handover.
         *
         * @param session IMS session object
         * @param srcAccessTech original access technology
         * @param targetAccessTech new access technology
         * @param srcNetworkType original network type
         * @param targetNetworkType new network type
         */
        public void callSessionMayHandover(ImsCallSession session, int srcAccessTech,
                int targetAccessTech) {
        public void callSessionMayHandover(ImsCallSession session, int srcNetworkType,
                int targetNetworkType) {
            // no-op
        }

        /**
         * Called when session access technology changes
         * Called when session network type changes
         *
         * @param session IMS session object
         * @param srcAccessTech original access technology
         * @param targetAccessTech new access technology
         * @param srcNetworkType original network type
         * @param targetNetworkType new network type
         * @param reasonInfo
         */
        public void callSessionHandover(ImsCallSession session,
                                 int srcAccessTech, int targetAccessTech,
                                 int srcNetworkType, int targetNetworkType,
                                 ImsReasonInfo reasonInfo) {
            // no-op
        }
@@ -381,12 +379,12 @@ public class ImsCallSession {
         * Called when session access technology change fails
         *
         * @param session IMS session object
         * @param srcAccessTech original access technology
         * @param targetAccessTech new access technology
         * @param srcNetworkType original access technology
         * @param targetNetworkType new access technology
         * @param reasonInfo handover failure reason
         */
        public void callSessionHandoverFailed(ImsCallSession session,
                                       int srcAccessTech, int targetAccessTech,
                                       int srcNetworkType, int targetNetworkType,
                                       ImsReasonInfo reasonInfo) {
            // no-op
        }
@@ -1303,20 +1301,19 @@ public class ImsCallSession {
        /**
         * Notifies of a case where a {@link ImsCallSession} may
         * potentially handover from one radio technology to another.
         * @param srcAccessTech The source radio access technology; one of the access technology
         *                      constants defined in {@link android.telephony.ServiceState}.  For
         *                      example
         *                      {@link android.telephony.ServiceState#RIL_RADIO_TECHNOLOGY_LTE}.
         * @param targetAccessTech The target radio access technology; one of the access technology
         *                      constants defined in {@link android.telephony.ServiceState}.  For
         *                      example
         *                      {@link android.telephony.ServiceState#RIL_RADIO_TECHNOLOGY_LTE}.
         * @param srcNetworkType The source network type; one of the network type constants defined
         *                       in {@link android.telephony.TelephonyManager}.  For example
         *                      {@link android.telephony.TelephonyManager#NETWORK_TYPE_LTE}.
         * @param targetNetworkType The target radio access technology; one of the network type
         *                          constants defined in {@link android.telephony.TelephonyManager}.
         *                          For example
         *                          {@link android.telephony.TelephonyManager#NETWORK_TYPE_LTE}.
         */
        @Override
        public void callSessionMayHandover(int srcAccessTech, int targetAccessTech) {
        public void callSessionMayHandover(int srcNetworkType, int targetNetworkType) {
            if (mListener != null) {
                mListener.callSessionMayHandover(ImsCallSession.this, srcAccessTech,
                        targetAccessTech);
                mListener.callSessionMayHandover(ImsCallSession.this, srcNetworkType,
                        targetNetworkType);
            }
        }

@@ -1324,11 +1321,11 @@ public class ImsCallSession {
         * Notifies of handover information for this call
         */
        @Override
        public void callSessionHandover(int srcAccessTech, int targetAccessTech,
        public void callSessionHandover(int srcNetworkType, int targetNetworkType,
                ImsReasonInfo reasonInfo) {
            if (mListener != null) {
                mListener.callSessionHandover(ImsCallSession.this, srcAccessTech,
                        targetAccessTech, reasonInfo);
                mListener.callSessionHandover(ImsCallSession.this, srcNetworkType,
                        targetNetworkType, reasonInfo);
            }
        }

@@ -1336,11 +1333,11 @@ public class ImsCallSession {
         * Notifies of handover failure info for this call
         */
        @Override
        public void callSessionHandoverFailed(int srcAccessTech, int targetAccessTech,
        public void callSessionHandoverFailed(int srcNetworkType, int targetNetworkType,
                ImsReasonInfo reasonInfo) {
            if (mListener != null) {
                mListener.callSessionHandoverFailed(ImsCallSession.this, srcAccessTech,
                        targetAccessTech, reasonInfo);
                mListener.callSessionHandoverFailed(ImsCallSession.this, srcNetworkType,
                        targetNetworkType, reasonInfo);
            }
        }

+59 −5
Original line number Diff line number Diff line
@@ -17,10 +17,13 @@
package android.telephony.ims;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.os.RemoteException;
import android.telephony.Annotation;
import android.telephony.CallQuality;
import android.telephony.ServiceState;
import android.telephony.ims.aidl.IImsCallSessionListener;
import android.telephony.ims.stub.ImsCallSessionImplBase;

@@ -476,11 +479,27 @@ public class ImsCallSessionListener {
     * @param targetAccessTech The target radio access technology; one of the access technology
     * constants defined in {@link android.telephony.ServiceState}. For example
     * {@link android.telephony.ServiceState#RIL_RADIO_TECHNOLOGY_LTE}.
     * @deprecated Uses hidden constants for radio access technology, use
     * {@link #onMayHandover(int, int)} instead.
     */
    public void callSessionMayHandover(int srcAccessTech, int targetAccessTech)
    {
    @Deprecated
    public void callSessionMayHandover(int srcAccessTech, int targetAccessTech) {
        // Use new API internally.
        onMayHandover(ServiceState.rilRadioTechnologyToNetworkType(srcAccessTech),
                ServiceState.rilRadioTechnologyToNetworkType(targetAccessTech));
    }

    /**
     * Notify the framework that the associated {@link ImsCallSession} may handover from one network
     * type to another.
     *
     * @param srcNetworkType The source network type.
     * @param targetNetworkType The target network type.
     */
    public void onMayHandover(@Annotation.NetworkType int srcNetworkType,
            @Annotation.NetworkType int targetNetworkType) {
        try {
            mListener.callSessionMayHandover(srcAccessTech, targetAccessTech);
            mListener.callSessionMayHandover(srcNetworkType, targetNetworkType);
        } catch (RemoteException e) {
            throw new RuntimeException(e);
        }
@@ -494,11 +513,29 @@ public class ImsCallSessionListener {
     * @param targetAccessTech new access technology, defined in
     * {@link android.telephony.ServiceState}.
     * @param reasonInfo The {@link ImsReasonInfo} associated with this handover.
     * @deprecated Uses hidden radio access technology constants, use
     * {@link #onHandover(int, int, ImsReasonInfo)} instead.
     */
    @Deprecated
    public void callSessionHandover(int srcAccessTech, int targetAccessTech,
            ImsReasonInfo reasonInfo) {
        // Use new API internally.
        onHandover(ServiceState.rilRadioTechnologyToNetworkType(srcAccessTech),
                ServiceState.rilRadioTechnologyToNetworkType(targetAccessTech), reasonInfo);
    }

    /**
     * Notify the framework that the associated {@link ImsCallSession} has handed over from one
     * network type to another.
     *
     * @param srcNetworkType original network type.
     * @param targetNetworkType target network type after handover..
     * @param reasonInfo An optional {@link ImsReasonInfo} associated with this handover.
     */
    public void onHandover(@Annotation.NetworkType int srcNetworkType,
            @Annotation.NetworkType int targetNetworkType, @Nullable ImsReasonInfo reasonInfo) {
        try {
            mListener.callSessionHandover(srcAccessTech, targetAccessTech, reasonInfo);
            mListener.callSessionHandover(srcNetworkType, targetNetworkType, reasonInfo);
        } catch (RemoteException e) {
            throw new RuntimeException(e);
        }
@@ -510,11 +547,28 @@ public class ImsCallSessionListener {
     * @param srcAccessTech original access technology
     * @param targetAccessTech new access technology
     * @param reasonInfo An {@link ImsReasonInfo} detailing the reason for the failure.
     * @deprecated Uses hidden radio access technology constants, use
     * {@link #onHandoverFailed(int, int, ImsReasonInfo)} instead
     */
    @Deprecated
    public void callSessionHandoverFailed(int srcAccessTech, int targetAccessTech,
            ImsReasonInfo reasonInfo) {
        // Use new API internally.
        onHandoverFailed(ServiceState.rilRadioTechnologyToNetworkType(srcAccessTech),
                ServiceState.rilRadioTechnologyToNetworkType(targetAccessTech), reasonInfo);
    }

    /**
     * The IMS call session's access technology change has failed..
     *
     * @param srcNetworkType original network type.
     * @param targetNetworkType target network type that the handover failed for.
     * @param reasonInfo An {@link ImsReasonInfo} detailing the reason for the failure.
     */
    public void onHandoverFailed(@Annotation.NetworkType int srcNetworkType,
            @Annotation.NetworkType int targetNetworkType, @NonNull ImsReasonInfo reasonInfo) {
        try {
            mListener.callSessionHandoverFailed(srcAccessTech, targetAccessTech, reasonInfo);
            mListener.callSessionHandoverFailed(srcNetworkType, targetNetworkType, reasonInfo);
        } catch (RemoteException e) {
            throw new RuntimeException(e);
        }
Loading