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 
17 package android.telephony.ims.feature;
18 
19 import android.app.PendingIntent;
20 import android.os.Message;
21 import android.os.RemoteException;
22 
23 import com.android.ims.ImsCallProfile;
24 import com.android.ims.internal.IImsCallSession;
25 import com.android.ims.internal.IImsCallSessionListener;
26 import com.android.ims.internal.IImsConfig;
27 import com.android.ims.internal.IImsEcbm;
28 import com.android.ims.internal.IImsMultiEndpoint;
29 import com.android.ims.internal.IImsRegistrationListener;
30 import 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 
39 public 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      */
startSession(PendingIntent incomingCallIntent, IImsRegistrationListener listener)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      */
endSession(int sessionId)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 callServiceType a service type that is specified in {@link ImsCallProfile}
72      *        {@link ImsCallProfile#SERVICE_TYPE_NORMAL}
73      *        {@link ImsCallProfile#SERVICE_TYPE_EMERGENCY}
74      * @param callType a call type that is specified in {@link ImsCallProfile}
75      *        {@link ImsCallProfile#CALL_TYPE_VOICE_N_VIDEO}
76      *        {@link ImsCallProfile#CALL_TYPE_VOICE}
77      *        {@link ImsCallProfile#CALL_TYPE_VT}
78      *        {@link ImsCallProfile#CALL_TYPE_VS}
79      * @return true if the specified service id is connected to the IMS network; false otherwise
80      * @throws RemoteException
81      */
isConnected(int callServiceType, int callType)82     boolean isConnected(int callServiceType, int callType) throws RemoteException;
83 
84     /**
85      * Checks if the specified IMS service is opened.
86      *
87      * @return true if the specified service id is opened; false otherwise
88      */
isOpened()89     boolean isOpened() throws RemoteException;
90 
91     /**
92      * Add a new registration listener for the client associated with the session Id.
93      * @param listener An implementation of IImsRegistrationListener.
94      */
addRegistrationListener(IImsRegistrationListener listener)95     void addRegistrationListener(IImsRegistrationListener listener)
96             throws RemoteException;
97 
98     /**
99      * Remove a previously registered listener using {@link #addRegistrationListener} for the client
100      * associated with the session Id.
101      * @param listener A previously registered IImsRegistrationListener
102      */
removeRegistrationListener(IImsRegistrationListener listener)103     void removeRegistrationListener(IImsRegistrationListener listener)
104             throws RemoteException;
105 
106     /**
107      * Creates a {@link ImsCallProfile} from the service capabilities & IMS registration state.
108      *
109      * @param sessionId a session id which is obtained from {@link #startSession}
110      * @param callServiceType a service type that is specified in {@link ImsCallProfile}
111      *        {@link ImsCallProfile#SERVICE_TYPE_NONE}
112      *        {@link ImsCallProfile#SERVICE_TYPE_NORMAL}
113      *        {@link ImsCallProfile#SERVICE_TYPE_EMERGENCY}
114      * @param callType a call type that is specified in {@link ImsCallProfile}
115      *        {@link ImsCallProfile#CALL_TYPE_VOICE}
116      *        {@link ImsCallProfile#CALL_TYPE_VT}
117      *        {@link ImsCallProfile#CALL_TYPE_VT_TX}
118      *        {@link ImsCallProfile#CALL_TYPE_VT_RX}
119      *        {@link ImsCallProfile#CALL_TYPE_VT_NODIR}
120      *        {@link ImsCallProfile#CALL_TYPE_VS}
121      *        {@link ImsCallProfile#CALL_TYPE_VS_TX}
122      *        {@link ImsCallProfile#CALL_TYPE_VS_RX}
123      * @return a {@link ImsCallProfile} object
124      */
createCallProfile(int sessionId, int callServiceType, int callType)125     ImsCallProfile createCallProfile(int sessionId, int callServiceType, int callType)
126             throws RemoteException;
127 
128     /**
129      * Creates a {@link ImsCallSession} with the specified call profile.
130      * Use other methods, if applicable, instead of interacting with
131      * {@link ImsCallSession} directly.
132      *
133      * @param sessionId a session id which is obtained from {@link #startSession}
134      * @param profile a call profile to make the call
135      * @param listener An implementation of IImsCallSessionListener.
136      */
createCallSession(int sessionId, ImsCallProfile profile, IImsCallSessionListener listener)137     IImsCallSession createCallSession(int sessionId, ImsCallProfile profile,
138             IImsCallSessionListener listener) throws RemoteException;
139 
140     /**
141      * Retrieves the call session associated with a pending call.
142      *
143      * @param sessionId a session id which is obtained from {@link #startSession}
144      * @param callId a call id to make the call
145      */
getPendingCallSession(int sessionId, String callId)146     IImsCallSession getPendingCallSession(int sessionId, String callId) throws RemoteException;
147 
148     /**
149      * @return The Ut interface for the supplementary service configuration.
150      */
getUtInterface()151     IImsUt getUtInterface() throws RemoteException;
152 
153     /**
154      * @return The config interface for IMS Configuration
155      */
getConfigInterface()156     IImsConfig getConfigInterface() throws RemoteException;
157 
158     /**
159      * Signal the MMTelFeature to turn on IMS when it has been turned off using {@link #turnOffIms}
160      * @param sessionId a session id which is obtained from {@link #startSession}
161      */
turnOnIms()162     void turnOnIms() throws RemoteException;
163 
164     /**
165      * Signal the MMTelFeature to turn off IMS when it has been turned on using {@link #turnOnIms}
166      * @param sessionId a session id which is obtained from {@link #startSession}
167      */
turnOffIms()168     void turnOffIms() throws RemoteException;
169 
170     /**
171      * @return The Emergency call-back mode interface for emergency VoLTE calls that support it.
172      */
getEcbmInterface()173     IImsEcbm getEcbmInterface() throws RemoteException;
174 
175     /**
176      * Sets the current UI TTY mode for the MMTelFeature.
177      * @param uiTtyMode An integer containing the new UI TTY Mode.
178      * @param onComplete A {@link Message} to be used when the mode has been set.
179      * @throws RemoteException
180      */
setUiTTYMode(int uiTtyMode, Message onComplete)181     void setUiTTYMode(int uiTtyMode, Message onComplete) throws RemoteException;
182 
183     /**
184      * @return MultiEndpoint interface for DEP notifications
185      */
getMultiEndpointInterface()186     IImsMultiEndpoint getMultiEndpointInterface() throws RemoteException;
187 }
188