Package org.robolectric.shadows
Class ShadowTelephonyManager
java.lang.Object
org.robolectric.shadows.ShadowTelephonyManager
@Implements(android.telephony.TelephonyManager.class)
public class ShadowTelephonyManager
extends Object
Shadow for 
TelephonyManager.- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classTestable parameters from calls tosendVisualVoicemailSms(java.lang.String, int, java.lang.String, android.app.PendingIntent).
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidbootstrapAuthenticationRequest(int appType, Uri nafId, Object securityProtocol, boolean forceBootStrapping, Executor e, Object callback) static voidRemoves allsubIdtophoneTypemappings.protected TelephonyManagerReturnsnullby default or the value specified viasetTelephonyManagerForHandle(PhoneAccountHandle, TelephonyManager).protected TelephonyManagercreateForSubscriptionId(int subId) Returnsnullby default or the value specified viasetTelephonyManagerForSubscriptionId(int, TelephonyManager)static ObjectcreateTelephonyDisplayInfo(int networkType, int overrideNetworkType) Creates aTelephonyDisplayInfo.protected intReturns 1 by default or the value specified viasetActiveModemCount(int).protected <T> Iterable<T> getCallbackForListener(Class<T> clazz) Returns a view oftelephonyCallbackRegistrationscontaining all elements that are of the typeclazz.protected intprotected intCall state may be specified viasetCallState(int).protected intCall state may be specified viasetCallState(int).protected PersistableBundleReturns a new emptyPersistableBundleby default, or the value specified viasetCarrierConfig(PersistableBundle).protected intgetCarrierPackageNamesForIntentAndPhone(Intent intent, int phoneId) protected ObjectImplementation forTelephonyManager.getCarrierRestrictionRules()that is set for tests byTelephonyManager.setCarrierRestrictionRules(android.telephony.CarrierRestrictionRules).protected CellLocationprotected intgetCurrentPhoneType(int subId) protected intReturnsTelephonyManager.SIM_ACTIVATION_STATE_UNKNOWNby default or the value specified viasetDataActivationState(int).protected intData activity may be specified viasetDataActivity(int).protected intReturns whatever value was set by the last call tosetDataNetworkType(int), defaulting toTelephonyManager.NETWORK_TYPE_UNKNOWNif it was never called.protected intData state may be specified viasetDataState(int).protected Stringprotected StringgetDeviceId(int slot) Returnsnullby default or the value specified viasetDeviceId(int, String).protected Stringprotected booleanprotected Map<Integer, List<EmergencyNumber>> Implementation forTelephonyManager.getEmergencyNumberList().intDeprecated.Avoid using.protected Stringprotected StringgetIccAuthentication(int appType, int authType, String data) protected StringgetImei()protected StringgetImei(int slotIndex) Returns the most recent callback passed to #registerTelephonyCallback().protected StringDeprecated.Avoid using.protected Iterable<PhoneStateListener> getListenersForFlags(int flags) protected StringgetMeid()protected StringgetMeid(int slotIndex) intprotected StringReturns the SIM country lowercase.protected Stringprotected Stringprotected Stringprotected intprotected intReturns 1 by default or the value specified viasetPhoneCount(int).protected intprotected StringReturns immutable list of special codes sent usingTelephonyManager.sendDialerSpecialCode(String).protected ServiceStateReturnsnullby default or the value specified viasetServiceState(ServiceState)protected ServiceStategetServiceState(int includeLocationData) Returnsnullby default or the value specified viasetServiceState(ServiceState)protected SignalStrengthprotected intprotected CharSequenceprotected StringReturns the SIM country lowercase.protected StringgetSimCountryIso(int subId) protected LocaleReturns sim locale set bysetSimLocale(java.util.Locale).protected Stringprotected Stringprotected Stringprotected intprotected intprotected intgetSimState(int slotIndex) protected static intgetSimStateForSlotIndex(int slotIndex) protected Stringprotected intgetSubscriptionId(PhoneAccountHandle handle) protected List<?> Returns the UICC cards information set bysetUiccCardsInfo(java.lang.Object).protected ObjectReturns the UICC slots information set bysetUiccSlotsInfo(java.lang.Object).protected StringReturns the value set bysetVisualVoicemailPackageName(String).Returns the last setVisualVoicemailSmsFilterSettings.protected intReturnsTelephonyManager.VOICE_ACTIVATION_STATE_ACTIVATEDby default or the value specified viasetVoiceActivationState(int).protected StringReturnsnullby default or the value specified viasetVoiceMailAlphaTag(String).protected StringReturnsnullby default, or the value specified viasetVoiceMailNumber(String).protected UriReturnsnullby default or the value specified viasetVoicemailRingtoneUri(PhoneAccountHandle, Uri).protected intReturns whatever value was set by the last call tosetVoiceNetworkType(int), defaulting toTelephonyManager.NETWORK_TYPE_UNKNOWNif it was never called.protected booleanhasCarrierPrivileges(int subId) protected voidinitListener(PhoneStateListener listener, int flags) protected voidinitTelephonyCallback(Object callback) protected booleanprotected booleanImplementation forTelephonyManager.isDataEnabled().protected booleanisDataEnabledForReason(int reason) Implementation forTelephonyManager.isDataEnabledForReason(int).protected booleanImplementation forTelephonyManager.isDataRoamingEnabled().protected booleanReturns true by default, or the value specified viasetDeviceSmsCapable(boolean).protected booleanReturnstrueby default or the value specified viasetDeviceVoiceCapable(boolean).protected booleanisEmergencyNumber(String number) Cribbed fromPhoneNumberUtils.isEmergencyNumberInternal(int, java.lang.String).protected booleanImplementation forTelephonyManager.isHearingAidCompatibilitySupported().protected booleanReturnsfalseby default or the value specified viasetIsNetworkRoaming(boolean)protected booleanisPotentialEmergencyNumber(String number) protected booleanImplementation forTelephonyManager.isRttSupported().protected booleanprotected booleanImplementation forTelephonyManager.isTtyModeSupported().protected booleanReturnstrueby default or the value specified viasetVoiceCapable(boolean).protected booleanReturnsnullby default or the value specified viasetVoicemailVibrationEnabled(PhoneAccountHandle, boolean).protected voidlisten(PhoneStateListener listener, int flags) protected voidImplementation forTelephonyManager.rebootModem()protected voidregisterTelephonyCallback(int includeLocationData, Executor executor, Object callback) voidregisterTelephonyCallback(Executor executor, Object callback) protected voidrequestCellInfoUpdate(Executor executor, Object cellInfoCallback) Returns the value set bysetCallbackCellInfos(java.util.List<android.telephony.CellInfo>), defaulting to calling the realTelephonyManager.NETWORK_TYPE_UNKNOWNif it was never called.static voidreset()static voidClearssubIdto simCountryIso mapping and resets to default state.static voidClearsslotIndexto state mapping and resets to default state.voidDeprecated.for resetAllSimCountryIsosvoidDeprecated.use resetAllSimStates()voidsendDialerSpecialCode(String inputCode) Implementation forTelephonyManager.sendDialerSpecialCode(String).voidsendVisualVoicemailSms(String number, int port, String text, PendingIntent sentIntent) voidsetActiveModemCount(int activeModemCount) Sets the value returned byTelephonyManager.getActiveModemCount().voidsetAllCellInfo(List<CellInfo> allCellInfo) voidsetCallbackCellInfos(List<CellInfo> callbackCellInfos) Sets the value to be returned by calls torequestCellInfoUpdate(java.util.concurrent.Executor, java.lang.Object).protected voidsetCallComposerStatus(int callComposerStatus) voidsetCallState(int callState) Sets the current call state to the desired state and updates any listeners.voidsetCallState(int callState, String incomingPhoneNumber) Sets the current call state with the option to specify an incoming phone number for the CALL_STATE_RINGING state.voidsetCarrierConfig(PersistableBundle carrierConfig) Sets the value returned byTelephonyManager.getCarrierConfig().voidsetCarrierIdFromSimMccMnc(int carrierIdFromSimMccMnc) Sets the value to be returned bygetCarrierIdFromSimMccMnc().voidsetCarrierPackageNamesForPhone(int phoneId, List<String> packages) Sets thepackagesfor the givenphoneId.voidsetCarrierRestrictionRules(Object carrierRestrictionRules) Sets the value to be returned bygetCarrierRestrictionRules().voidsetCellLocation(CellLocation cellLocation) voidsetCurrentPhoneType(int subId, int phoneType) Sets the phone type for the givensubId.voidsetDataActivationState(int dataActivationState) Sets the value returned bygetDataActivationState().voidsetDataActivity(int dataActivity) Sets the value to be returned by calls togetDataActivity().voidsetDataEnabled(boolean enabled) Implementation forTelephonyManager.setDataEnabled(boolean).voidsetDataEnabledForReason(int reason, boolean enabled) Implementation forTelephonyManager.setDataEnabledForReason(int, boolean).voidsetDataNetworkType(int dataNetworkType) Sets the value to be returned by calls togetDataNetworkType().protected voidsetDataRoamingEnabled(boolean isDataRoamingEnabled) Sets the value to be returned byisDataRoamingEnabled()voidsetDataState(int dataState) Sets the data state returned bygetDataState().voidsetDeviceId(int slot, String deviceId) Sets the value returned byTelephonyManager.getDeviceId(int).voidsetDeviceId(String newDeviceId) voidsetDeviceSmsCapable(boolean isSmsCapable) Sets the value returned byisDeviceSmsCapable().voidsetDeviceSoftwareVersion(String newDeviceSoftwareVersion) voidsetDeviceVoiceCapable(boolean voiceCapable) Sets the value returned byisDeviceVoiceCapable().voidsetEmergencyCallbackMode(boolean emergencyCallbackMode) Emergency Callback Mode (ECBM) is typically set by the carrier, for a time window of 5 minutes after the last outgoing emergency call.static voidsetEmergencyNumberList(Map<Integer, List<EmergencyNumber>> emergencyNumbersList) Sets the emergency numbers list returned byTelephonyManager.getEmergencyNumberList().voidsetGroupIdLevel1(String groupIdLevel1) voidsetHasCarrierPrivileges(boolean hasCarrierPrivileges) voidsetHasCarrierPrivileges(int subId, boolean hasCarrierPrivileges) Sets thehasCarrierPrivilegesfor the givensubId.voidsetHearingAidCompatibilitySupported(boolean isSupported) Sets the value to be returned byisHearingAidCompatibilitySupported().voidsetIccAuthentication(String iccAuthentication) voidSet the IMEI returned bygetImei(int).voidSet the IMEI returned by getImei().voidsetIsDataConnectionAllowed(boolean isDataConnectionAllowed) voidsetIsNetworkRoaming(boolean isNetworkRoaming) Sets the value returned byTelephonyManager.isNetworkRoaming().voidsetIsSmsCapable(boolean isSmsCapable) Sets the value returned byTelephonyManager.isSmsCapable().voidsetLine1Number(String line1Number) voidSet the MEID returned bygetMeid(int).voidSet the MEID returned by getMeid().voidsetNetworkCountryIso(String networkCountryIso) Sets the network country ISO returned bygetNetworkCountryIso().voidsetNetworkOperator(String networkOperator) voidsetNetworkOperatorName(String networkOperatorName) voidsetNetworkOperatorNameForPhone(int phoneId, String networkOperatorName) voidsetNetworkSpecifier(String networkSpecifier) voidsetNetworkType(int networkType) Deprecated.TelephonyManager.getNetworkType()was replaced withTelephonyManager.getDataNetworkType()in Android N, and has been deprecated in Android R.voidsetPhoneAccountHandleSubscriptionId(PhoneAccountHandle handle, int subscriptionId) voidsetPhoneCapability(Object phoneCapability) voidsetPhoneCount(int phoneCount) Sets the value returned byTelephonyManager.getPhoneCount().voidsetPhoneType(int phoneType) voidsetPhoneType(int phoneId, int type) voidsetPrimaryImeiSlotIndex(int primaryImeiSlotIndex) Set the primary IMEI slot index forgetPrimaryImei().voidsetReadPhoneStatePermission(boolean readPhoneStatePermission) voidsetRequestCellInfoUpdateErrorValues(int errorCode, Throwable detail) Sets the values to be returned by a presumed error condition inrequestCellInfoUpdate(java.util.concurrent.Executor, java.lang.Object).voidsetRttSupported(boolean isRttSupported) Sets the value to be returned byisRttSupported()voidsetServiceState(ServiceState serviceState) Sets the value returned byTelephonyManager.getServiceState().voidsetSignalStrength(SignalStrength signalStrength) Sets the value to be returned bygetSignalStrength()voidsetSimCarrierId(int simCarrierId) Sets the value to be returned bygetSimCarrierId().voidsetSimCarrierIdName(CharSequence simCarrierIdName) Sets the value to be returned bygetSimCarrierIdName().voidsetSimCountryIso(int subId, String simCountryIso) Sets thesimCountryIsofor the givensubId.voidsetSimCountryIso(String simCountryIso) voidsetSimLocale(Locale simLocale) Sets the sim locale returned bygetSimLocale().voidsetSimOperator(String simOperator) voidsetSimOperatorName(String simOperatorName) voidsetSimOperatorNameForPhone(int phoneId, String name) voidsetSimSerialNumber(String simSerialNumber) sets the serial number that will be returned bygetSimSerialNumber().voidsetSimSpecificCarrierId(int simSpecificCarrierId) Sets the value to be returned bygetSimSpecificCarrierId().voidsetSimState(int simState) Sets the sim state of slot 0.voidsetSimState(int slotIndex, int state) Set the sim state for the givenslotIndex.voidsetSubscriberId(String subscriberId) Sets the value to be returned bygetSubscriberId().voidsetTelephonyDisplayInfo(Object telephonyDisplayInfo) Sets the currentTelephonyDisplayInfo, and notifies all thePhoneStateListeners that were registered with thePhoneStateListener.LISTEN_DISPLAY_INFO_CHANGEDflag.voidsetTelephonyManagerForHandle(PhoneAccountHandle handle, TelephonyManager telephonyManager) Sets the value returned byTelephonyManager.createForPhoneAccountHandle(PhoneAccountHandle).voidsetTelephonyManagerForSubscriptionId(int subscriptionId, TelephonyManager telephonyManager) Sets the value returned byTelephonyManager.createForSubscriptionId(int).voidsetTtyModeSupported(boolean isTtyModeSupported) Sets the value to be returned byisTtyModeSupported()voidsetUiccCardsInfo(Object uiccCardsInfo) Sets the UICC cards information returned bygetUiccCardsInfo().voidsetUiccSlotsInfo(Object uiccSlotsInfos) Sets the UICC slots information returned bygetUiccSlotsInfo().voidsetVisualVoicemailPackageName(String visualVoicemailPackageName) Sets the value to be returned bygetVisualVoicemailPackageName().voidvoidsetVoiceActivationState(int voiceActivationState) Sets the value returned bygetVoiceActivationState().voidsetVoiceCapable(boolean voiceCapable) Sets the value returned byisVoiceCapable().voidsetVoiceMailAlphaTag(String voiceMailAlphaTag) Sets the value returned byTelephonyManager.getVoiceMailAlphaTag().voidsetVoiceMailNumber(String voiceMailNumber) Sets the value returned byTelephonyManager.getVoiceMailNumber().protected voidsetVoicemailRingtoneUri(PhoneAccountHandle handle, Uri uri) Sets the value returned byTelephonyManager.getVoicemailRingtoneUri(PhoneAccountHandle).protected voidsetVoicemailVibrationEnabled(PhoneAccountHandle handle, boolean isEnabled) Sets the value returned byTelephonyManager.isVoicemailVibrationEnabled(PhoneAccountHandle).voidsetVoiceNetworkType(int voiceNetworkType) Sets the value to be returned by calls togetVoiceNetworkType().voidunregisterTelephonyCallback(Object callback) 
- 
Field Details- 
realTelephonyManager
 
