Class ShadowTelecomManager
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Deprecated.static enum
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
Details about an incoming call request made viaTelecomManager.addNewIncomingCall(android.telecom.PhoneAccountHandle, android.os.Bundle)
.static class
Details about an outgoing call request made viaTelecomManager.placeCall(android.net.Uri, android.os.Bundle)
.static class
Details about an unknown call request made viaTelecomManager.addNewUnknownCall(android.telecom.PhoneAccountHandle, android.os.Bundle)
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
addNewIncomingCall
(PhoneAccountHandle phoneAccount, Bundle extras) void
addNewUnknownCall
(PhoneAccountHandle phoneAccount, Bundle extras) protected void
void
Deprecated.void
clearAccountsForPackage
(String packageName) protected Intent
protected Intent
Returns the intent set bysetManageBlockNumbersIntent(Intent)
()}void
void
void
enablePhoneAccount
(PhoneAccountHandle handle, boolean isEnabled) boolean
endCall()
protected Uri
getAdnUriForPhoneAccount
(PhoneAccountHandle accountHandle) int
protected List<PhoneAccountHandle>
getCallCapablePhoneAccounts
(boolean includeDisabledAccounts) int
int
protected String
protected PhoneAccountHandle
getDefaultOutgoingPhoneAccount
(String uriScheme) Returns default outgoing phone account set throughsetDefaultOutgoingPhoneAccount(String, PhoneAccountHandle)
for correspondinguriScheme
.Deprecated.protected String
getLine1Number
(PhoneAccountHandle accountHandle) protected PhoneAccount
getPhoneAccount
(PhoneAccountHandle account) getPhoneAccountsSupportingScheme
(String uriScheme) protected PhoneAccountHandle
getSimCallManager
(int userId) protected String
protected String
getVoiceMailNumber
(PhoneAccountHandle accountHandle) protected boolean
protected boolean
handleMmi
(String dialString, PhoneAccountHandle accountHandle) protected boolean
isInCall()
Overrides behavior ofTelecomManager.isInCall()
to return pre-set result.protected boolean
Overrides behavior ofTelecomManager.isInEmergencyCall()
to return pre-set result.protected boolean
isOutgoingCallPermitted
(PhoneAccountHandle phoneAccountHandle) boolean
protected boolean
protected boolean
isVoiceMailNumber
(PhoneAccountHandle accountHandle, String number) newCallAudioState
(boolean muted, int route, int supportedRouteMask, BluetoothDevice activeBluetoothDevice, Collection<BluetoothDevice> supportedBluetoothDevices) Creates a newCallAudioState
.protected void
protected void
registerPhoneAccount
(PhoneAccount account) void
removeDefaultOutgoingPhoneAccount
(String uriScheme) Remove default outgoing phone account for correspondinguriScheme
.void
setCallPhonePermission
(boolean callPhonePermission) When set to false methods requiringandroid.Manifest.permission.CALL_PHONE
permission will throw aSecurityException
.void
setCallRequestMode
(ShadowTelecomManager.CallRequestMode callRequestMode) void
setConnectionService
(ConnectionService service) Set connection service.boolean
setDefaultDialer
(String packageName) Deprecated.API deprecated since Q, for testing, use setDefaultDialerPackage insteadvoid
setDefaultDialerPackage
(String packageName) Set returned value ofgetDefaultDialerPackage()
.void
setDefaultOutgoingPhoneAccount
(String uriScheme, PhoneAccountHandle handle) Set default outgoing phone account to be returned fromgetDefaultOutgoingPhoneAccount(String)
for correspondinguriScheme
.void
setHandleMmiValue
(boolean handleMmiValue) void
setIsInCall
(boolean isInCall) Sets the return value forTelecomManager.isInCall()
.void
setIsInEmergencyCall
(boolean isInEmergencyCall) Sets the return value forTelecomManager.isInEmergencyCall()
andTelecomManager.isInCall()
.void
setIsOutgoingCallPermitted
(boolean isOutgoingCallPermitted) Sets the result ofTelecomManager.isOutgoingCallPermitted(PhoneAccountHandle)
.void
setLine1Number
(PhoneAccountHandle accountHandle, String number) void
setManageBlockNumbersIntent
(Intent intent) Sets the BlockNumbersIntent to be returned bycreateManageBlockedNumbersIntent()
void
setReadPhoneStatePermission
(boolean readPhoneStatePermission) When set to false methods requiringandroid.Manifest.permission.READ_PHONE_STATE
permission will throw aSecurityException
.void
setSimCallManager
(PhoneAccountHandle simCallManager) void
setSystemDialerPackage
(String packageName) Set returned value ofgetSystemDialerPackage()
.void
setTtySupported
(boolean isSupported) Sets the value to be returned byisTtySupported()
.void
setUserSelectedOutgoingPhoneAccount
(PhoneAccountHandle accountHandle) void
setVoicemailNumber
(PhoneAccountHandle accountHandle, String number) protected void
showInCallScreen
(boolean showDialpad) protected void
protected void
unregisterPhoneAccount
(PhoneAccountHandle accountHandle)
-
Constructor Details
-
ShadowTelecomManager
public ShadowTelecomManager()
-
-
Method Details
-
getCallRequestMode
-
setCallRequestMode
-
setDefaultOutgoingPhoneAccount
Set default outgoing phone account to be returned fromgetDefaultOutgoingPhoneAccount(String)
for correspondinguriScheme
. -
removeDefaultOutgoingPhoneAccount
Remove default outgoing phone account for correspondinguriScheme
. -
setIsOutgoingCallPermitted
public void setIsOutgoingCallPermitted(boolean isOutgoingCallPermitted) Sets the result ofTelecomManager.isOutgoingCallPermitted(PhoneAccountHandle)
. -
getDefaultOutgoingPhoneAccount
Returns default outgoing phone account set throughsetDefaultOutgoingPhoneAccount(String, PhoneAccountHandle)
for correspondinguriScheme
. -
getUserSelectedOutgoingPhoneAccount
-
setUserSelectedOutgoingPhoneAccount
@Implementation @HiddenApi public void setUserSelectedOutgoingPhoneAccount(PhoneAccountHandle accountHandle) -
getSimCallManager
-
getSimCallManager
-
getConnectionManager
-
getPhoneAccountsSupportingScheme
@Implementation @HiddenApi public List<PhoneAccountHandle> getPhoneAccountsSupportingScheme(String uriScheme) -
getCallCapablePhoneAccounts
-
getCallCapablePhoneAccounts
@Implementation(minSdk=23) @HiddenApi public List<PhoneAccountHandle> getCallCapablePhoneAccounts(boolean includeDisabledAccounts) -
getSelfManagedPhoneAccounts
-
getPhoneAccountsForPackage
-
getPhoneAccount
-
getAllPhoneAccountsCount
-
getAllPhoneAccounts
-
getAllPhoneAccountHandles
-
registerPhoneAccount
-
unregisterPhoneAccount
-
clearAccounts
Deprecated. -
clearAccountsForPackage
-
getDefaultPhoneApp
Deprecated. -
getDefaultDialerPackage
-
setDefaultDialer
@Deprecated @Implementation(minSdk=23) @HiddenApi public boolean setDefaultDialer(String packageName) Deprecated.API deprecated since Q, for testing, use setDefaultDialerPackage instead -
setDefaultDialerPackage
Set returned value ofgetDefaultDialerPackage()
. -
getSystemDialerPackage
-
setSystemDialerPackage
Set returned value ofgetSystemDialerPackage()
. -
setVoicemailNumber
-
isVoiceMailNumber
@Implementation(minSdk=23) protected boolean isVoiceMailNumber(PhoneAccountHandle accountHandle, String number) -
getVoiceMailNumber
-
getLine1Number
-
setLine1Number
-
setIsInCall
public void setIsInCall(boolean isInCall) Sets the return value forTelecomManager.isInCall()
. -
isInCall
Overrides behavior ofTelecomManager.isInCall()
to return pre-set result.- Returns:
- Value set by calling
setIsInCall(boolean)
orsetIsInEmergencyCall(boolean)
. If neither has previously been called, will return false.
-
setIsInEmergencyCall
public void setIsInEmergencyCall(boolean isInEmergencyCall) Sets the return value forTelecomManager.isInEmergencyCall()
andTelecomManager.isInCall()
. -
isInEmergencyCall
Overrides behavior ofTelecomManager.isInEmergencyCall()
to return pre-set result.- Returns:
- Value set by calling
setIsInEmergencyCall(boolean)
. If setIsInEmergencyCall has not previously been called, will return false.
-
getCallState
-
isRinging
-
endCall
-
acceptRingingCall
-
silenceRinger
-
isTtySupported
-
setTtySupported
public void setTtySupported(boolean isSupported) Sets the value to be returned byisTtySupported()
. -
getCurrentTtyMode
-
addNewIncomingCall
-
getAllIncomingCalls
-
getLastIncomingCall
-
getOnlyIncomingCall
-
allowIncomingCall
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
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
-
getAllOutgoingCalls
-
getLastOutgoingCall
-
getOnlyOutgoingCall
-
allowOutgoingCall
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
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
-
getLastUnknownCall
-
getOnlyUnknownCall
-
setConnectionService
Set connection service.This method can be used in case, when you already created connection service and would like to use it in telecom manager instead of creating new one.
- Parameters:
service
- existing connection service
-
setHandleMmiValue
public void setHandleMmiValue(boolean handleMmiValue) -
handleMmi
-
handleMmi
@Implementation(minSdk=23) protected boolean handleMmi(String dialString, PhoneAccountHandle accountHandle) -
getAdnUriForPhoneAccount
-
cancelMissedCallsNotification
-
showInCallScreen
-
enablePhoneAccount
@Implementation(minSdk=23) @HiddenApi public void enablePhoneAccount(PhoneAccountHandle handle, boolean isEnabled) -
createManageBlockedNumbersIntent
Returns the intent set bysetManageBlockNumbersIntent(Intent)
()} -
setManageBlockNumbersIntent
Sets the BlockNumbersIntent to be returned bycreateManageBlockedNumbersIntent()
-
setSimCallManager
-
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
-
isOutgoingCallPermitted
@Implementation(minSdk=26) protected boolean isOutgoingCallPermitted(PhoneAccountHandle phoneAccountHandle) -
setReadPhoneStatePermission
public void setReadPhoneStatePermission(boolean readPhoneStatePermission) When set to false methods requiringandroid.Manifest.permission.READ_PHONE_STATE
permission will throw aSecurityException
. By default it's set to true for backwards compatibility. -
setCallPhonePermission
public void setCallPhonePermission(boolean callPhonePermission) When set to false methods requiringandroid.Manifest.permission.CALL_PHONE
permission will throw aSecurityException
. By default it's set to true for backwards compatibility.
-
ShadowTelecomManager.IncomingCallRecord
orShadowTelecomManager.UnknownCallRecord
instead.