@Implements(value=android.telephony.TelephonyManager.class) public class ShadowTelephonyManager extends java.lang.Object
| Constructor and Description | 
|---|
| ShadowTelephonyManager() | 
| Modifier and Type | Method and Description | 
|---|---|
| void | clearPhoneTypes()Removes all  subIdtophoneTypemappings. | 
| protected android.telephony.TelephonyManager | createForPhoneAccountHandle(android.telecom.PhoneAccountHandle handle)Returns  nullby default or the value specified viasetTelephonyManagerForHandle(PhoneAccountHandle, TelephonyManager). | 
| protected android.telephony.TelephonyManager | createForSubscriptionId(int subId)Returns  nullby default or the value specified viasetTelephonyManagerForSubscriptionId(int, TelephonyManager) | 
| protected java.util.List<android.telephony.CellInfo> | getAllCellInfo() | 
| protected int | getCallState()Call state may be specified via  setCallState(int). | 
| protected android.os.PersistableBundle | getCarrierConfig()Returns a new empty  PersistableBundleby default, or the value specified viasetCarrierConfig(PersistableBundle). | 
| protected java.util.List<java.lang.String> | getCarrierPackageNamesForIntent(android.content.Intent intent) | 
| protected java.util.List<java.lang.String> | getCarrierPackageNamesForIntentAndPhone(android.content.Intent intent,
                                       int phoneId) | 
| protected android.telephony.CellLocation | getCellLocation() | 
| protected int | getCurrentPhoneType(int subId) | 
| protected java.lang.String | getDeviceId() | 
| protected java.lang.String | getDeviceId(int slot)Returns  nullby default or the value specified viasetDeviceId(int, String). | 
| int | getEventFlags()Deprecated. 
 Avoid using. | 
| protected java.lang.String | getGroupIdLevel1() | 
| protected java.lang.String | getImei() | 
| protected java.lang.String | getLine1Number() | 
| android.telephony.PhoneStateListener | getListener()Deprecated. 
 Avoid using. | 
| protected java.lang.String | getMeid() | 
| protected java.lang.String | getNetworkCountryIso() | 
| protected java.lang.String | getNetworkOperator() | 
| protected java.lang.String | getNetworkOperatorName() | 
| protected int | getNetworkType() | 
| protected int | getPhoneCount()Returns 1 by default or the value specified via  setPhoneCount(int). | 
| protected int | getPhoneType() | 
| protected android.telephony.ServiceState | getServiceState()Returns  nullby default or the value specified viasetServiceState(ServiceState) | 
| protected int | getSimCarrierId() | 
| protected java.lang.String | getSimCountryIso() | 
| protected java.lang.String | getSimCountryIso(int subId) | 
| protected java.lang.String | getSimOperator() | 
| protected java.lang.String | getSimOperatorName() | 
| protected java.lang.String | getSimSerialNumber() | 
| protected int | getSimState() | 
| protected int | getSimState(int slotIndex) | 
| protected java.lang.String | getSubscriberId() | 
| protected java.lang.String | getVoiceMailAlphaTag()Returns  nullby default or the value specified viasetVoiceMailAlphaTag(String). | 
| protected java.lang.String | getVoiceMailNumber()Returns  nullby default, or the value specified viasetVoiceMailNumber(String). | 
| protected android.net.Uri | getVoicemailRingtoneUri(android.telecom.PhoneAccountHandle handle)Returns  nullby default or the value specified viasetVoicemailRingtoneUri(PhoneAccountHandle, Uri). | 
| protected int | getVoiceNetworkType()Returns whatever value was set by the last call to  setVoiceNetworkType(int), defaulting toTelephonyManager.NETWORK_TYPE_UNKNOWNif it was never called. | 
| protected boolean | isNetworkRoaming()Returns  falseby default or the value specified viasetIsNetworkRoaming(boolean) | 
| protected boolean | isSmsCapable() | 
| protected boolean | isVoicemailVibrationEnabled(android.telecom.PhoneAccountHandle handle)Returns  nullby default or the value specified viasetVoicemailVibrationEnabled(PhoneAccountHandle, boolean). | 
| protected void | listen(android.telephony.PhoneStateListener listener,
      int flags) | 
