Class ShadowTelecomManager
- java.lang.Object
-
- org.robolectric.shadows.ShadowTelecomManager
-
@Implements(value=android.telecom.TelecomManager.class, minSdk=21) public class ShadowTelecomManager extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ShadowTelecomManager.CallRecord
Deprecated.static class
ShadowTelecomManager.CallRequestMode
Mode describing how the shadow handles incoming (TelecomManager.addNewIncomingCall(android.telecom.PhoneAccountHandle, android.os.Bundle)
) and outgoing (TelecomManager.placeCall(android.net.Uri, android.os.Bundle)
) call requests.static class
ShadowTelecomManager.IncomingCallRecord
Details about an incoming call request made viaTelecomManager.addNewIncomingCall(android.telecom.PhoneAccountHandle, android.os.Bundle)
.static class
ShadowTelecomManager.OutgoingCallRecord
Details about an outgoing call request made viaTelecomManager.placeCall(android.net.Uri, android.os.Bundle)
.static class
ShadowTelecomManager.UnknownCallRecord
Details about an unknown call request made viaTelecomManager.addNewUnknownCall(android.telecom.PhoneAccountHandle, android.os.Bundle)
.
-
Constructor Summary
Constructors Constructor Description ShadowTelecomManager()
-
Method Summary
-
-
-
Method Detail
-
getCallRequestMode
public ShadowTelecomManager.CallRequestMode getCallRequestMode()
-
setCallRequestMode
public void setCallRequestMode(ShadowTelecomManager.CallRequestMode callRequestMode)
-
setDefaultOutgoingPhoneAccount
public void setDefaultOutgoingPhoneAccount(String uriScheme, PhoneAccountHandle handle)
Set default outgoing phone account to be returned fromgetDefaultOutgoingPhoneAccount(String)
for correspondinguriScheme
.
-
removeDefaultOutgoingPhoneAccount
public void removeDefaultOutgoingPhoneAccount(String uriScheme)
Remove default outgoing phone account for correspondinguriScheme
.
-
getDefaultOutgoingPhoneAccount
@Implementation protected PhoneAccountHandle getDefaultOutgoingPhoneAccount(String uriScheme)
Returns default outgoing phone account set throughsetDefaultOutgoingPhoneAccount(String, PhoneAccountHandle)
for correspondinguriScheme
.
-
getUserSelectedOutgoingPhoneAccount
@Implementation @HiddenApi public PhoneAccountHandle getUserSelectedOutgoingPhoneAccount()
-
setUserSelectedOutgoingPhoneAccount
@Implementation @HiddenApi public void setUserSelectedOutgoingPhoneAccount(PhoneAccountHandle accountHandle)
-
getSimCallManager
@Implementation protected PhoneAccountHandle getSimCallManager()
-
getSimCallManager
@Implementation(minSdk=23) @HiddenApi public PhoneAccountHandle getSimCallManager(int userId)
-
getConnectionManager
@Implementation @HiddenApi public PhoneAccountHandle getConnectionManager()
-
getPhoneAccountsSupportingScheme
@Implementation @HiddenApi public List<PhoneAccountHandle> getPhoneAccountsSupportingScheme(String uriScheme)
-
getCallCapablePhoneAccounts
@Implementation(minSdk=23) protected List<PhoneAccountHandle> getCallCapablePhoneAccounts()
-
getCallCapablePhoneAccounts
@Implementation(minSdk=23) @HiddenApi public List<PhoneAccountHandle> getCallCapablePhoneAccounts(boolean includeDisabledAccounts)
-
getSelfManagedPhoneAccounts
@Implementation(minSdk=26) public List<PhoneAccountHandle> getSelfManagedPhoneAccounts()
-
getPhoneAccountsForPackage
@Implementation @HiddenApi public List<PhoneAccountHandle> getPhoneAccountsForPackage()
-
getPhoneAccount
@Implementation protected PhoneAccount getPhoneAccount(PhoneAccountHandle account)
-
getAllPhoneAccountsCount
@Implementation @HiddenApi public int getAllPhoneAccountsCount()
-
getAllPhoneAccounts
@Implementation @HiddenApi public List<PhoneAccount> getAllPhoneAccounts()
-
getAllPhoneAccountHandles
@Implementation @HiddenApi public List<PhoneAccountHandle> getAllPhoneAccountHandles()
-
registerPhoneAccount
@Implementation protected void registerPhoneAccount(PhoneAccount account)
-
unregisterPhoneAccount
@Implementation protected void unregisterPhoneAccount(PhoneAccountHandle accountHandle)
-
clearAccounts
@Deprecated @Implementation @HiddenApi public void clearAccounts()
Deprecated.
-
clearAccountsForPackage
@Implementation(minSdk=22) @HiddenApi public void clearAccountsForPackage(String packageName)
-
getDefaultPhoneApp
@Deprecated @Implementation @HiddenApi public ComponentName getDefaultPhoneApp()
Deprecated.
-
getDefaultDialerPackage
@Implementation(minSdk=23) protected String getDefaultDialerPackage()
-
setDefaultDialer
@Deprecated @Implementation(minSdk=23) @HiddenApi public boolean setDefaultDialer(String packageName)
Deprecated.API deprecated since Q, for testing, use setDefaultDialerPackage instead
-
setDefaultDialerPackage
public void setDefaultDialerPackage(String packageName)
Set returned value ofgetDefaultDialerPackage()
.
-
getSystemDialerPackage
@Implementation(minSdk=23) @HiddenApi protected String getSystemDialerPackage()
-
setSystemDialerPackage
public void setSystemDialerPackage(String packageName)
Set returned value ofgetSystemDialerPackage()
.
-
isVoiceMailNumber
@Implementation(minSdk=22) protected boolean isVoiceMailNumber(PhoneAccountHandle accountHandle, String number)
-
getVoiceMailNumber
@Implementation(minSdk=23) protected String getVoiceMailNumber(PhoneAccountHandle accountHandle)
-
getLine1Number
@Implementation(minSdk=22) protected String getLine1Number(PhoneAccountHandle accountHandle)
-
setIsInCall
public void setIsInCall(boolean isInCall)
Sets the return value forTelecomManager.isInCall()
.
-
isInCall
@Implementation protected boolean isInCall()
Overrides behavior ofTelecomManager.isInCall()
to return pre-set result.- Returns:
- Value set by calling
setIsInCall(boolean)
. If setIsInCall has not previously been called, will return false.
-
getCallState
@Implementation @HiddenApi public int getCallState()
-
isRinging
@Implementation @HiddenApi public boolean isRinging()
-
endCall
@Implementation @HiddenApi public boolean endCall()
-
acceptRingingCall
@Implementation protected void acceptRingingCall()
-
silenceRinger
@Implementation protected void silenceRinger()
-
isTtySupported
@Implementation protected boolean isTtySupported()
-
setTtySupported
public void setTtySupported(boolean isSupported)
Sets the value to be returned byisTtySupported()
.
-
getCurrentTtyMode
@Implementation @HiddenApi public int getCurrentTtyMode()
-
addNewIncomingCall
@Implementation protected void addNewIncomingCall(PhoneAccountHandle phoneAccount, Bundle extras)
-
getAllIncomingCalls
public List<ShadowTelecomManager.IncomingCallRecord> getAllIncomingCalls()
-
getLastIncomingCall
public ShadowTelecomManager.IncomingCallRecord getLastIncomingCall()
-
getOnlyIncomingCall
public ShadowTelecomManager.IncomingCallRecord getOnlyIncomingCall()
-
allowIncomingCall
@Nullable public Connection allowIncomingCall(ShadowTelecomManager.IncomingCallRecord call)
Allows anShadowTelecomManager.IncomingCallRecord
created viaTelecomManager.addNewIncomingCall(android.telecom.PhoneAccountHandle, android.os.Bundle)
.Specifically, this method sets up the relevant
ConnectionService
and returns the result ofConnectionService.onCreateIncomingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest)
.
-
denyIncomingCall
public void denyIncomingCall(ShadowTelecomManager.IncomingCallRecord call)
Denies anShadowTelecomManager.IncomingCallRecord
created viaTelecomManager.addNewIncomingCall(android.telecom.PhoneAccountHandle, android.os.Bundle)
.Specifically, this method sets up the relevant
ConnectionService
and callsConnectionService.onCreateIncomingConnectionFailed(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest)
.
-
placeCall
@Implementation(minSdk=23) protected void placeCall(Uri address, Bundle extras)
-
getAllOutgoingCalls
public List<ShadowTelecomManager.OutgoingCallRecord> getAllOutgoingCalls()
-
getLastOutgoingCall
public ShadowTelecomManager.OutgoingCallRecord getLastOutgoingCall()
-
getOnlyOutgoingCall
public ShadowTelecomManager.OutgoingCallRecord getOnlyOutgoingCall()
-
allowOutgoingCall
@Nullable public Connection allowOutgoingCall(ShadowTelecomManager.OutgoingCallRecord call)
Allows anShadowTelecomManager.OutgoingCallRecord
created viaTelecomManager.placeCall(android.net.Uri, android.os.Bundle)
.Specifically, this method sets up the relevant
ConnectionService
and returns the result ofConnectionService.onCreateOutgoingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest)
.
-
denyOutgoingCall
public void denyOutgoingCall(ShadowTelecomManager.OutgoingCallRecord call)
Denies anShadowTelecomManager.OutgoingCallRecord
created viaTelecomManager.placeCall(android.net.Uri, android.os.Bundle)
.Specifically, this method sets up the relevant
ConnectionService
and callsConnectionService.onCreateOutgoingConnectionFailed(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest)
.
-
addNewUnknownCall
@Implementation @HiddenApi public void addNewUnknownCall(PhoneAccountHandle phoneAccount, Bundle extras)
-
getAllUnknownCalls
public List<ShadowTelecomManager.UnknownCallRecord> getAllUnknownCalls()
-
getLastUnknownCall
public ShadowTelecomManager.UnknownCallRecord getLastUnknownCall()
-
getOnlyUnknownCall
public ShadowTelecomManager.UnknownCallRecord getOnlyUnknownCall()
-
handleMmi
@Implementation protected boolean handleMmi(String dialString)
-
handleMmi
@Implementation(minSdk=23) protected boolean handleMmi(String dialString, PhoneAccountHandle accountHandle)
-
getAdnUriForPhoneAccount
@Implementation(minSdk=22) protected Uri getAdnUriForPhoneAccount(PhoneAccountHandle accountHandle)
-
cancelMissedCallsNotification
@Implementation protected void cancelMissedCallsNotification()
-
showInCallScreen
@Implementation protected void showInCallScreen(boolean showDialpad)
-
enablePhoneAccount
@Implementation(minSdk=23) @HiddenApi public void enablePhoneAccount(PhoneAccountHandle handle, boolean isEnabled)
-
createManageBlockedNumbersIntent
@Implementation(minSdk=24) protected Intent createManageBlockedNumbersIntent()
Returns the intent set bysetManageBlockNumbersIntent(Intent)
()}
-
setManageBlockNumbersIntent
public void setManageBlockNumbersIntent(Intent intent)
Sets the BlockNumbersIntent to be returned bycreateManageBlockedNumbersIntent()
-
setSimCallManager
@Implementation(maxSdk=22) public void setSimCallManager(PhoneAccountHandle simCallManager)
-
newCallAudioState
public CallAudioState newCallAudioState(boolean muted, int route, int supportedRouteMask, BluetoothDevice activeBluetoothDevice, Collection<BluetoothDevice> supportedBluetoothDevices)
Creates a newCallAudioState
. The real constructor ofCallAudioState
is hidden.
-
createLaunchEmergencyDialerIntent
@Implementation(minSdk=30) protected Intent createLaunchEmergencyDialerIntent(String number)
-
-