public class ImsManager extends Object
getInstance()
.
The APIs in this class allows you to:
Modifier and Type | Field and Description |
---|---|
static String |
ACTION_IMS_INCOMING_CALL
Action for the incoming call intent for the Phone app.
|
static String |
ACTION_IMS_REGISTRATION_ERROR
Action to broadcast when ImsService registration fails.
|
static String |
ACTION_IMS_SERVICE_DOWN
Action to broadcast when ImsService is down.
|
static String |
ACTION_IMS_SERVICE_UP
Action to broadcast when ImsService is up.
|
static String |
EXTRA_CALL_ID
Key to retrieve the call ID from an incoming call intent.
|
static String |
EXTRA_IS_UNKNOWN_CALL
Part of the ACTION_IMS_INCOMING_CALL intents.
|
static String |
EXTRA_PHONE_ID
Part of the ACTION_IMS_SERVICE_UP or _DOWN intents.
|
static String |
EXTRA_SERVICE_ID
Part of the ACTION_IMS_INCOMING_CALL intents.
|
static String |
EXTRA_USSD
Part of the ACTION_IMS_INCOMING_CALL intents.
|
static String |
FALSE |
static int |
INCOMING_CALL_RESULT_CODE
The result code to be sent back with the incoming call
PendingIntent . |
static String |
PROPERTY_DBG_ALLOW_IMS_OFF_OVERRIDE |
static int |
PROPERTY_DBG_ALLOW_IMS_OFF_OVERRIDE_DEFAULT |
static String |
PROPERTY_DBG_VOLTE_AVAIL_OVERRIDE |
static int |
PROPERTY_DBG_VOLTE_AVAIL_OVERRIDE_DEFAULT |
static String |
PROPERTY_DBG_VT_AVAIL_OVERRIDE |
static int |
PROPERTY_DBG_VT_AVAIL_OVERRIDE_DEFAULT |
static String |
PROPERTY_DBG_WFC_AVAIL_OVERRIDE |
static int |
PROPERTY_DBG_WFC_AVAIL_OVERRIDE_DEFAULT |
static String |
TRUE |
Modifier and Type | Method and Description |
---|---|
void |
addRegistrationListener(int serviceClass,
ImsConnectionStateListener listener)
Adds registration listener to the IMS service.
|
void |
close(int serviceId)
Closes the specified service (
ImsServiceClass ) not to make/receive calls. |
ImsCallProfile |
createCallProfile(int serviceId,
int serviceType,
int callType)
Creates a
ImsCallProfile from the service capabilities & IMS registration state. |
void |
dump(FileDescriptor fd,
PrintWriter pw,
String[] args) |
static void |
factoryReset(Context context)
Resets ImsManager settings back to factory defaults.
|
ImsConfig |
getConfigInterface()
Gets the config interface to get/set service/capability parameters.
|
ImsEcbm |
getEcbmInterface(int serviceId)
Gets the ECBM interface to request ECBM exit.
|
static ImsManager |
getInstance(Context context,
int phoneId)
Gets a manager instance.
|
ImsMultiEndpoint |
getMultiEndpointInterface(int serviceId)
Gets the Multi-Endpoint interface to subscribe to multi-enpoint notifications..
|
ImsUtInterface |
getSupplementaryServiceConfiguration(int serviceId)
Gets the configuration interface to provision / withdraw the supplementary service settings.
|
static int |
getWfcMode(Context context)
Returns the user configuration of WFC preference setting
|
static int |
getWfcMode(Context context,
boolean roaming)
Returns the user configuration of WFC preference setting
|
boolean |
isConnected(int serviceId,
int serviceType,
int callType)
Checks if the IMS service has successfully registered to the IMS network
with the specified service & call type.
|
static boolean |
isEnhanced4gLteModeSettingEnabledByUser(Context context)
Returns the user configuration of Enhanced 4G LTE Mode setting
|
static boolean |
isNonTtyOrTtyOnVolteEnabled(Context context)
Indicates whether the call is non-TTY or if TTY - whether TTY on VoLTE is
supported.
|
boolean |
isOpened(int serviceId)
Checks if the specified IMS service is opend.
|
boolean |
isServiceAvailable() |
static boolean |
isVolteEnabledByPlatform(Context context)
Returns a platform configuration for VoLTE which may override the user setting.
|
static boolean |
isVolteProvisionedOnDevice(Context context)
Indicates whether VoLTE is provisioned on device
|
static boolean |
isVtEnabledByPlatform(Context context)
Returns a platform configuration for VT which may override the user setting.
|
static boolean |
isVtEnabledByUser(Context context)
Returns the user configuration of VT setting
|
static boolean |
isVtProvisionedOnDevice(Context context)
Indicates whether VT is provisioned on device
|
static boolean |
isWfcEnabledByPlatform(Context context)
Returns a platform configuration for WFC which may override the user
setting.
|
static boolean |
isWfcEnabledByUser(Context context)
Returns the user configuration of WFC setting
|
static boolean |
isWfcProvisionedOnDevice(Context context)
Indicates whether VoWifi is provisioned on device
|
static boolean |
isWfcRoamingEnabledByUser(Context context)
Returns the user configuration of WFC roaming setting
|
ImsCall |
makeCall(int serviceId,
ImsCallProfile profile,
String[] callees,
ImsCall.Listener listener)
Creates a
ImsCall to make a call. |
static void |
onProvisionedValueChanged(Context context,
int item,
String value)
This function should be called when ImsConfig.ACTION_IMS_CONFIG_CHANGED is received.
|
int |
open(int serviceClass,
PendingIntent incomingCallPendingIntent,
ImsConnectionStateListener listener)
Opens the IMS service for making calls and/or receiving generic IMS calls.
|
void |
setDataEnabled(boolean enabled)
Set data enabled/disabled flag.
|
static void |
setEnhanced4gLteModeSetting(Context context,
boolean enabled)
Change persistent Enhanced 4G LTE Mode setting
|
void |
setImsConfigListener(ImsConfigListener listener) |
void |
setUiTTYMode(Context context,
int serviceId,
int uiTtyMode,
Message onComplete) |
static void |
setVtSetting(Context context,
boolean enabled)
Change persistent VT enabled setting
|
static void |
setWfcMode(Context context,
int wfcMode)
Change persistent WFC preference setting
|
static void |
setWfcMode(Context context,
int wfcMode,
boolean roaming)
Change persistent WFC preference setting
|
static void |
setWfcRoamingSetting(Context context,
boolean enabled)
Change persistent WFC roaming enabled setting
|
static void |
setWfcSetting(Context context,
boolean enabled)
Change persistent WFC enabled setting
|
ImsCall |
takeCall(int serviceId,
Intent incomingCallIntent,
ImsCall.Listener listener)
Creates a
ImsCall to take an incoming call. |
static void |
updateImsServiceConfig(Context context,
int phoneId,
boolean force)
Sync carrier config and user settings with ImsConfig.
|
public static final String PROPERTY_DBG_VOLTE_AVAIL_OVERRIDE
public static final int PROPERTY_DBG_VOLTE_AVAIL_OVERRIDE_DEFAULT
public static final String PROPERTY_DBG_VT_AVAIL_OVERRIDE
public static final int PROPERTY_DBG_VT_AVAIL_OVERRIDE_DEFAULT
public static final String PROPERTY_DBG_WFC_AVAIL_OVERRIDE
public static final int PROPERTY_DBG_WFC_AVAIL_OVERRIDE_DEFAULT
public static final String PROPERTY_DBG_ALLOW_IMS_OFF_OVERRIDE
public static final int PROPERTY_DBG_ALLOW_IMS_OFF_OVERRIDE_DEFAULT
public static final int INCOMING_CALL_RESULT_CODE
PendingIntent
.#open(PendingIntent, ImsConnectionStateListener)
,
Constant Field Valuespublic static final String EXTRA_CALL_ID
#open(PendingIntent, ImsConnectionStateListener)
,
Constant Field Valuespublic static final String ACTION_IMS_SERVICE_UP
public static final String ACTION_IMS_SERVICE_DOWN
public static final String ACTION_IMS_REGISTRATION_ERROR
public static final String EXTRA_PHONE_ID
public static final String ACTION_IMS_INCOMING_CALL
public static final String EXTRA_SERVICE_ID
open(int, android.app.PendingIntent, com.android.ims.ImsConnectionStateListener)
.
Internal use only.public static final String EXTRA_USSD
public static final String EXTRA_IS_UNKNOWN_CALL
public static final String TRUE
public static final String FALSE
public static ImsManager getInstance(Context context, int phoneId)
context
- application context for creating the manager objectphoneId
- the phone ID for the IMS Servicepublic static boolean isEnhanced4gLteModeSettingEnabledByUser(Context context)
public static void setEnhanced4gLteModeSetting(Context context, boolean enabled)
public static boolean isNonTtyOrTtyOnVolteEnabled(Context context)
public static boolean isVolteEnabledByPlatform(Context context)
public static boolean isVolteProvisionedOnDevice(Context context)
public static boolean isWfcProvisionedOnDevice(Context context)
public static boolean isVtProvisionedOnDevice(Context context)
public static boolean isVtEnabledByPlatform(Context context)
public static boolean isVtEnabledByUser(Context context)
public static void setVtSetting(Context context, boolean enabled)
public static boolean isWfcEnabledByUser(Context context)
public static void setWfcSetting(Context context, boolean enabled)
public static int getWfcMode(Context context)
public static void setWfcMode(Context context, int wfcMode)
public static int getWfcMode(Context context, boolean roaming)
roaming
- false
for home network setting, true
for roaming settingpublic static void setWfcMode(Context context, int wfcMode, boolean roaming)
roaming
- false
for home network setting, true
for roaming settingpublic static boolean isWfcRoamingEnabledByUser(Context context)
public static void setWfcRoamingSetting(Context context, boolean enabled)
public static boolean isWfcEnabledByPlatform(Context context)
public static void onProvisionedValueChanged(Context context, int item, String value)
public static void updateImsServiceConfig(Context context, int phoneId, boolean force)
context
- for the manager objectphoneId
- phone idforce
- updatepublic boolean isServiceAvailable()
public void setImsConfigListener(ImsConfigListener listener)
public int open(int serviceClass, PendingIntent incomingCallPendingIntent, ImsConnectionStateListener listener) throws ImsException
makeCall(int, com.android.ims.ImsCallProfile, java.lang.String[], com.android.ims.ImsCall.Listener)
.
The IMS service will register the device to the operator's network with the credentials
(from ISIM) periodically in order to receive calls from the operator's network.
When the IMS service receives a new call, it will send out an intent with
the provided action string.
The intent contains a call ID extra getCallId
and it can be used to take a call.serviceClass
- a service class specified in ImsServiceClass
For VoLTE service, it MUST be a ImsServiceClass.MMTEL
.incomingCallPendingIntent
- When an incoming call is received,
the IMS service will call PendingIntent.send(Context, int, Intent)
to
send back the intent to the caller with INCOMING_CALL_RESULT_CODE
as the result code and the intent to fill in the call ID; It cannot be nulllistener
- To listen to IMS registration events; It cannot be nullNullPointerException
- if incomingCallPendingIntent
or listener
is nullImsException
- if calling the IMS service results in an errorgetCallId(android.content.Intent)
,
getServiceId(android.content.Intent)
public void addRegistrationListener(int serviceClass, ImsConnectionStateListener listener) throws ImsException
serviceClass
- a service class specified in ImsServiceClass
For VoLTE service, it MUST be a ImsServiceClass.MMTEL
.listener
- To listen to IMS registration events; It cannot be nullNullPointerException
- if listener
is nullImsException
- if calling the IMS service results in an errorpublic void close(int serviceId) throws ImsException
ImsServiceClass
) not to make/receive calls.
All the resources that were allocated to the service are also released.serviceId
- a service id to be closed which is obtained from open(int, android.app.PendingIntent, com.android.ims.ImsConnectionStateListener)
ImsException
- if calling the IMS service results in an errorpublic ImsUtInterface getSupplementaryServiceConfiguration(int serviceId) throws ImsException
serviceId
- a service id which is obtained from open(int, android.app.PendingIntent, com.android.ims.ImsConnectionStateListener)
ImsException
- if getting the Ut interface results in an errorpublic boolean isConnected(int serviceId, int serviceType, int callType) throws ImsException
serviceId
- a service id which is obtained from open(int, android.app.PendingIntent, com.android.ims.ImsConnectionStateListener)
serviceType
- a service type that is specified in ImsCallProfile
ImsCallProfile.SERVICE_TYPE_NORMAL
ImsCallProfile.SERVICE_TYPE_EMERGENCY
callType
- a call type that is specified in ImsCallProfile
ImsCallProfile.CALL_TYPE_VOICE_N_VIDEO
ImsCallProfile.CALL_TYPE_VOICE
ImsCallProfile.CALL_TYPE_VT
ImsCallProfile.CALL_TYPE_VS
ImsException
- if calling the IMS service results in an errorpublic boolean isOpened(int serviceId) throws ImsException
serviceId
- a service id which is obtained from open(int, android.app.PendingIntent, com.android.ims.ImsConnectionStateListener)
ImsException
- if calling the IMS service results in an errorpublic ImsCallProfile createCallProfile(int serviceId, int serviceType, int callType) throws ImsException
ImsCallProfile
from the service capabilities & IMS registration state.serviceId
- a service id which is obtained from open(int, android.app.PendingIntent, com.android.ims.ImsConnectionStateListener)
serviceType
- a service type that is specified in ImsCallProfile
ImsCallProfile.SERVICE_TYPE_NONE
ImsCallProfile.SERVICE_TYPE_NORMAL
ImsCallProfile.SERVICE_TYPE_EMERGENCY
callType
- a call type that is specified in ImsCallProfile
ImsCallProfile.CALL_TYPE_VOICE
ImsCallProfile.CALL_TYPE_VT
ImsCallProfile.CALL_TYPE_VT_TX
ImsCallProfile.CALL_TYPE_VT_RX
ImsCallProfile.CALL_TYPE_VT_NODIR
ImsCallProfile.CALL_TYPE_VS
ImsCallProfile.CALL_TYPE_VS_TX
ImsCallProfile.CALL_TYPE_VS_RX
ImsCallProfile
objectImsException
- if calling the IMS service results in an errorpublic ImsCall makeCall(int serviceId, ImsCallProfile profile, String[] callees, ImsCall.Listener listener) throws ImsException
ImsCall
to make a call.serviceId
- a service id which is obtained from open(int, android.app.PendingIntent, com.android.ims.ImsConnectionStateListener)
profile
- a call profile to make the call
(it contains service type, call type, media information, etc.)participants
- participants to invite the conference calllistener
- listen to the call events from ImsCall
ImsCall
objectImsException
- if calling the IMS service results in an errorpublic ImsCall takeCall(int serviceId, Intent incomingCallIntent, ImsCall.Listener listener) throws ImsException
ImsCall
to take an incoming call.serviceId
- a service id which is obtained from open(int, android.app.PendingIntent, com.android.ims.ImsConnectionStateListener)
incomingCallIntent
- the incoming call broadcast intentlistener
- to listen to the call events from ImsCall
ImsCall
objectImsException
- if calling the IMS service results in an errorpublic ImsConfig getConfigInterface() throws ImsException
ImsException
- if getting the setting interface results in an error.public void setUiTTYMode(Context context, int serviceId, int uiTtyMode, Message onComplete) throws ImsException
ImsException
public ImsEcbm getEcbmInterface(int serviceId) throws ImsException
serviceId
- a service id which is obtained from open(int, android.app.PendingIntent, com.android.ims.ImsConnectionStateListener)
ImsException
- if getting the ECBM interface results in an errorpublic ImsMultiEndpoint getMultiEndpointInterface(int serviceId) throws ImsException
serviceId
- a service id which is obtained from open(int, android.app.PendingIntent, com.android.ims.ImsConnectionStateListener)
ImsException
- if getting the multi-endpoint interface results in an errorpublic static void factoryReset(Context context)
public void setDataEnabled(boolean enabled)
enabled
- True if data is enabled, otherwise disabled.public void dump(FileDescriptor fd, PrintWriter pw, String[] args)