| void | resetSimCountryIsos()Clears  subIdto simCountryIso mapping and resets to default state. | 
| void | resetSimStates()Clears  slotIndexto state mapping and resets to default state. | 
| void | setAllCellInfo(java.util.List<android.telephony.CellInfo> allCellInfo) | 
| void | setCallState(int callState)Sets the current call state to the desired state and updates any listeners. | 
| void | setCallState(int callState,
            java.lang.String incomingPhoneNumber)Sets the current call state with the option to specify an incoming phone number for the CALL_STATE_RINGING state. | 
| void | setCarrierConfig(android.os.PersistableBundle carrierConfig)Sets the value returned by  TelephonyManager.getCarrierConfig(). | 
| void | setCarrierPackageNamesForPhone(int phoneId,
                              java.util.List<java.lang.String> packages)Sets the  packagesfor the givenphoneId. | 
| void | setCellLocation(android.telephony.CellLocation cellLocation) | 
| void | setCurrentPhoneType(int subId,
                   int phoneType)Sets the phone type for the given  subId. | 
| void | setDeviceId(int slot,
           java.lang.String deviceId)Sets the value returned by  TelephonyManager.getDeviceId(int). | 
| void | setDeviceId(java.lang.String newDeviceId) | 
| void | setGroupIdLevel1(java.lang.String groupIdLevel1) | 
| void | setImei(java.lang.String imei)Set the IMEI returned by getImei(). | 
| void | setIsNetworkRoaming(boolean isNetworkRoaming)Sets the value returned by  TelephonyManager.isNetworkRoaming(). | 
| void | setIsSmsCapable(boolean isSmsCapable)Sets the value returned by  TelephonyManager.isSmsCapable(). | 
| void | setLine1Number(java.lang.String line1Number) | 
| void | setMeid(java.lang.String meid)Set the MEID returned by getMeid(). | 
| void | setNetworkCountryIso(java.lang.String networkCountryIso) | 
| void | setNetworkOperator(java.lang.String networkOperator) | 
| void | setNetworkOperatorName(java.lang.String networkOperatorName) | 
| void | setNetworkType(int networkType) | 
| void | setPhoneCount(int phoneCount)Sets the value returned by  TelephonyManager.getPhoneCount(). | 
| void | setPhoneType(int phoneType) | 
| void | setReadPhoneStatePermission(boolean readPhoneStatePermission) | 
| void | setServiceState(android.telephony.ServiceState serviceState)Sets the value returned by  TelephonyManager.getServiceState(). | 
| void | setSimCarrierId(int simCarrierId)Sets the value to be returned by  getSimCarrierId(). | 
| void | setSimCountryIso(int subId,
                java.lang.String simCountryIso)Sets the  simCountryIsofor the givensubId. | 
| void | setSimCountryIso(java.lang.String simCountryIso) | 
| void | setSimOperator(java.lang.String simOperator) | 
| void | setSimOperatorName(java.lang.String simOperatorName) | 
| void | setSimSerialNumber(java.lang.String simSerialNumber)sets the serial number that will be returned by  getSimSerialNumber(). | 
| void | setSimState(int simState)Sets the sim state of slot 0. | 
| void | setSimState(int slotIndex,
           int state)Set the sim state for the given  slotIndex. | 
| void | setSubscriberId(java.lang.String subscriberId)Sets the value to be returned by  getSubscriberId(). | 
| void | setTelephonyManagerForHandle(android.telecom.PhoneAccountHandle handle,
                            android.telephony.TelephonyManager telephonyManager)Sets the value returned by  TelephonyManager.createForPhoneAccountHandle(PhoneAccountHandle). | 
| void | setTelephonyManagerForSubscriptionId(int subscriptionId,
                                    android.telephony.TelephonyManager telephonyManager)Sets the value returned by  TelephonyManager.createForSubscriptionId(int). | 
| void | setVoiceMailAlphaTag(java.lang.String voiceMailAlphaTag)Sets the value returned by  TelephonyManager.getVoiceMailAlphaTag(). | 
| void | setVoiceMailNumber(java.lang.String voiceMailNumber)Sets the value returned by  TelephonyManager.getVoiceMailNumber(). | 
| protected void | setVoicemailRingtoneUri(android.telecom.PhoneAccountHandle handle,
                       android.net.Uri uri)Sets the value returned by  TelephonyManager.getVoicemailRingtoneUri(PhoneAccountHandle). | 
| protected void | setVoicemailVibrationEnabled(android.telecom.PhoneAccountHandle handle,
                            boolean isEnabled)Sets the value returned by  TelephonyManager.isVoicemailVibrationEnabled(PhoneAccountHandle). | 
