Package org.robolectric.shadows
Class ShadowTelephonyManager
- java.lang.Object
-
- org.robolectric.shadows.ShadowTelephonyManager
-
@Implements(value=android.telephony.TelephonyManager.class, looseSignatures=true) public class ShadowTelephonyManager extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected TelephonyManagerrealTelephonyManager
-
Constructor Summary
Constructors Constructor Description ShadowTelephonyManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidbootstrapAuthenticationRequest(Object appType, Object nafId, Object securityProtocol, Object forceBootStrapping, Object e, Object callback)voidclearPhoneTypes()Removes allsubIdtophoneTypemappings.protected TelephonyManagercreateForPhoneAccountHandle(PhoneAccountHandle handle)Returnsnullby 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 List<CellInfo>getAllCellInfo()ObjectgetBootstrapAuthenticationCallback()protected <T> Iterable<T>getCallbackForListener(Class<T> clazz)Returns a view oftelephonyCallbackRegistrationscontaining all elements that are of the typeclazz.protected intgetCallComposerStatus()protected intgetCallState()Call state may be specified viasetCallState(int).protected PersistableBundlegetCarrierConfig()Returns a new emptyPersistableBundleby default, or the value specified viasetCarrierConfig(PersistableBundle).protected intgetCarrierIdFromSimMccMnc()protected List<String>getCarrierPackageNamesForIntent(Intent intent)protected List<String>getCarrierPackageNamesForIntentAndPhone(Intent intent, int phoneId)protected CellLocationgetCellLocation()protected intgetCurrentPhoneType(int subId)protected intgetDataNetworkType()Returns whatever value was set by the last call tosetDataNetworkType(int), defaulting toTelephonyManager.NETWORK_TYPE_UNKNOWNif it was never called.protected intgetDataState()Data state may be specified viasetDataState(int).protected StringgetDeviceId()protected StringgetDeviceId(int slot)Returnsnullby default or the value specified viasetDeviceId(int, String).intgetEventFlags()Deprecated.Avoid using.protected StringgetGroupIdLevel1()protected StringgetImei()protected StringgetImei(int slotIndex)TelephonyCallbackgetLastTelephonyCallback()Returns the most recent callback passed to #registerTelephonyCallback().protected StringgetLine1Number()PhoneStateListenergetListener()Deprecated.Avoid using.protected Iterable<PhoneStateListener>getListenersForFlags(int flags)protected StringgetMeid()protected StringgetMeid(int slotIndex)protected StringgetNetworkCountryIso()Returns the SIM country lowercase.protected StringgetNetworkOperator()protected StringgetNetworkOperatorName()protected intgetNetworkType()protected intgetPhoneCount()Returns 1 by default or the value specified viasetPhoneCount(int).protected intgetPhoneType()List<String>getSentDialerSpecialCodes()Returns immutable list of special codes sent usingTelephonyManager.sendDialerSpecialCode(String).protected ServiceStategetServiceState()Returnsnullby default or the value specified viasetServiceState(ServiceState)protected SignalStrengthgetSignalStrength()protected intgetSimCarrierId()protected StringgetSimCountryIso()Returns the SIM country lowercase.protected StringgetSimCountryIso(int subId)protected LocalegetSimLocale()Returns sim locale set bysetSimLocale(java.util.Locale).protected StringgetSimOperator()protected StringgetSimOperatorName()protected StringgetSimSerialNumber()protected intgetSimState()protected intgetSimState(int slotIndex)protected StringgetSubscriberId()protected ObjectgetUiccSlotsInfo()Returns the UICC slots information set bysetUiccSlotsInfo(java.lang.Object).protected StringgetVisualVoicemailPackageName()Returns the value set bysetVisualVoicemailPackageName(String).protected StringgetVoiceMailAlphaTag()Returnsnullby default or the value specified viasetVoiceMailAlphaTag(String).protected StringgetVoiceMailNumber()Returnsnullby default, or the value specified viasetVoiceMailNumber(String).protected UrigetVoicemailRingtoneUri(PhoneAccountHandle handle)Returnsnullby default or the value specified viasetVoicemailRingtoneUri(PhoneAccountHandle, Uri).protected intgetVoiceNetworkType()Returns whatever value was set by the last call tosetVoiceNetworkType(int), defaulting toTelephonyManager.NETWORK_TYPE_UNKNOWNif it was never called.protected voidinitListener(PhoneStateListener listener, int flags)protected voidinitTelephonyCallback(TelephonyCallback callback)protected booleanisDataConnectionAllowed()protected booleanisDataEnabled()Implementation forTelephonyManager.isDataEnabled().protected booleanisEmergencyNumber(String number)protected booleanisHearingAidCompatibilitySupported()Implementation forTelephonyManager.isHearingAidCompatibilitySupported().protected booleanisNetworkRoaming()Returnsfalseby default or the value specified viasetIsNetworkRoaming(boolean)protected booleanisPotentialEmergencyNumber(String number)protected booleanisRttSupported()Implementation forTelephonyManager.isRttSupported().protected booleanisSmsCapable()protected booleanisVoiceCapable()Returnstrueby default or the value specified viasetVoiceCapable(boolean).protected booleanisVoicemailVibrationEnabled(PhoneAccountHandle handle)Returnsnullby default or the value specified viasetVoicemailVibrationEnabled(PhoneAccountHandle, boolean).protected voidlisten(PhoneStateListener listener, int flags)voidregisterTelephonyCallback(Executor executor, TelephonyCallback callback)protected voidrequestCellInfoUpdate(Object cellInfoExecutor, 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()voidresetSimCountryIsos()ClearssubIdto simCountryIso mapping and resets to default state.voidresetSimStates()ClearsslotIndexto state mapping and resets to default state.voidsendDialerSpecialCode(String inputCode)Implementation forTelephonyManager.sendDialerSpecialCode(String).voidsetAllCellInfo(List<CellInfo> allCellInfo)voidsetCallbackCellInfos(List<CellInfo> callbackCellInfos)Sets the value to be returned by calls torequestCellInfoUpdate(java.lang.Object,java.lang.Object).static 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.voidsetCellLocation(CellLocation cellLocation)voidsetCurrentPhoneType(int subId, int phoneType)Sets the phone type for the givensubId.voidsetDataEnabled(boolean enabled)Implementation forTelephonyManager.setDataEnabled(boolean).voidsetDataNetworkType(int dataNetworkType)Sets the value to be returned by calls togetDataNetworkType().voidsetDataState(int dataState)Sets the data state returned bygetDataState().voidsetDeviceId(int slot, String deviceId)Sets the value returned byTelephonyManager.getDeviceId(int).voidsetDeviceId(String newDeviceId)voidsetGroupIdLevel1(String groupIdLevel1)voidsetHearingAidCompatibilitySupported(boolean isSupported)Sets the value to be returned byisHearingAidCompatibilitySupported().voidsetImei(int slotIndex, String imei)Set the IMEI returned bygetImei(int).voidsetImei(String imei)Set 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)voidsetMeid(int slotIndex, String meid)Set the MEID returned bygetMeid(int).voidsetMeid(String meid)Set the MEID returned by getMeid().voidsetNetworkCountryIso(String networkCountryIso)voidsetNetworkOperator(String networkOperator)voidsetNetworkOperatorName(String networkOperatorName)voidsetNetworkType(int networkType)Deprecated.TelephonyManager.getNetworkType()was replaced withTelephonyManager.getDataNetworkType()in Android N, and has been deprecated in Android R.voidsetPhoneCount(int phoneCount)Sets the value returned byTelephonyManager.getPhoneCount().voidsetPhoneType(int phoneType)voidsetReadPhoneStatePermission(boolean readPhoneStatePermission)voidsetRequestCellInfoUpdateErrorValues(int errorCode, Throwable detail)Sets the values to be returned by a presumed error condition inrequestCellInfoUpdate(java.lang.Object,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().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)voidsetSimSerialNumber(String simSerialNumber)sets the serial number that will be returned bygetSimSerialNumber().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).voidsetUiccSlotsInfo(Object uiccSlotsInfos)Sets the UICC slots information returned bygetUiccSlotsInfo().voidsetVisualVoicemailPackageName(String visualVoicemailPackageName)Sets the value to be returned bygetVisualVoicemailPackageName().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(TelephonyCallback callback)
-
-
-
Field Detail
-
realTelephonyManager
@RealObject protected TelephonyManager realTelephonyManager
-
-
Method Detail
-
reset
@Resetter public static void reset()
-
setCallComposerStatus
public static void setCallComposerStatus(int callComposerStatus)
-
getCallComposerStatus
@Implementation(minSdk=31) @HiddenApi protected int getCallComposerStatus()
-
getBootstrapAuthenticationCallback
public Object getBootstrapAuthenticationCallback()
-
bootstrapAuthenticationRequest
@Implementation(minSdk=31) @HiddenApi public void bootstrapAuthenticationRequest(Object appType, Object nafId, Object securityProtocol, Object forceBootStrapping, Object e, Object callback)
-
listen
@Implementation protected void listen(PhoneStateListener listener, int flags)
-
getListener
@Deprecated public PhoneStateListener getListener()
Deprecated.Avoid using.Returns the most recent listener passed to #listen().- Returns:
- Phone state listener.
-
getEventFlags
@Deprecated public int getEventFlags()
Deprecated.Avoid using.Returns the most recent flags passed to #listen().- Returns:
- Event flags.
-
registerTelephonyCallback
@Implementation(minSdk=31) public void registerTelephonyCallback(Executor executor, TelephonyCallback callback)
-
unregisterTelephonyCallback
@Implementation(minSdk=31) public void unregisterTelephonyCallback(TelephonyCallback callback)
-
getLastTelephonyCallback
public TelephonyCallback getLastTelephonyCallback()
Returns the most recent callback passed to #registerTelephonyCallback().
-
getCallState
@Implementation protected int getCallState()
Call state may be specified viasetCallState(int).
-
setCallState
public void setCallState(int callState)
Sets the current call state to the desired state and updates any listeners.
-
setCallState
public void setCallState(int callState, String incomingPhoneNumber)Sets 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.
-
getDataState
@Implementation protected int getDataState()
Data state may be specified viasetDataState(int). If no override is set, this defaults toTelephonyManager.DATA_DISCONNECTED.
-
setDataState
public void setDataState(int dataState)
Sets the data state returned bygetDataState().
-
getDeviceId
@Implementation protected String getDeviceId()
-
setDeviceId
public void setDeviceId(String newDeviceId)
-
setNetworkOperatorName
@Implementation(minSdk=22) public void setNetworkOperatorName(String networkOperatorName)
-
getImei
@Implementation(minSdk=21) protected String getImei()
-
getImei
@Implementation(minSdk=26) protected String getImei(int slotIndex)
-
setImei
public void setImei(String imei)
Set the IMEI returned by getImei().
-
setImei
public void setImei(int slotIndex, String imei)Set the IMEI returned bygetImei(int).
-
getMeid
@Implementation(minSdk=26) protected String getMeid()
-
getMeid
@Implementation(minSdk=26) protected String getMeid(int slotIndex)
-
setMeid
public void setMeid(String meid)
Set the MEID returned by getMeid().
-
setMeid
public void setMeid(int slotIndex, String meid)Set the MEID returned bygetMeid(int).
-
getNetworkOperatorName
@Implementation protected String getNetworkOperatorName()
-
setNetworkCountryIso
@Implementation(minSdk=22, maxSdk=28) public void setNetworkCountryIso(String networkCountryIso)
-
getNetworkCountryIso
@Implementation protected String getNetworkCountryIso()
Returns the SIM country lowercase. This matches the API this shadows: https://developer.android.com/reference/android/telephony/TelephonyManager#getNetworkCountryIso().
-
setSimLocale
public void setSimLocale(Locale simLocale)
Sets the sim locale returned bygetSimLocale().
-
getSimLocale
@Implementation(minSdk=29) protected Locale getSimLocale()
Returns sim locale set bysetSimLocale(java.util.Locale).
-
setNetworkOperator
public void setNetworkOperator(String networkOperator)
-
getNetworkOperator
@Implementation protected String getNetworkOperator()
-
getSimOperator
@Implementation protected String getSimOperator()
-
setSimOperator
public void setSimOperator(String simOperator)
-
getSimOperatorName
@Implementation protected String getSimOperatorName()
-
setSimOperatorName
@Implementation(minSdk=22) public void setSimOperatorName(String simOperatorName)
-
getSimSerialNumber
@Implementation protected String getSimSerialNumber()
-
setSimSerialNumber
public void setSimSerialNumber(String simSerialNumber)
sets the serial number that will be returned bygetSimSerialNumber().
-
getSimCountryIso
@Implementation protected String getSimCountryIso()
Returns the SIM country lowercase. This matches the API it shadows: https://developer.android.com/reference/android/telephony/TelephonyManager#getSimCountryIso().
-
getSimCountryIso
@Implementation(minSdk=24, maxSdk=29) @HiddenApi protected String getSimCountryIso(int subId)
-
setSimCountryIso
@Implementation(minSdk=22) public void setSimCountryIso(String simCountryIso)
-
setSimCountryIso
public void setSimCountryIso(int subId, String simCountryIso)Sets thesimCountryIsofor the givensubId.
-
resetSimCountryIsos
public void resetSimCountryIsos()
ClearssubIdto simCountryIso mapping and resets to default state.
-
getSimState
@Implementation protected int getSimState()
-
setSimState
@Implementation(minSdk=22) public void setSimState(int simState)
Sets the sim state of slot 0.
-
setSimState
public void setSimState(int slotIndex, int state)Set the sim state for the givenslotIndex.
-
getSimState
@Implementation(minSdk=26) protected int getSimState(int slotIndex)
-
setUiccSlotsInfo
public void setUiccSlotsInfo(Object uiccSlotsInfos)
Sets the UICC slots information returned bygetUiccSlotsInfo().
-
getUiccSlotsInfo
@Implementation(minSdk=28) @HiddenApi protected Object getUiccSlotsInfo()
Returns the UICC slots information set bysetUiccSlotsInfo(java.lang.Object).
-
resetSimStates
public void resetSimStates()
ClearsslotIndexto state mapping and resets to default state.
-
setReadPhoneStatePermission
public void setReadPhoneStatePermission(boolean readPhoneStatePermission)
-
getPhoneType
@Implementation protected int getPhoneType()
-
setPhoneType
@Implementation(minSdk=22) public void setPhoneType(int phoneType)
-
getLine1Number
@Implementation protected String getLine1Number()
-
setLine1Number
public void setLine1Number(String line1Number)
-
getNetworkType
@Implementation protected int getNetworkType()
-
setNetworkType
@Deprecated public void setNetworkType(int networkType)
Deprecated.TelephonyManager.getNetworkType()was replaced withTelephonyManager.getDataNetworkType()in Android N, and has been deprecated in Android R. Useinstead.
-
getDataNetworkType
@Implementation(minSdk=24) protected int getDataNetworkType()
Returns whatever value was set by the last call tosetDataNetworkType(int), defaulting toTelephonyManager.NETWORK_TYPE_UNKNOWNif it was never called.
-
setDataNetworkType
@Implementation(minSdk=22) public void setDataNetworkType(int dataNetworkType)
Sets the value to be returned by calls togetDataNetworkType(). This should correspond to one of theNETWORK_TYPE_*constants defined onTelephonyManager, but this is not enforced.
-
getVoiceNetworkType
@Implementation(minSdk=24) protected int getVoiceNetworkType()
Returns 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.
-
setVoiceNetworkType
public 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
@Implementation(minSdk=17) protected List<CellInfo> getAllCellInfo()
-
requestCellInfoUpdate
@Implementation(minSdk=29) protected void requestCellInfoUpdate(Object cellInfoExecutor, 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.
-
setCallbackCellInfos
public void setCallbackCellInfos(List<CellInfo> callbackCellInfos)
Sets the value to be returned by calls torequestCellInfoUpdate(java.lang.Object,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>).
-
setRequestCellInfoUpdateErrorValues
public void setRequestCellInfoUpdateErrorValues(int errorCode, Throwable detail)Sets the values to be returned by a presumed error condition inrequestCellInfoUpdate(java.lang.Object,java.lang.Object). These values will persist until cleared: to clear, set (0, null) using this method.
-
getCellLocation
@Implementation protected CellLocation getCellLocation()
-
setCellLocation
public void setCellLocation(CellLocation cellLocation)
-
getGroupIdLevel1
@Implementation(minSdk=18) protected String getGroupIdLevel1()
-
setGroupIdLevel1
public void setGroupIdLevel1(String groupIdLevel1)
-
initListener
protected void initListener(PhoneStateListener listener, int flags)
-
initTelephonyCallback
protected void initTelephonyCallback(TelephonyCallback callback)
-
getListenersForFlags
protected Iterable<PhoneStateListener> getListenersForFlags(int flags)
-
getCallbackForListener
protected <T> Iterable<T> getCallbackForListener(Class<T> clazz)
Returns a view oftelephonyCallbackRegistrationscontaining all elements that are of the typeclazz.
-
isSmsCapable
@Implementation protected boolean isSmsCapable()
- Returns:
- true by default, or the value specified via
setIsSmsCapable(boolean)
-
setIsSmsCapable
public void setIsSmsCapable(boolean isSmsCapable)
Sets the value returned byTelephonyManager.isSmsCapable().
-
getCarrierConfig
@Implementation(minSdk=26) protected PersistableBundle getCarrierConfig()
Returns a new emptyPersistableBundleby default, or the value specified viasetCarrierConfig(PersistableBundle).
-
setCarrierConfig
public void setCarrierConfig(PersistableBundle carrierConfig)
Sets the value returned byTelephonyManager.getCarrierConfig().- Parameters:
carrierConfig-
-
getVoiceMailNumber
@Implementation protected String getVoiceMailNumber()
Returnsnullby default, or the value specified viasetVoiceMailNumber(String).
-
setVoiceMailNumber
public void setVoiceMailNumber(String voiceMailNumber)
Sets the value returned byTelephonyManager.getVoiceMailNumber().
-
getVoiceMailAlphaTag
@Implementation protected String getVoiceMailAlphaTag()
Returnsnullby default or the value specified viasetVoiceMailAlphaTag(String).
-
setVoiceMailAlphaTag
public void setVoiceMailAlphaTag(String voiceMailAlphaTag)
Sets the value returned byTelephonyManager.getVoiceMailAlphaTag().
-
getPhoneCount
@Implementation(minSdk=23) protected int getPhoneCount()
Returns 1 by default or the value specified viasetPhoneCount(int).
-
setPhoneCount
public void setPhoneCount(int phoneCount)
Sets the value returned byTelephonyManager.getPhoneCount().
-
getDeviceId
@Implementation(minSdk=23) protected String getDeviceId(int slot)
Returnsnullby default or the value specified viasetDeviceId(int, String).
-
setDeviceId
public void setDeviceId(int slot, String deviceId)Sets the value returned byTelephonyManager.getDeviceId(int).
-
isVoiceCapable
@Implementation(minSdk=22) protected boolean isVoiceCapable()
Returnstrueby default or the value specified viasetVoiceCapable(boolean).
-
setVoiceCapable
public void setVoiceCapable(boolean voiceCapable)
Sets the value returned byisVoiceCapable().
-
isVoicemailVibrationEnabled
@Implementation(minSdk=24) protected boolean isVoicemailVibrationEnabled(PhoneAccountHandle handle)
Returnsnullby 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).
-
getVoicemailRingtoneUri
@Implementation(minSdk=24) protected Uri getVoicemailRingtoneUri(PhoneAccountHandle handle)
Returnsnullby 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).
-
setTelephonyManagerForHandle
public void setTelephonyManagerForHandle(PhoneAccountHandle handle, TelephonyManager telephonyManager)
Sets the value returned byTelephonyManager.createForPhoneAccountHandle(PhoneAccountHandle).
-
createForSubscriptionId
@Implementation(minSdk=24) protected TelephonyManager createForSubscriptionId(int subId)
Returnsnullby default or the value specified viasetTelephonyManagerForSubscriptionId(int, TelephonyManager)
-
setTelephonyManagerForSubscriptionId
public void setTelephonyManagerForSubscriptionId(int subscriptionId, TelephonyManager telephonyManager)Sets the value returned byTelephonyManager.createForSubscriptionId(int).
-
getServiceState
@Implementation(minSdk=26) protected ServiceState getServiceState()
Returnsnullby default or the value specified viasetServiceState(ServiceState)
-
setServiceState
public void setServiceState(ServiceState serviceState)
Sets the value returned byTelephonyManager.getServiceState().
-
isNetworkRoaming
@Implementation protected boolean isNetworkRoaming()
Returnsfalseby default or the value specified viasetIsNetworkRoaming(boolean)
-
setIsNetworkRoaming
public void setIsNetworkRoaming(boolean isNetworkRoaming)
Sets the value returned byTelephonyManager.isNetworkRoaming().
-
getCurrentPhoneType
@Implementation(minSdk=23) @HiddenApi protected int getCurrentPhoneType(int subId)
-
setCurrentPhoneType
public void setCurrentPhoneType(int subId, int phoneType)Sets the phone type for the givensubId.
-
clearPhoneTypes
public void clearPhoneTypes()
Removes allsubIdtophoneTypemappings.
-
getCarrierPackageNamesForIntentAndPhone
@Implementation(minSdk=23) @HiddenApi protected List<String> getCarrierPackageNamesForIntentAndPhone(Intent intent, int phoneId)
-
getCarrierPackageNamesForIntent
@Implementation(minSdk=21) @HiddenApi protected List<String> getCarrierPackageNamesForIntent(Intent intent)
-
setCarrierPackageNamesForPhone
public void setCarrierPackageNamesForPhone(int phoneId, List<String> packages)Sets thepackagesfor the givenphoneId.
-
getCarrierIdFromSimMccMnc
@Implementation(minSdk=29) protected int getCarrierIdFromSimMccMnc()
-
setCarrierIdFromSimMccMnc
public void setCarrierIdFromSimMccMnc(int carrierIdFromSimMccMnc)
Sets the value to be returned bygetCarrierIdFromSimMccMnc().
-
getSimCarrierId
@Implementation(minSdk=28) protected int getSimCarrierId()
-
setSimCarrierId
public void setSimCarrierId(int simCarrierId)
Sets the value to be returned bygetSimCarrierId().
-
getSubscriberId
@Implementation protected String getSubscriberId()
-
setSubscriberId
public void setSubscriberId(String subscriberId)
Sets the value to be returned bygetSubscriberId().
-
getVisualVoicemailPackageName
@Implementation(minSdk=26) protected String getVisualVoicemailPackageName()
Returns the value set bysetVisualVoicemailPackageName(String).
-
setVisualVoicemailPackageName
public void setVisualVoicemailPackageName(String visualVoicemailPackageName)
Sets the value to be returned bygetVisualVoicemailPackageName().
-
getSignalStrength
@Implementation(minSdk=28) protected SignalStrength getSignalStrength()
-
setSignalStrength
public void setSignalStrength(SignalStrength signalStrength)
Sets the value to be returned bygetSignalStrength()
-
isEmergencyNumber
@Implementation(minSdk=29) protected boolean isEmergencyNumber(String number)
Cribbed fromPhoneNumberUtils.isEmergencyNumberInternal(java.lang.String, boolean).TODO: need better implementation
-
isPotentialEmergencyNumber
@Implementation(minSdk=29) protected boolean isPotentialEmergencyNumber(String number)
-
isDataEnabled
@Implementation(minSdk=26) protected boolean isDataEnabled()
Implementation forTelephonyManager.isDataEnabled().- Returns:
- False by default, unless set with
TelephonyManager.setDataEnabled(boolean).
-
setDataEnabled
@Implementation(minSdk=26) public void setDataEnabled(boolean enabled)
Implementation forTelephonyManager.setDataEnabled(boolean). Marked as public in order to allow it to be used as a test API.
-
isRttSupported
@Implementation(minSdk=29) protected boolean isRttSupported()
Implementation forTelephonyManager.isRttSupported().- Returns:
- False by default, unless set with
setRttSupported(boolean).
-
setRttSupported
public void setRttSupported(boolean isRttSupported)
Sets the value to be returned byisRttSupported()
-
sendDialerSpecialCode
@Implementation(minSdk=26) public void sendDialerSpecialCode(String inputCode)
Implementation forTelephonyManager.sendDialerSpecialCode(String).- Parameters:
inputCode- special code to be sent.
-
getSentDialerSpecialCodes
public List<String> getSentDialerSpecialCodes()
Returns immutable list of special codes sent usingTelephonyManager.sendDialerSpecialCode(String). Special codes contained in the list are in the order they were sent.
-
setHearingAidCompatibilitySupported
public void setHearingAidCompatibilitySupported(boolean isSupported)
Sets the value to be returned byisHearingAidCompatibilitySupported().
-
isHearingAidCompatibilitySupported
@Implementation(minSdk=23) protected boolean isHearingAidCompatibilitySupported()
Implementation forTelephonyManager.isHearingAidCompatibilitySupported().- Returns:
- False by default, unless set with
setHearingAidCompatibilitySupported(boolean).
-
createTelephonyDisplayInfo
public static Object createTelephonyDisplayInfo(int networkType, int overrideNetworkType)
Creates aTelephonyDisplayInfo.- Parameters:
networkType- The packet-switching cellular network type (seeAnnotation.NetworkType)overrideNetworkType- The override network type (seeAnnotation.OverrideNetworkType)
-
setTelephonyDisplayInfo
public void setTelephonyDisplayInfo(Object telephonyDisplayInfo)
Sets the currentTelephonyDisplayInfo, and notifies all thePhoneStateListeners that were registered with thePhoneStateListener.LISTEN_DISPLAY_INFO_CHANGEDflag.- Parameters:
telephonyDisplayInfo- TheTelephonyDisplayInfoto set. May not be null.- Throws:
NullPointerException- if telephonyDisplayInfo is null.
-
isDataConnectionAllowed
@Implementation(minSdk=30) @HiddenApi protected boolean isDataConnectionAllowed()
-
setIsDataConnectionAllowed
public void setIsDataConnectionAllowed(boolean isDataConnectionAllowed)
-
-