- 
- 
Constructor Details- 
ShadowTelephonyManagerpublic ShadowTelephonyManager()
 
- 
- 
Method Details- 
reset
- 
setCallComposerStatus
- 
getCallComposerStatus
- 
getBootstrapAuthenticationCallback
- 
bootstrapAuthenticationRequest@Implementation(minSdk=31) @HiddenApi public void bootstrapAuthenticationRequest(int appType, Uri nafId, Object securityProtocol, boolean forceBootStrapping, Executor e, Object callback) 
- 
setPhoneCapability
- 
getPhoneCapability
- 
listen
- 
getListenerDeprecated.Avoid using.Returns the most recent listener passed to #listen().- Returns:
- Phone state listener.
 
- 
getEventFlagsDeprecated.Avoid using.Returns the most recent flags passed to #listen().- Returns:
- Event flags.
 
- 
registerTelephonyCallback@Implementation(minSdk=31) public void registerTelephonyCallback(Executor executor, Object callback) 
- 
registerTelephonyCallback@Implementation(minSdk=33) protected void registerTelephonyCallback(int includeLocationData, Executor executor, Object callback) 
- 
unregisterTelephonyCallback
- 
getLastTelephonyCallbackReturns the most recent callback passed to #registerTelephonyCallback().
- 
getCallStateForSubscriptionCall state may be specified viasetCallState(int).
- 
getCallStateCall state may be specified viasetCallState(int).
- 
setCallStatepublic void setCallState(int callState) Sets the current call state to the desired state and updates any listeners.
- 
setCallStateSets the current call state with the option to specify an incoming phone number for the CALL_STATE_RINGING state. The incoming phone number will be ignored for all other cases.
- 
getDataStateData state may be specified viasetDataState(int). If no override is set, this defaults toTelephonyManager.DATA_DISCONNECTED.
- 
setDataStatepublic void setDataState(int dataState) Sets the data state returned bygetDataState().
- 
getDataActivityData activity may be specified viasetDataActivity(int). If no override is set, this defaults toTelephonyManager.DATA_ACTIVITY_NONE.
- 
setDataActivitypublic void setDataActivity(int dataActivity) Sets the value to be returned by calls togetDataActivity(). This should correspond to one of theDATA_ACTIVITY_*constants defined onTelephonyManager, but this is not enforced.
- 
getDeviceId
- 
setDeviceId
- 
getDeviceSoftwareVersion
- 
setDeviceSoftwareVersion
- 
setNetworkOperatorName
- 
setNetworkOperatorNameForPhone@Implementation(minSdk=35) public void setNetworkOperatorNameForPhone(int phoneId, String networkOperatorName) 
- 
getImei
- 
getImei
- 
setImeiSet the IMEI returned by getImei().
- 
setImeiSet the IMEI returned bygetImei(int).
- 
getPrimaryImei
- 
setPrimaryImeiSlotIndexpublic void setPrimaryImeiSlotIndex(int primaryImeiSlotIndex) Set the primary IMEI slot index forgetPrimaryImei().
- 
getMeid
- 
getMeid
- 
setMeidSet the MEID returned by getMeid().
- 
setMeidSet the MEID returned bygetMeid(int).
- 
getNetworkOperatorName
- 
setNetworkCountryIsoSets the network country ISO returned bygetNetworkCountryIso().This mirrors an internal Android API that was removed as the information is now fetched from LocaleTracker.Outside of the Android usage, this is intended as a general purpose setter. On SDK >Q, it will also broadcast TelephonyManager.ACTION_NETWORK_COUNTRY_CHANGED.
- 
getNetworkCountryIsoReturns the SIM country lowercase. This matches the API this shadows: https://developer.android.com/reference/android/telephony/TelephonyManager#getNetworkCountryIso().
- 
setSimLocaleSets the sim locale returned bygetSimLocale().
- 
getSimLocaleReturns sim locale set bysetSimLocale(java.util.Locale).
- 
setNetworkOperator
- 
getNetworkOperator
- 
setNetworkSpecifier
- 
getNetworkSpecifier
- 
getSimOperator
- 
setSimOperator
- 
getSimOperatorName
- 
setSimOperatorName
- 
setSimOperatorNameForPhone
- 
getSimSerialNumber
- 
setSimSerialNumbersets the serial number that will be returned bygetSimSerialNumber().
- 
getSimCountryIsoReturns the SIM country lowercase. This matches the API it shadows: https://developer.android.com/reference/android/telephony/TelephonyManager#getSimCountryIso().
- 
getSimCountryIso
- 
setSimCountryIso
- 
setSimCountryIsoSets thesimCountryIsofor the givensubId.
- 
resetAllSimCountryIsospublic static void resetAllSimCountryIsos()ClearssubIdto simCountryIso mapping and resets to default state.
- 
resetSimCountryIsosDeprecated.for resetAllSimCountryIsosClearssubIdto simCountryIso mapping and resets to default state.
- 
getSimState
- 
setSimStatepublic void setSimState(int simState) Sets the sim state of slot 0.
- 
setSimStatepublic void setSimState(int slotIndex, int state) Set the sim state for the givenslotIndex.
- 
getSimState
- 
getSimStateForSlotIndex
- 
setUiccSlotsInfoSets the UICC slots information returned bygetUiccSlotsInfo().
- 
getUiccSlotsInfoReturns the UICC slots information set bysetUiccSlotsInfo(java.lang.Object).
- 
setUiccCardsInfoSets the UICC cards information returned bygetUiccCardsInfo().
- 
getUiccCardsInfoReturns the UICC cards information set bysetUiccCardsInfo(java.lang.Object).
- 
resetAllSimStatespublic static void resetAllSimStates()ClearsslotIndexto state mapping and resets to default state.
- 
resetSimStatesDeprecated.use resetAllSimStates()ClearsslotIndexto state mapping and resets to default state.
- 
setReadPhoneStatePermissionpublic void setReadPhoneStatePermission(boolean readPhoneStatePermission) 
- 
getPhoneType
- 
setPhoneType
- 
setPhoneType
- 
getLine1Number
- 
setLine1Number
- 
getNetworkType
- 
setNetworkTypeDeprecated.TelephonyManager.getNetworkType()was replaced withTelephonyManager.getDataNetworkType()in Android N, and has been deprecated in Android R. Useinstead.
- 
getDataNetworkTypeReturns whatever value was set by the last call tosetDataNetworkType(int), defaulting toTelephonyManager.NETWORK_TYPE_UNKNOWNif it was never called.
- 
setDataNetworkTypeSets the value to be returned by calls togetDataNetworkType(). This should correspond to one of theNETWORK_TYPE_*constants defined onTelephonyManager, but this is not enforced.
- 
getVoiceNetworkTypeReturns whatever value was set by the last call tosetVoiceNetworkType(int), defaulting toTelephonyManager.NETWORK_TYPE_UNKNOWNif it was never called.An exception will be thrown if the READ_PHONE_STATE permission has not been granted. 
- 
setVoiceNetworkTypepublic void setVoiceNetworkType(int voiceNetworkType) Sets the value to be returned by calls togetVoiceNetworkType(). This should correspond to one of theNETWORK_TYPE_*constants defined onTelephonyManager, but this is not enforced.
- 
getAllCellInfo
- 
setAllCellInfo
- 
requestCellInfoUpdate@Implementation(minSdk=29) protected void requestCellInfoUpdate(Executor executor, Object cellInfoCallback) Returns the value set bysetCallbackCellInfos(java.util.List<android.telephony.CellInfo>), defaulting to calling the realTelephonyManager.NETWORK_TYPE_UNKNOWNif it was never called.
- 
setCallbackCellInfosSets the value to be returned by calls torequestCellInfoUpdate(java.util.concurrent.Executor, java.lang.Object). Note that it does not set the value to be returned by calls togetAllCellInfo(); for that, seesetAllCellInfo(java.util.List<android.telephony.CellInfo>).
- 
setRequestCellInfoUpdateErrorValuesSets the values to be returned by a presumed error condition inrequestCellInfoUpdate(java.util.concurrent.Executor, java.lang.Object). These values will persist until cleared: to clear, set (0, null) using this method.
- 
getCellLocation
- 
setCellLocation
- 
getGroupIdLevel1
- 
setGroupIdLevel1
- 
initListener
- 
initTelephonyCallback
- 
getListenersForFlags
- 
getCallbackForListenerReturns a view oftelephonyCallbackRegistrationscontaining all elements that are of the typeclazz.
- 
isSmsCapable- Returns:
- true by default, or the value specified via setIsSmsCapable(boolean)
 
