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
Merged-In: Ic00b83f2d0d8950855d43edc49ad24ce577943af
Change-Id: Ic00b83f2d0d8950855d43edc49ad24ce577943af
This commit is contained in:
Brad Ebinger
2020-01-20 16:28:24 -08:00
parent 1413b254eb
commit 1efc2aa560
7 changed files with 131 additions and 50 deletions

View File

@@ -9791,7 +9791,8 @@ package android.telephony.ims {
field public static final int DIALSTRING_USSD = 2; // 0x2
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_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";
@@ -9823,8 +9824,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);
@@ -9832,7 +9833,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);
@@ -9854,6 +9855,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 {

View File

@@ -3153,7 +3153,8 @@ package android.telephony.ims {
field public static final int DIALSTRING_USSD = 2; // 0x2
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_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";
@@ -3186,8 +3187,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);
@@ -3195,7 +3196,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);
@@ -3217,6 +3218,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 {

View File

@@ -294,15 +294,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 */

View File

@@ -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);
}
}

View File

@@ -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);
}

View File

@@ -92,11 +92,11 @@ oneway interface IImsCallSessionListener {
/**
* Notifies of handover information for this call
*/
void callSessionHandover(int srcAccessTech, int targetAccessTech,
void callSessionHandover(int srcNetworkType, int targetNetworkType,
in ImsReasonInfo reasonInfo);
void callSessionHandoverFailed(int srcAccessTech, int targetAccessTech,
void callSessionHandoverFailed(int srcNetworkType, int targetNetworkType,
in ImsReasonInfo reasonInfo);
void callSessionMayHandover(int srcAccessTech, int targetAccessTech);
void callSessionMayHandover(int srcNetworkType, int targetNetworkType);
/**
* Notifies the TTY mode change by remote party.

View File

@@ -20,6 +20,7 @@ import android.compat.annotation.UnsupportedAppUsage;
import android.os.Message;
import android.os.RemoteException;
import android.telephony.CallQuality;
import android.telephony.ServiceState;
import android.telephony.ims.ImsCallProfile;
import android.telephony.ims.ImsCallSession;
import android.telephony.ims.ImsConferenceState;
@@ -547,19 +548,25 @@ public class ImsCallSessionImplBase extends IImsCallSession.Stub {
@Override
public void callSessionHandover(IImsCallSession i, int srcAccessTech, int targetAccessTech,
ImsReasonInfo reasonInfo) throws RemoteException {
mNewListener.callSessionHandover(srcAccessTech, targetAccessTech, reasonInfo);
mNewListener.callSessionHandover(
ServiceState.rilRadioTechnologyToNetworkType(srcAccessTech),
ServiceState.rilRadioTechnologyToNetworkType(targetAccessTech), reasonInfo);
}
@Override
public void callSessionHandoverFailed(IImsCallSession i, int srcAccessTech,
int targetAccessTech, ImsReasonInfo reasonInfo) throws RemoteException {
mNewListener.callSessionHandoverFailed(srcAccessTech, targetAccessTech, reasonInfo);
mNewListener.callSessionHandoverFailed(
ServiceState.rilRadioTechnologyToNetworkType(srcAccessTech),
ServiceState.rilRadioTechnologyToNetworkType(targetAccessTech), reasonInfo);
}
@Override
public void callSessionMayHandover(IImsCallSession i, int srcAccessTech, int targetAccessTech)
throws RemoteException {
mNewListener.callSessionMayHandover(srcAccessTech, targetAccessTech);
mNewListener.callSessionMayHandover(
ServiceState.rilRadioTechnologyToNetworkType(srcAccessTech),
ServiceState.rilRadioTechnologyToNetworkType(targetAccessTech));
}
@Override