Class ShadowTelephonyManager

java.lang.Object
org.robolectric.shadows.ShadowTelephonyManager

@Implements(android.telephony.TelephonyManager.class) public class ShadowTelephonyManager extends Object
Shadow for TelephonyManager.
  • Field Details

    • realTelephonyManager

      @RealObject protected TelephonyManager realTelephonyManager
  • Constructor Details

    • ShadowTelephonyManager

      public ShadowTelephonyManager()
  • Method Details

    • reset

      @Resetter public static void reset()
    • setCallComposerStatus

      @Implementation(minSdk=31) protected void setCallComposerStatus(int callComposerStatus)
    • getCallComposerStatus

      @Implementation(minSdk=31) @HiddenApi protected int getCallComposerStatus()
    • getBootstrapAuthenticationCallback

      public Object getBootstrapAuthenticationCallback()
    • bootstrapAuthenticationRequest

      @Implementation(minSdk=31) @HiddenApi public void bootstrapAuthenticationRequest(int appType, Uri nafId, Object securityProtocol, boolean forceBootStrapping, Executor e, Object callback)
    • setPhoneCapability

      public void setPhoneCapability(Object phoneCapability)
    • getPhoneCapability

      @Implementation(minSdk=31) @HiddenApi public Object getPhoneCapability()
    • 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, Object callback)
    • registerTelephonyCallback

      @Implementation(minSdk=33) protected void registerTelephonyCallback(int includeLocationData, Executor executor, Object callback)
    • unregisterTelephonyCallback

      @Implementation(minSdk=31) public void unregisterTelephonyCallback(Object callback)
    • getLastTelephonyCallback

      public Object getLastTelephonyCallback()
      Returns the most recent callback passed to #registerTelephonyCallback().
    • getCallStateForSubscription

      @Implementation(minSdk=31) protected int getCallStateForSubscription()
      Call state may be specified via setCallState(int).
    • getCallState

      @Implementation protected int getCallState()
      Call state may be specified via setCallState(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 via setDataState(int). If no override is set, this defaults to TelephonyManager.DATA_DISCONNECTED.
    • setDataState

      public void setDataState(int dataState)
      Sets the data state returned by getDataState().
    • getDataActivity

      @Implementation protected int getDataActivity()
      Data activity may be specified via setDataActivity(int). If no override is set, this defaults to TelephonyManager.DATA_ACTIVITY_NONE.
    • setDataActivity

      public void setDataActivity(int dataActivity)
      Sets the value to be returned by calls to getDataActivity(). This should correspond to one of the DATA_ACTIVITY_* constants defined on TelephonyManager, but this is not enforced.
    • getDeviceId

      @Implementation protected String getDeviceId()
    • setDeviceId

      public void setDeviceId(String newDeviceId)
    • getDeviceSoftwareVersion

      @Implementation protected String getDeviceSoftwareVersion()
    • setDeviceSoftwareVersion

      public void setDeviceSoftwareVersion(String newDeviceSoftwareVersion)
    • setNetworkOperatorName

      @Implementation(maxSdk=34) public void setNetworkOperatorName(String networkOperatorName)
    • setNetworkOperatorNameForPhone

      @Implementation(minSdk=35) public void setNetworkOperatorNameForPhone(int phoneId, String networkOperatorName)
    • getImei

      @Implementation 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 by getImei(int).
    • getPrimaryImei

      @Implementation(minSdk=34) protected String getPrimaryImei()
    • setPrimaryImeiSlotIndex

      public void setPrimaryImeiSlotIndex(int primaryImeiSlotIndex)
      Set the primary IMEI slot index for getPrimaryImei().
    • 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 by getMeid(int).
    • getNetworkOperatorName

      @Implementation protected String getNetworkOperatorName()
    • setNetworkCountryIso

      @Implementation(maxSdk=28) public void setNetworkCountryIso(String networkCountryIso)
      Sets the network country ISO returned by getNetworkCountryIso().

      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.

    • 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 by getSimLocale().
    • getSimLocale

      @Implementation(minSdk=29) protected Locale getSimLocale()
      Returns sim locale set by setSimLocale(java.util.Locale).
    • setNetworkOperator

      public void setNetworkOperator(String networkOperator)
    • getNetworkOperator

      @Implementation protected String getNetworkOperator()
    • setNetworkSpecifier

      public void setNetworkSpecifier(String networkSpecifier)
    • getNetworkSpecifier

      @Implementation(minSdk=26) protected String getNetworkSpecifier()
    • getSimOperator

      @Implementation protected String getSimOperator()
    • setSimOperator

      public void setSimOperator(String simOperator)
    • getSimOperatorName

      @Implementation protected String getSimOperatorName()
    • setSimOperatorName

      @Implementation(maxSdk=34) public void setSimOperatorName(String simOperatorName)
    • setSimOperatorNameForPhone

      @Implementation(minSdk=35) public void setSimOperatorNameForPhone(int phoneId, String name)
    • getSimSerialNumber

      @Implementation protected String getSimSerialNumber()
    • setSimSerialNumber

      public void setSimSerialNumber(String simSerialNumber)
      sets the serial number that will be returned by getSimSerialNumber().
    • 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 public void setSimCountryIso(String simCountryIso)
    • setSimCountryIso

      public void setSimCountryIso(int subId, String simCountryIso)
      Sets the simCountryIso for the given subId.
    • resetAllSimCountryIsos

      public static void resetAllSimCountryIsos()
      Clears subId to simCountryIso mapping and resets to default state.
    • resetSimCountryIsos

      @Deprecated public void resetSimCountryIsos()
      Deprecated.
      for resetAllSimCountryIsos
      Clears subId to simCountryIso mapping and resets to default state.
    • getSimState

      @Implementation protected int getSimState()
    • setSimState

      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 given slotIndex.
    • getSimState

      @Implementation(minSdk=26) protected int getSimState(int slotIndex)
    • getSimStateForSlotIndex

      @Implementation(minSdk=34) protected static int getSimStateForSlotIndex(int slotIndex)
    • setUiccSlotsInfo

      public void setUiccSlotsInfo(Object uiccSlotsInfos)
      Sets the UICC slots information returned by getUiccSlotsInfo().
    • getUiccSlotsInfo

      @Implementation(minSdk=28) @HiddenApi protected Object getUiccSlotsInfo()
      Returns the UICC slots information set by setUiccSlotsInfo(java.lang.Object).
    • setUiccCardsInfo

      public void setUiccCardsInfo(Object uiccCardsInfo)
      Sets the UICC cards information returned by getUiccCardsInfo().
    • getUiccCardsInfo

      @Implementation(minSdk=29) @HiddenApi protected List<?> getUiccCardsInfo()
      Returns the UICC cards information set by setUiccCardsInfo(java.lang.Object).
    • resetAllSimStates

      public static void resetAllSimStates()
      Clears slotIndex to state mapping and resets to default state.
    • resetSimStates

      @Deprecated public void resetSimStates()
      Deprecated.
      use resetAllSimStates()
      Clears slotIndex to state mapping and resets to default state.
    • setReadPhoneStatePermission

      public void setReadPhoneStatePermission(boolean readPhoneStatePermission)
    • getPhoneType

      @Implementation protected int getPhoneType()
    • setPhoneType

      @Implementation(maxSdk=34) public void setPhoneType(int phoneType)
    • setPhoneType

      @Implementation(minSdk=35) public void setPhoneType(int phoneId, int type)
    • 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 with TelephonyManager.getDataNetworkType() in Android N, and has been deprecated in Android R. Use instead.
    • getDataNetworkType

      @Implementation(minSdk=24) protected int getDataNetworkType()
      Returns whatever value was set by the last call to setDataNetworkType(int), defaulting to TelephonyManager.NETWORK_TYPE_UNKNOWN if it was never called.
    • setDataNetworkType

      @Implementation public void setDataNetworkType(int dataNetworkType)
      Sets the value to be returned by calls to getDataNetworkType(). This should correspond to one of the NETWORK_TYPE_* constants defined on TelephonyManager, but this is not enforced.
    • getVoiceNetworkType

      @Implementation(minSdk=24) protected int getVoiceNetworkType()
      Returns whatever value was set by the last call to setVoiceNetworkType(int), defaulting to TelephonyManager.NETWORK_TYPE_UNKNOWN if 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 to getVoiceNetworkType(). This should correspond to one of the NETWORK_TYPE_* constants defined on TelephonyManager, but this is not enforced.
    • getAllCellInfo

      @Implementation protected List<CellInfo> getAllCellInfo()
    • setAllCellInfo

      public void setAllCellInfo(List<CellInfo> allCellInfo)
    • requestCellInfoUpdate

      @Implementation(minSdk=29) protected void requestCellInfoUpdate(Executor executor, Object cellInfoCallback)
      Returns the value set by setCallbackCellInfos(java.util.List<android.telephony.CellInfo>), defaulting to calling the real TelephonyManager.NETWORK_TYPE_UNKNOWN if it was never called.
    • setCallbackCellInfos

      public void setCallbackCellInfos(List<CellInfo> callbackCellInfos)
      Sets the value to be returned by calls to requestCellInfoUpdate(java.util.concurrent.Executor, java.lang.Object). Note that it does not set the value to be returned by calls to getAllCellInfo(); for that, see setAllCellInfo(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 in requestCellInfoUpdate(java.util.concurrent.Executor, 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 protected String getGroupIdLevel1()
    • setGroupIdLevel1

      public void setGroupIdLevel1(String groupIdLevel1)
    • initListener

      protected void initListener(PhoneStateListener listener, int flags)
    • initTelephonyCallback

      protected void initTelephonyCallback(Object callback)
    • getListenersForFlags

      protected Iterable<PhoneStateListener> getListenersForFlags(int flags)
    • getCallbackForListener

      protected <T> Iterable<T> getCallbackForListener(Class<T> clazz)
      Returns a view of telephonyCallbackRegistrations containing all elements that are of the type clazz.
    • 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 by TelephonyManager.isSmsCapable().
    • isDeviceSmsCapable

      @Implementation(minSdk=35) protected boolean isDeviceSmsCapable()
      Returns true by default, or the value specified via setDeviceSmsCapable(boolean).
    • setDeviceSmsCapable

      public void setDeviceSmsCapable(boolean isSmsCapable)
      Sets the value returned by isDeviceSmsCapable().
    • getCarrierConfig

      @Implementation(minSdk=26) protected PersistableBundle getCarrierConfig()
      Returns a new empty PersistableBundle by default, or the value specified via setCarrierConfig(PersistableBundle).
    • setCarrierConfig

      public void setCarrierConfig(PersistableBundle carrierConfig)
      Sets the value returned by TelephonyManager.getCarrierConfig().
      Parameters:
      carrierConfig -
    • getVoiceMailNumber

      @Implementation protected String getVoiceMailNumber()
      Returns null by default, or the value specified via setVoiceMailNumber(String).
    • setVoiceMailNumber

      public void setVoiceMailNumber(String voiceMailNumber)
      Sets the value returned by TelephonyManager.getVoiceMailNumber().
    • getVoiceMailAlphaTag

      @Implementation protected String getVoiceMailAlphaTag()
      Returns null by default or the value specified via setVoiceMailAlphaTag(String).
    • setVoiceMailAlphaTag

      public void setVoiceMailAlphaTag(String voiceMailAlphaTag)
      Sets the value returned by TelephonyManager.getVoiceMailAlphaTag().
    • getPhoneCount

      @Implementation(minSdk=23) protected int getPhoneCount()
      Returns 1 by default or the value specified via setPhoneCount(int).
    • setPhoneCount

      public void setPhoneCount(int phoneCount)
      Sets the value returned by TelephonyManager.getPhoneCount().
    • getActiveModemCount

      @Implementation(minSdk=30) protected int getActiveModemCount()
      Returns 1 by default or the value specified via setActiveModemCount(int).
    • setActiveModemCount

      public void setActiveModemCount(int activeModemCount)
      Sets the value returned by TelephonyManager.getActiveModemCount().
    • getDeviceId

      @Implementation(minSdk=23) protected String getDeviceId(int slot)
      Returns null by default or the value specified via setDeviceId(int, String).
    • setDeviceId

      public void setDeviceId(int slot, String deviceId)
      Sets the value returned by TelephonyManager.getDeviceId(int).
    • isVoiceCapable

      @Implementation protected boolean isVoiceCapable()
      Returns true by default or the value specified via setVoiceCapable(boolean).
    • setVoiceCapable

      public void setVoiceCapable(boolean voiceCapable)
      Sets the value returned by isVoiceCapable().
    • isDeviceVoiceCapable

      @Implementation(minSdk=35) protected boolean isDeviceVoiceCapable()
      Returns true by default or the value specified via setDeviceVoiceCapable(boolean).
    • setDeviceVoiceCapable

      public void setDeviceVoiceCapable(boolean voiceCapable)
      Sets the value returned by isDeviceVoiceCapable().
    • getVoiceActivationState

      @Implementation(minSdk=28) protected int getVoiceActivationState()
      Returns TelephonyManager.VOICE_ACTIVATION_STATE_ACTIVATED by default or the value specified via setVoiceActivationState(int).
    • setVoiceActivationState

      @Implementation(minSdk=28) public void setVoiceActivationState(int voiceActivationState)
      Sets the value returned by getVoiceActivationState().
    • getDataActivationState

      @Implementation(minSdk=28) protected int getDataActivationState()
      Returns TelephonyManager.SIM_ACTIVATION_STATE_UNKNOWN by default or the value specified via setDataActivationState(int).
    • setDataActivationState

      @Implementation(minSdk=28) public void setDataActivationState(int dataActivationState)
      Sets the value returned by getDataActivationState().
    • isVoicemailVibrationEnabled

      @Implementation(minSdk=24) protected boolean isVoicemailVibrationEnabled(PhoneAccountHandle handle)
      Returns null by default or the value specified via setVoicemailVibrationEnabled(PhoneAccountHandle, boolean).
    • setVoicemailVibrationEnabled

      @Implementation(minSdk=26) protected void setVoicemailVibrationEnabled(PhoneAccountHandle handle, boolean isEnabled)
    • getVoicemailRingtoneUri

      @Implementation(minSdk=24) protected Uri getVoicemailRingtoneUri(PhoneAccountHandle handle)
      Returns null by default or the value specified via setVoicemailRingtoneUri(PhoneAccountHandle, Uri).
    • setVoicemailRingtoneUri

      @Implementation(minSdk=26) protected void setVoicemailRingtoneUri(PhoneAccountHandle handle, Uri uri)
    • createForPhoneAccountHandle

      @Implementation(minSdk=26) protected TelephonyManager createForPhoneAccountHandle(PhoneAccountHandle handle)
      Returns null by default or the value specified via setTelephonyManagerForHandle(PhoneAccountHandle, TelephonyManager).
    • setTelephonyManagerForHandle

      public void setTelephonyManagerForHandle(PhoneAccountHandle handle, TelephonyManager telephonyManager)
    • createForSubscriptionId

      @Implementation(minSdk=24) protected TelephonyManager createForSubscriptionId(int subId)
      Returns null by default or the value specified via setTelephonyManagerForSubscriptionId(int, TelephonyManager)
    • setTelephonyManagerForSubscriptionId

      public void setTelephonyManagerForSubscriptionId(int subscriptionId, TelephonyManager telephonyManager)
    • getServiceState

      @Implementation(minSdk=26) protected ServiceState getServiceState()
      Returns null by default or the value specified via setServiceState(ServiceState)
    • getServiceState

      @Implementation(minSdk=33) protected ServiceState getServiceState(int includeLocationData)
      Returns null by default or the value specified via setServiceState(ServiceState)
    • setServiceState

      public void setServiceState(ServiceState serviceState)
      Sets the value returned by TelephonyManager.getServiceState().
    • isNetworkRoaming

      @Implementation protected boolean isNetworkRoaming()
      Returns false by default or the value specified via setIsNetworkRoaming(boolean)
    • setIsNetworkRoaming

      public void setIsNetworkRoaming(boolean isNetworkRoaming)
      Sets the value returned by TelephonyManager.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 given subId.
    • clearPhoneTypes

      public static void clearPhoneTypes()
      Removes all subId to phoneType mappings.
    • getCarrierPackageNamesForIntentAndPhone

      @Implementation(minSdk=23) @HiddenApi protected List<String> getCarrierPackageNamesForIntentAndPhone(Intent intent, int phoneId)
    • getCarrierPackageNamesForIntent

      @Implementation @HiddenApi protected List<String> getCarrierPackageNamesForIntent(Intent intent)
    • setCarrierPackageNamesForPhone

      public void setCarrierPackageNamesForPhone(int phoneId, List<String> packages)
      Sets the packages for the given phoneId.
    • getCarrierIdFromSimMccMnc

      @Implementation(minSdk=29) protected int getCarrierIdFromSimMccMnc()
    • setCarrierIdFromSimMccMnc

      public void setCarrierIdFromSimMccMnc(int carrierIdFromSimMccMnc)
      Sets the value to be returned by getCarrierIdFromSimMccMnc().
    • getSimCarrierId

      @Implementation(minSdk=28) protected int getSimCarrierId()
    • setSimCarrierId

      public void setSimCarrierId(int simCarrierId)
      Sets the value to be returned by getSimCarrierId().
    • getSimSpecificCarrierId

      @Implementation(minSdk=29) protected int getSimSpecificCarrierId()
    • setSimSpecificCarrierId

      public void setSimSpecificCarrierId(int simSpecificCarrierId)
      Sets the value to be returned by getSimSpecificCarrierId().
    • getSimCarrierIdName

      @Implementation(minSdk=28) protected CharSequence getSimCarrierIdName()
    • setSimCarrierIdName

      public void setSimCarrierIdName(CharSequence simCarrierIdName)
      Sets the value to be returned by getSimCarrierIdName().
    • getSubscriberId

      @Implementation protected String getSubscriberId()
    • setSubscriberId

      public void setSubscriberId(String subscriberId)
      Sets the value to be returned by getSubscriberId().
    • getSubscriptionId

      @Implementation(minSdk=30) protected int getSubscriptionId(PhoneAccountHandle handle)
    • setPhoneAccountHandleSubscriptionId

      public void setPhoneAccountHandleSubscriptionId(PhoneAccountHandle handle, int subscriptionId)
    • getVisualVoicemailPackageName

      @Implementation(minSdk=26) protected String getVisualVoicemailPackageName()
      Returns the value set by setVisualVoicemailPackageName(String).
    • setVisualVoicemailPackageName

      public void setVisualVoicemailPackageName(String visualVoicemailPackageName)
      Sets the value to be returned by getVisualVoicemailPackageName().
    • getSignalStrength

      @Implementation(minSdk=28) protected SignalStrength getSignalStrength()
    • setSignalStrength

      public void setSignalStrength(SignalStrength signalStrength)
      Sets the value to be returned by getSignalStrength()
    • isEmergencyNumber

      @Implementation(minSdk=29) protected boolean isEmergencyNumber(String number)
      Cribbed from PhoneNumberUtils.isEmergencyNumberInternal(int, java.lang.String).

      TODO: need better implementation

    • setEmergencyCallbackMode

      public 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

      @Implementation(minSdk=26) protected boolean getEmergencyCallbackMode()
    • isPotentialEmergencyNumber

      @Implementation(minSdk=29) protected boolean isPotentialEmergencyNumber(String number)
    • isDataEnabled

      @Implementation(minSdk=26) protected boolean isDataEnabled()
      Returns:
      False by default, unless set with TelephonyManager.setDataEnabled(boolean).
    • isDataEnabledForReason

      @Implementation(minSdk=31) protected boolean isDataEnabledForReason(int reason)
      Returns:
      True by default, unless reason is set to false with TelephonyManager.setDataEnabledForReason(int, boolean).
    • setDataEnabled

      @Implementation(minSdk=26) public void setDataEnabled(boolean enabled)
      Implementation for TelephonyManager.setDataEnabled(boolean). Marked as public in order to allow it to be used as a test API.
    • setDataEnabledForReason

      @Implementation(minSdk=31) public void setDataEnabledForReason(int reason, boolean enabled)
      Implementation for TelephonyManager.setDataEnabledForReason(int, boolean). Marked as public in order to allow it to be used as a test API.
    • isRttSupported

      @Implementation(minSdk=29) protected boolean isRttSupported()
      Returns:
      False by default, unless set with setRttSupported(boolean).
    • setRttSupported

      public void setRttSupported(boolean isRttSupported)
      Sets the value to be returned by isRttSupported()
    • isTtyModeSupported

      @Implementation(minSdk=23) protected boolean isTtyModeSupported()
      Returns:
      False by default, unless set with setTtyModeSupported(boolean).
    • setTtyModeSupported

      public void setTtyModeSupported(boolean isTtyModeSupported)
      Sets the value to be returned by isTtyModeSupported()
    • hasCarrierPrivileges

      @Implementation(minSdk=24) @HiddenApi protected boolean hasCarrierPrivileges(int subId)
      Returns:
      False by default, unless set with setHasCarrierPrivileges(int, boolean).
    • setHasCarrierPrivileges

      public void setHasCarrierPrivileges(boolean hasCarrierPrivileges)
    • setHasCarrierPrivileges

      public void setHasCarrierPrivileges(int subId, boolean hasCarrierPrivileges)
      Sets the hasCarrierPrivileges for the given subId.
    • sendDialerSpecialCode

      @Implementation(minSdk=26) public void sendDialerSpecialCode(String inputCode)
      Parameters:
      inputCode - special code to be sent.
    • getSentDialerSpecialCodes

      public List<String> getSentDialerSpecialCodes()
      Returns immutable list of special codes sent using TelephonyManager.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 by isHearingAidCompatibilitySupported().
    • isHearingAidCompatibilitySupported

      @Implementation(minSdk=23) protected boolean isHearingAidCompatibilitySupported()
      Returns:
      False by default, unless set with setHearingAidCompatibilitySupported(boolean).
    • createTelephonyDisplayInfo

      public static Object createTelephonyDisplayInfo(int networkType, int overrideNetworkType)
      Parameters:
      networkType - The packet-switching cellular network type (see Annotation.NetworkType)
      overrideNetworkType - The override network type (see Annotation.OverrideNetworkType)
    • setTelephonyDisplayInfo

      public void setTelephonyDisplayInfo(Object telephonyDisplayInfo)
      Sets the current TelephonyDisplayInfo, and notifies all the PhoneStateListeners that were registered with the PhoneStateListener.LISTEN_DISPLAY_INFO_CHANGED flag.
      Parameters:
      telephonyDisplayInfo - The TelephonyDisplayInfo to 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)
    • sendVisualVoicemailSms

      @Implementation(minSdk=26) public void sendVisualVoicemailSms(String number, int port, String text, PendingIntent sentIntent)
    • getLastSentVisualVoicemailSmsParams

      public ShadowTelephonyManager.VisualVoicemailSmsParams getLastSentVisualVoicemailSmsParams()
    • setVisualVoicemailSmsFilterSettings

      @Implementation(minSdk=26) public void setVisualVoicemailSmsFilterSettings(VisualVoicemailSmsFilterSettings settings)
      Parameters:
      settings - The settings for the filter, or null to disable the filter.
    • getVisualVoicemailSmsFilterSettings

      public VisualVoicemailSmsFilterSettings getVisualVoicemailSmsFilterSettings()
      Returns the last set VisualVoicemailSmsFilterSettings.
    • setEmergencyNumberList

      public static void setEmergencyNumberList(Map<Integer,List<EmergencyNumber>> emergencyNumbersList)
      Sets the emergency numbers list returned by TelephonyManager.getEmergencyNumberList().
    • getEmergencyNumberList

      @Implementation(minSdk=30) protected Map<Integer,List<EmergencyNumber>> getEmergencyNumberList()
      Returns:
      an immutable map by default, unless set with setEmergencyNumberList(java.util.Map<java.lang.Integer, java.util.List<android.telephony.emergency.EmergencyNumber>>).
    • isDataRoamingEnabled

      @Implementation(minSdk=29) protected boolean isDataRoamingEnabled()
      Returns:
      False by default, unless set with setDataRoamingEnabled(boolean).
    • setDataRoamingEnabled

      @Implementation(minSdk=29) protected void setDataRoamingEnabled(boolean isDataRoamingEnabled)
      Sets the value to be returned by isDataRoamingEnabled()
    • setCarrierRestrictionRules

      public void setCarrierRestrictionRules(Object carrierRestrictionRules)
      Sets the value to be returned by getCarrierRestrictionRules(). Marked as public in order to allow it to be used as a test API.
      Parameters:
      carrierRestrictionRules - An object of type CarrierRestrictionRules
    • getCarrierRestrictionRules

      @Implementation(minSdk=29) protected Object getCarrierRestrictionRules()
    • rebootModem

      @Implementation(minSdk=33) protected void rebootModem()
    • getModemRebootCount

      public int getModemRebootCount()
    • getIccAuthentication

      @Implementation(minSdk=24) protected String getIccAuthentication(int appType, int authType, String data)
    • setIccAuthentication

      public void setIccAuthentication(String iccAuthentication)