- 
setIsSmsCapablepublic void setIsSmsCapable(boolean isSmsCapable) Sets the value returned byTelephonyManager.isSmsCapable().
- 
isDeviceSmsCapableReturns true by default, or the value specified viasetDeviceSmsCapable(boolean).
- 
setDeviceSmsCapablepublic void setDeviceSmsCapable(boolean isSmsCapable) Sets the value returned byisDeviceSmsCapable().
- 
getCarrierConfigReturns a new emptyPersistableBundleby default, or the value specified viasetCarrierConfig(PersistableBundle).
- 
setCarrierConfigSets the value returned byTelephonyManager.getCarrierConfig().- Parameters:
- carrierConfig-
 
- 
getVoiceMailNumberReturnsnullby default, or the value specified viasetVoiceMailNumber(String).
- 
setVoiceMailNumberSets the value returned byTelephonyManager.getVoiceMailNumber().
- 
getVoiceMailAlphaTagReturnsnullby default or the value specified viasetVoiceMailAlphaTag(String).
- 
setVoiceMailAlphaTagSets the value returned byTelephonyManager.getVoiceMailAlphaTag().
- 
getPhoneCountReturns 1 by default or the value specified viasetPhoneCount(int).
- 
setPhoneCountpublic void setPhoneCount(int phoneCount) Sets the value returned byTelephonyManager.getPhoneCount().
- 
getActiveModemCountReturns 1 by default or the value specified viasetActiveModemCount(int).
- 
setActiveModemCountpublic void setActiveModemCount(int activeModemCount) Sets the value returned byTelephonyManager.getActiveModemCount().
- 
getDeviceIdReturnsnullby default or the value specified viasetDeviceId(int, String).
- 
setDeviceIdSets the value returned byTelephonyManager.getDeviceId(int).
- 
isVoiceCapableReturnstrueby default or the value specified viasetVoiceCapable(boolean).
- 
setVoiceCapablepublic void setVoiceCapable(boolean voiceCapable) Sets the value returned byisVoiceCapable().
- 
isDeviceVoiceCapableReturnstrueby default or the value specified viasetDeviceVoiceCapable(boolean).
- 
setDeviceVoiceCapablepublic void setDeviceVoiceCapable(boolean voiceCapable) Sets the value returned byisDeviceVoiceCapable().
- 
getVoiceActivationStateReturnsTelephonyManager.VOICE_ACTIVATION_STATE_ACTIVATEDby default or the value specified viasetVoiceActivationState(int).
- 
setVoiceActivationStateSets the value returned bygetVoiceActivationState().
- 
getDataActivationStateReturnsTelephonyManager.SIM_ACTIVATION_STATE_UNKNOWNby default or the value specified viasetDataActivationState(int).
- 
setDataActivationStateSets the value returned bygetDataActivationState().
- 
isVoicemailVibrationEnabledReturnsnullby default or the value specified viasetVoicemailVibrationEnabled(PhoneAccountHandle, boolean).
- 
setVoicemailVibrationEnabled@Implementation(minSdk=26) protected void setVoicemailVibrationEnabled(PhoneAccountHandle handle, boolean isEnabled) Sets the value returned byTelephonyManager.isVoicemailVibrationEnabled(PhoneAccountHandle).
- 
getVoicemailRingtoneUriReturnsnullby default or the value specified viasetVoicemailRingtoneUri(PhoneAccountHandle, Uri).
- 
setVoicemailRingtoneUri@Implementation(minSdk=26) protected void setVoicemailRingtoneUri(PhoneAccountHandle handle, Uri uri) Sets the value returned byTelephonyManager.getVoicemailRingtoneUri(PhoneAccountHandle).
- 
createForPhoneAccountHandle@Implementation(minSdk=26) protected TelephonyManager createForPhoneAccountHandle(PhoneAccountHandle handle) Returnsnullby default or the value specified viasetTelephonyManagerForHandle(PhoneAccountHandle, TelephonyManager).
- 
setTelephonyManagerForHandlepublic void setTelephonyManagerForHandle(PhoneAccountHandle handle, TelephonyManager telephonyManager) Sets the value returned byTelephonyManager.createForPhoneAccountHandle(PhoneAccountHandle).
- 
createForSubscriptionIdReturnsnullby default or the value specified viasetTelephonyManagerForSubscriptionId(int, TelephonyManager)
- 
setTelephonyManagerForSubscriptionIdpublic void setTelephonyManagerForSubscriptionId(int subscriptionId, TelephonyManager telephonyManager) Sets the value returned byTelephonyManager.createForSubscriptionId(int).
- 
getServiceStateReturnsnullby default or the value specified viasetServiceState(ServiceState)
- 
getServiceStateReturnsnullby default or the value specified viasetServiceState(ServiceState)
- 
setServiceStateSets the value returned byTelephonyManager.getServiceState().
- 
isNetworkRoamingReturnsfalseby default or the value specified viasetIsNetworkRoaming(boolean)
- 
setIsNetworkRoamingpublic void setIsNetworkRoaming(boolean isNetworkRoaming) Sets the value returned byTelephonyManager.isNetworkRoaming().
- 
getCurrentPhoneType
- 
setCurrentPhoneTypepublic void setCurrentPhoneType(int subId, int phoneType) Sets the phone type for the givensubId.
- 
clearPhoneTypespublic static void clearPhoneTypes()Removes allsubIdtophoneTypemappings.
- 
getCarrierPackageNamesForIntentAndPhone@Implementation(minSdk=23) @HiddenApi protected List<String> getCarrierPackageNamesForIntentAndPhone(Intent intent, int phoneId) 
- 
getCarrierPackageNamesForIntent
- 
setCarrierPackageNamesForPhoneSets thepackagesfor the givenphoneId.
- 
getCarrierIdFromSimMccMnc
- 
setCarrierIdFromSimMccMncpublic void setCarrierIdFromSimMccMnc(int carrierIdFromSimMccMnc) Sets the value to be returned bygetCarrierIdFromSimMccMnc().
- 
getSimCarrierId
- 
setSimCarrierIdpublic void setSimCarrierId(int simCarrierId) Sets the value to be returned bygetSimCarrierId().
- 
getSimSpecificCarrierId
- 
setSimSpecificCarrierIdpublic void setSimSpecificCarrierId(int simSpecificCarrierId) Sets the value to be returned bygetSimSpecificCarrierId().
- 
getSimCarrierIdName
- 
setSimCarrierIdNameSets the value to be returned bygetSimCarrierIdName().
- 
getSubscriberId
- 
setSubscriberIdSets the value to be returned bygetSubscriberId().
- 
getSubscriptionId
- 
setPhoneAccountHandleSubscriptionId
- 
getVisualVoicemailPackageNameReturns the value set bysetVisualVoicemailPackageName(String).
- 
setVisualVoicemailPackageNameSets the value to be returned bygetVisualVoicemailPackageName().
- 
getSignalStrength
- 
setSignalStrengthSets the value to be returned bygetSignalStrength()
- 
isEmergencyNumberCribbed fromPhoneNumberUtils.isEmergencyNumberInternal(int, java.lang.String).TODO: need better implementation 
- 
setEmergencyCallbackModepublic void setEmergencyCallbackMode(boolean emergencyCallbackMode) Emergency Callback Mode (ECBM) is typically set by the carrier, for a time window of 5 minutes after the last outgoing emergency call. The user can exit ECBM via a system notification.- Parameters:
- emergencyCallbackMode- whether the device is in ECBM or not.
 
