IMMTelFeature.java revision 15708a316bcfafc93aa1795fae65e83035270d88
1/* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License 15 */ 16 17package android.telephony.ims.feature; 18 19import android.app.PendingIntent; 20import android.os.Message; 21import android.os.RemoteException; 22 23import com.android.ims.ImsCallProfile; 24import com.android.ims.internal.IImsCallSession; 25import com.android.ims.internal.IImsCallSessionListener; 26import com.android.ims.internal.IImsConfig; 27import com.android.ims.internal.IImsEcbm; 28import com.android.ims.internal.IImsMultiEndpoint; 29import com.android.ims.internal.IImsRegistrationListener; 30import com.android.ims.internal.IImsUt; 31 32/** 33 * MMTel interface for an ImsService. When updating this interface, ensure that base implementations 34 * of your changes are also present in MMTelFeature for compatibility with older versions of the 35 * MMTel feature. 36 * @hide 37 */ 38 39public interface IMMTelFeature { 40 41 /** 42 * Notifies the MMTel feature that you would like to start a session. This should always be 43 * done before making/receiving IMS calls. The IMS service will register the device to the 44 * operator's network with the credentials (from ISIM) periodically in order to receive calls 45 * from the operator's network. When the IMS service receives a new call, it will send out an 46 * intent with the provided action string. The intent contains a call ID extra 47 * {@link IImsCallSession#getCallId} and it can be used to take a call. 48 * 49 * @param incomingCallIntent When an incoming call is received, the IMS service will call 50 * {@link PendingIntent#send} to send back the intent to the caller with 51 * {@link #INCOMING_CALL_RESULT_CODE} as the result code and the intent to fill in the call ID; 52 * It cannot be null. 53 * @param listener To listen to IMS registration events; It cannot be null 54 * @return an integer (greater than 0) representing the session id associated with the session 55 * that has been started. 56 */ 57 int startSession(PendingIntent incomingCallIntent, IImsRegistrationListener listener) 58 throws RemoteException; 59 60 /** 61 * End a previously started session using the associated sessionId. 62 * @param sessionId an integer (greater than 0) representing the ongoing session. See 63 * {@link #startSession}. 64 */ 65 void endSession(int sessionId) throws RemoteException; 66 67 /** 68 * Checks if the IMS service has successfully registered to the IMS network with the specified 69 * service & call type. 70 * 71 * @param sessionId a session id which is obtained from {@link #startSession} 72 * @param callServiceType a service type that is specified in {@link ImsCallProfile} 73 * {@link ImsCallProfile#SERVICE_TYPE_NORMAL} 74 * {@link ImsCallProfile#SERVICE_TYPE_EMERGENCY} 75 * @param callType a call type that is specified in {@link ImsCallProfile} 76 * {@link ImsCallProfile#CALL_TYPE_VOICE_N_VIDEO} 77 * {@link ImsCallProfile#CALL_TYPE_VOICE} 78 * {@link ImsCallProfile#CALL_TYPE_VT} 79 * {@link ImsCallProfile#CALL_TYPE_VS} 80 * @return true if the specified service id is connected to the IMS network; false otherwise 81 * @throws RemoteException 82 */ 83 boolean isConnected(int sessionId, int callServiceType, int callType) throws RemoteException; 84 85 /** 86 * Checks if the specified IMS service is opened. 87 * 88 * @param sessionId a service id which is obtained from {@link #startSession} 89 * @return true if the specified service id is opened; false otherwise 90 */ 91 boolean isOpened(int sessionId) throws RemoteException; 92 93 /** 94 * Add a new registration listener for the client associated with the session Id. 95 * @param sessionId a session id which is obtained from {@link #startSession} 96 * @param listener An implementation of IImsRegistrationListener. 97 */ 98 void addRegistrationListener(int sessionId, IImsRegistrationListener listener) 99 throws RemoteException; 100 101 /** 102 * Remove a previously registered listener using {@link #addRegistrationListener} for the client 103 * associated with the session Id. 104 * @param sessionId a session id which is obtained from {@link #startSession} 105 * @param listener A previously registered IImsRegistrationListener 106 */ 107 void removeRegistrationListener(int sessionId, IImsRegistrationListener listener) 108 throws RemoteException; 109 110 /** 111 * Creates a {@link ImsCallProfile} from the service capabilities & IMS registration state. 112 * 113 * @param sessionId a session id which is obtained from {@link #startSession} 114 * @param callServiceType a service type that is specified in {@link ImsCallProfile} 115 * {@link ImsCallProfile#SERVICE_TYPE_NONE} 116 * {@link ImsCallProfile#SERVICE_TYPE_NORMAL} 117 * {@link ImsCallProfile#SERVICE_TYPE_EMERGENCY} 118 * @param callType a call type that is specified in {@link ImsCallProfile} 119 * {@link ImsCallProfile#CALL_TYPE_VOICE} 120 * {@link ImsCallProfile#CALL_TYPE_VT} 121 * {@link ImsCallProfile#CALL_TYPE_VT_TX} 122 * {@link ImsCallProfile#CALL_TYPE_VT_RX} 123 * {@link ImsCallProfile#CALL_TYPE_VT_NODIR} 124 * {@link ImsCallProfile#CALL_TYPE_VS} 125 * {@link ImsCallProfile#CALL_TYPE_VS_TX} 126 * {@link ImsCallProfile#CALL_TYPE_VS_RX} 127 * @return a {@link ImsCallProfile} object 128 */ 129 ImsCallProfile createCallProfile(int sessionId, int callServiceType, int callType) 130 throws RemoteException; 131 132 /** 133 * Creates a {@link ImsCallSession} with the specified call profile. 134 * Use other methods, if applicable, instead of interacting with 135 * {@link ImsCallSession} directly. 136 * 137 * @param sessionId a session id which is obtained from {@link #startSession} 138 * @param profile a call profile to make the call 139 * @param listener An implementation of IImsCallSessionListener. 140 */ 141 IImsCallSession createCallSession(int sessionId, ImsCallProfile profile, 142 IImsCallSessionListener listener) throws RemoteException; 143 144 /** 145 * Retrieves the call session associated with a pending call. 146 * 147 * @param sessionId a session id which is obtained from {@link #startSession} 148 * @param callId a call id to make the call 149 */ 150 IImsCallSession getPendingCallSession(int sessionId, String callId) throws RemoteException; 151 152 /** 153 * @return The Ut interface for the supplementary service configuration. 154 */ 155 IImsUt getUtInterface(int sessionId) throws RemoteException; 156 157 /** 158 * @return The config interface for IMS Configuration 159 */ 160 IImsConfig getConfigInterface(int sessionId) throws RemoteException; 161 162 /** 163 * Signal the MMTelFeature to turn on IMS when it has been turned off using {@link #turnOffIms} 164 * @param sessionId a session id which is obtained from {@link #startSession} 165 */ 166 void turnOnIms(int sessionId) throws RemoteException; 167 168 /** 169 * Signal the MMTelFeature to turn off IMS when it has been turned on using {@link #turnOnIms} 170 * @param sessionId a session id which is obtained from {@link #startSession} 171 */ 172 void turnOffIms(int sessionId) throws RemoteException; 173 174 /** 175 * @return The Emergency call-back mode interface for emergency VoLTE calls that support it. 176 */ 177 IImsEcbm getEcbmInterface(int sessionId) throws RemoteException; 178 179 /** 180 * Sets the current UI TTY mode for the MMTelFeature. 181 * @param sessionId a session id which is obtained from {@link #startSession} 182 * @param uiTtyMode An integer containing the new UI TTY Mode. 183 * @param onComplete A {@link Message} to be used when the mode has been set. 184 * @throws RemoteException 185 */ 186 void setUiTTYMode(int sessionId, int uiTtyMode, Message onComplete) throws RemoteException; 187 188 /** 189 * @return MultiEndpoint interface for DEP notifications 190 */ 191 IImsMultiEndpoint getMultiEndpointInterface(int sessionId) throws RemoteException; 192} 193