| void | setVoiceNetworkType(int voiceNetworkType)Sets the value to be returned by calls to  getVoiceNetworkType. | 
@Implementation protected void listen(android.telephony.PhoneStateListener listener, int flags)
@Deprecated public android.telephony.PhoneStateListener getListener()
Returns the most recent listener passed to #listen().
@Deprecated public int getEventFlags()
Returns the most recent flags passed to #listen().
@Implementation protected int getCallState()
Call state may be specified via setCallState(int).
public void setCallState(int callState)
Sets the current call state to the desired state and updates any listeners.
public void setCallState(int callState,
                         java.lang.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.
@Implementation protected java.lang.String getDeviceId()
public void setDeviceId(java.lang.String newDeviceId)
public void setNetworkOperatorName(java.lang.String networkOperatorName)
@Implementation(minSdk=21) protected java.lang.String getImei()
public void setImei(java.lang.String imei)
Set the IMEI returned by getImei().
@Implementation(minSdk=26) protected java.lang.String getMeid()
public void setMeid(java.lang.String meid)
Set the MEID returned by getMeid().
@Implementation protected java.lang.String getNetworkOperatorName()
public void setNetworkCountryIso(java.lang.String networkCountryIso)
@Implementation protected java.lang.String getNetworkCountryIso()
public void setNetworkOperator(java.lang.String networkOperator)
@Implementation protected java.lang.String getNetworkOperator()
@Implementation protected java.lang.String getSimOperator()
public void setSimOperator(java.lang.String simOperator)
@Implementation protected java.lang.String getSimOperatorName()
public void setSimOperatorName(java.lang.String simOperatorName)
@Implementation protected java.lang.String getSimSerialNumber()
public void setSimSerialNumber(java.lang.String simSerialNumber)
sets the serial number that will be returned by getSimSerialNumber().
@Implementation protected java.lang.String getSimCountryIso()
@Implementation(minSdk=24) @HiddenApi protected java.lang.String getSimCountryIso(int subId)
public void setSimCountryIso(java.lang.String simCountryIso)
public void setSimCountryIso(int subId,
                             java.lang.String simCountryIso)
Sets the simCountryIso for the given subId.
public void resetSimCountryIsos()
Clears subId to simCountryIso mapping and resets to default state.
@Implementation protected int getSimState()
public void setSimState(int simState)
Sets the sim state of slot 0.
public void setSimState(int slotIndex,
                        int state)
Set the sim state for the given slotIndex.
@Implementation(minSdk=26) protected int getSimState(int slotIndex)
public void resetSimStates()
Clears slotIndex to state mapping and resets to default state.
public void setReadPhoneStatePermission(boolean readPhoneStatePermission)
@Implementation protected int getPhoneType()
public void setPhoneType(int phoneType)
@Implementation protected java.lang.String getLine1Number()
public void setLine1Number(java.lang.String line1Number)
@Implementation protected int getNetworkType()
public void setNetworkType(int networkType)
@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.
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.
@Implementation(minSdk=17) protected java.util.List<android.telephony.CellInfo> getAllCellInfo()
public void setAllCellInfo(java.util.List<android.telephony.CellInfo> allCellInfo)
@Implementation protected android.telephony.CellLocation getCellLocation()
public void setCellLocation(android.telephony.CellLocation cellLocation)
@Implementation(minSdk=18) protected java.lang.String getGroupIdLevel1()
public void setGroupIdLevel1(java.lang.String groupIdLevel1)
@Implementation protected boolean isSmsCapable()
true by default, or the value specified via setIsSmsCapable(boolean)public void setIsSmsCapable(boolean isSmsCapable)
Sets the value returned by TelephonyManager.isSmsCapable().
@Implementation(minSdk=26) protected android.os.PersistableBundle getCarrierConfig()
Returns a new empty PersistableBundle by default, or the value specified via setCarrierConfig(PersistableBundle).
public void setCarrierConfig(android.os.PersistableBundle carrierConfig)
Sets the value returned by TelephonyManager.getCarrierConfig().
carrierConfig - @Implementation protected java.lang.String getVoiceMailNumber()
Returns null by default, or the value specified via setVoiceMailNumber(String).
public void setVoiceMailNumber(java.lang.String voiceMailNumber)
Sets the value returned by TelephonyManager.getVoiceMailNumber().
@Implementation protected java.lang.String getVoiceMailAlphaTag()
Returns null by default or the value specified via setVoiceMailAlphaTag(String).
public void setVoiceMailAlphaTag(java.lang.String voiceMailAlphaTag)
Sets the value returned by TelephonyManager.getVoiceMailAlphaTag().
@Implementation(minSdk=23) protected int getPhoneCount()
Returns 1 by default or the value specified via setPhoneCount(int).
public void setPhoneCount(int phoneCount)
Sets the value returned by TelephonyManager.getPhoneCount().
@Implementation(minSdk=23) protected java.lang.String getDeviceId(int slot)
Returns null by default or the value specified via setDeviceId(int, String).
public void setDeviceId(int slot,
                        java.lang.String deviceId)
Sets the value returned by TelephonyManager.getDeviceId(int).
@Implementation(minSdk=24) protected boolean isVoicemailVibrationEnabled(android.telecom.PhoneAccountHandle handle)
Returns null by default or the value specified via setVoicemailVibrationEnabled(PhoneAccountHandle, boolean).
@Implementation(minSdk=26) protected void setVoicemailVibrationEnabled(android.telecom.PhoneAccountHandle handle, boolean isEnabled)
Sets the value returned by TelephonyManager.isVoicemailVibrationEnabled(PhoneAccountHandle).
@Implementation(minSdk=24) protected android.net.Uri getVoicemailRingtoneUri(android.telecom.PhoneAccountHandle handle)
Returns null by default or the value specified via setVoicemailRingtoneUri(PhoneAccountHandle, Uri).
@Implementation(minSdk=26) protected void setVoicemailRingtoneUri(android.telecom.PhoneAccountHandle handle, android.net.Uri uri)
Sets the value returned by TelephonyManager.getVoicemailRingtoneUri(PhoneAccountHandle).
@Implementation(minSdk=26) protected android.telephony.TelephonyManager createForPhoneAccountHandle(android.telecom.PhoneAccountHandle handle)
Returns null by default or the value specified via setTelephonyManagerForHandle(PhoneAccountHandle, TelephonyManager).
public void setTelephonyManagerForHandle(android.telecom.PhoneAccountHandle handle,
                                         android.telephony.TelephonyManager telephonyManager)
Sets the value returned by TelephonyManager.createForPhoneAccountHandle(PhoneAccountHandle).
@Implementation(minSdk=24) protected android.telephony.TelephonyManager createForSubscriptionId(int subId)
Returns null by default or the value specified via setTelephonyManagerForSubscriptionId(int, TelephonyManager)
public void setTelephonyManagerForSubscriptionId(int subscriptionId,
                                                 android.telephony.TelephonyManager telephonyManager)
Sets the value returned by TelephonyManager.createForSubscriptionId(int).
@Implementation(minSdk=26) protected android.telephony.ServiceState getServiceState()
Returns null by default or the value specified via setServiceState(ServiceState)
public void setServiceState(android.telephony.ServiceState serviceState)
Sets the value returned by TelephonyManager.getServiceState().
@Implementation protected boolean isNetworkRoaming()
Returns false by default or the value specified via setIsNetworkRoaming(boolean)
public void setIsNetworkRoaming(boolean isNetworkRoaming)
Sets the value returned by TelephonyManager.isNetworkRoaming().
@Implementation(minSdk=23) @HiddenApi protected int getCurrentPhoneType(int subId)
public void setCurrentPhoneType(int subId,
                                int phoneType)
Sets the phone type for the given subId.
public void clearPhoneTypes()
Removes all subId to phoneType mappings.
@Implementation(minSdk=23) @HiddenApi protected java.util.List<java.lang.String> getCarrierPackageNamesForIntentAndPhone(android.content.Intent intent, int phoneId)
@Implementation(minSdk=21) @HiddenApi protected java.util.List<java.lang.String> getCarrierPackageNamesForIntent(android.content.Intent intent)
public void setCarrierPackageNamesForPhone(int phoneId,
                                           java.util.List<java.lang.String> packages)
Sets the packages for the given phoneId.
@Implementation(minSdk=28) protected int getSimCarrierId()
public void setSimCarrierId(int simCarrierId)
Sets the value to be returned by getSimCarrierId().
@Implementation protected java.lang.String getSubscriberId()
public void setSubscriberId(java.lang.String subscriberId)
Sets the value to be returned by getSubscriberId().