- 
getEmergencyCallbackMode
- 
isPotentialEmergencyNumber
- 
isDataEnabledImplementation forTelephonyManager.isDataEnabled().- Returns:
- False by default, unless set with TelephonyManager.setDataEnabled(boolean).
 
- 
isDataEnabledForReasonImplementation forTelephonyManager.isDataEnabledForReason(int).- Returns:
- True by default, unless reason is set to false with TelephonyManager.setDataEnabledForReason(int, boolean).
 
- 
setDataEnabledImplementation forTelephonyManager.setDataEnabled(boolean). Marked as public in order to allow it to be used as a test API.
- 
setDataEnabledForReasonImplementation forTelephonyManager.setDataEnabledForReason(int, boolean). Marked as public in order to allow it to be used as a test API.
- 
isRttSupportedImplementation forTelephonyManager.isRttSupported().- Returns:
- False by default, unless set with setRttSupported(boolean).
 
- 
setRttSupportedpublic void setRttSupported(boolean isRttSupported) Sets the value to be returned byisRttSupported()
- 
isTtyModeSupportedImplementation forTelephonyManager.isTtyModeSupported().- Returns:
- False by default, unless set with setTtyModeSupported(boolean).
 
- 
setTtyModeSupportedpublic void setTtyModeSupported(boolean isTtyModeSupported) Sets the value to be returned byisTtyModeSupported()
- 
hasCarrierPrivileges- Returns:
- False by default, unless set with setHasCarrierPrivileges(int, boolean).
 
- 
setHasCarrierPrivilegespublic void setHasCarrierPrivileges(boolean hasCarrierPrivileges) 
- 
setHasCarrierPrivilegespublic void setHasCarrierPrivileges(int subId, boolean hasCarrierPrivileges) Sets thehasCarrierPrivilegesfor the givensubId.
- 
sendDialerSpecialCodeImplementation forTelephonyManager.sendDialerSpecialCode(String).- Parameters:
- inputCode- special code to be sent.
 
- 
getSentDialerSpecialCodesReturns immutable list of special codes sent usingTelephonyManager.sendDialerSpecialCode(String). Special codes contained in the list are in the order they were sent.
- 
setHearingAidCompatibilitySupportedpublic void setHearingAidCompatibilitySupported(boolean isSupported) Sets the value to be returned byisHearingAidCompatibilitySupported().
- 
isHearingAidCompatibilitySupportedImplementation forTelephonyManager.isHearingAidCompatibilitySupported().- Returns:
- False by default, unless set with setHearingAidCompatibilitySupported(boolean).
 
- 
createTelephonyDisplayInfoCreates aTelephonyDisplayInfo.- Parameters:
- networkType- The packet-switching cellular network type (see- Annotation.NetworkType)
- overrideNetworkType- The override network type (see- Annotation.OverrideNetworkType)
 
- 
setTelephonyDisplayInfoSets the currentTelephonyDisplayInfo, and notifies all thePhoneStateListeners that were registered with thePhoneStateListener.LISTEN_DISPLAY_INFO_CHANGEDflag.- Parameters:
- telephonyDisplayInfo- The- TelephonyDisplayInfoto set. May not be null.
- Throws:
- NullPointerException- if telephonyDisplayInfo is null.
 
- 
isDataConnectionAllowed
- 
setIsDataConnectionAllowedpublic void setIsDataConnectionAllowed(boolean isDataConnectionAllowed) 
- 
sendVisualVoicemailSms@Implementation(minSdk=26) public void sendVisualVoicemailSms(String number, int port, String text, PendingIntent sentIntent) 
- 
getLastSentVisualVoicemailSmsParams
- 
setVisualVoicemailSmsFilterSettings@Implementation(minSdk=26) public void setVisualVoicemailSmsFilterSettings(VisualVoicemailSmsFilterSettings settings) Implementation forTelephonyManager.setVisualVoicemailSmsFilterSettings(VisualVoicemailSmsFilterSettings).- Parameters:
- settings- The settings for the filter, or null to disable the filter.
 
- 
getVisualVoicemailSmsFilterSettingsReturns the last setVisualVoicemailSmsFilterSettings.
- 
setEmergencyNumberListSets the emergency numbers list returned byTelephonyManager.getEmergencyNumberList().
- 
getEmergencyNumberListImplementation forTelephonyManager.getEmergencyNumberList().- Returns:
- an immutable map by default, unless set with setEmergencyNumberList(java.util.Map<java.lang.Integer, java.util.List<android.telephony.emergency.EmergencyNumber>>).
 
- 
isDataRoamingEnabledImplementation forTelephonyManager.isDataRoamingEnabled().- Returns:
- False by default, unless set with setDataRoamingEnabled(boolean).
 
- 
setDataRoamingEnabledSets the value to be returned byisDataRoamingEnabled()
- 
setCarrierRestrictionRulesSets the value to be returned bygetCarrierRestrictionRules(). Marked as public in order to allow it to be used as a test API.- Parameters:
- carrierRestrictionRules- An object of type- CarrierRestrictionRules
 
- 
getCarrierRestrictionRulesImplementation forTelephonyManager.getCarrierRestrictionRules()that is set for tests byTelephonyManager.setCarrierRestrictionRules(android.telephony.CarrierRestrictionRules).
- 
rebootModemImplementation forTelephonyManager.rebootModem()
- 
getModemRebootCountpublic int getModemRebootCount()
- 
getIccAuthentication@Implementation(minSdk=24) protected String getIccAuthentication(int appType, int authType, String data) 
- 
setIccAuthentication
 
-