Class ShadowTelecomManager
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDeprecated.static enumMode 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 classDetails about an incoming call request made viaTelecomManager.addNewIncomingCall(android.telecom.PhoneAccountHandle, android.os.Bundle).static classDetails about an outgoing call request made viaTelecomManager.placeCall(android.net.Uri, android.os.Bundle).static classDetails about an unknown call request made viaTelecomManager.addNewUnknownCall(android.telecom.PhoneAccountHandle, android.os.Bundle). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidaddNewIncomingCall(PhoneAccountHandle phoneAccount, Bundle extras) voidaddNewUnknownCall(PhoneAccountHandle phoneAccount, Bundle extras) protected voidvoidDeprecated.voidclearAccountsForPackage(String packageName) protected Intentprotected IntentReturns the intent set bysetManageBlockNumbersIntent(Intent)()}voidvoidvoidenablePhoneAccount(PhoneAccountHandle handle, boolean isEnabled) booleanendCall()protected UrigetAdnUriForPhoneAccount(PhoneAccountHandle accountHandle) intprotected List<PhoneAccountHandle>getCallCapablePhoneAccounts(boolean includeDisabledAccounts) intintprotected Stringprotected PhoneAccountHandlegetDefaultOutgoingPhoneAccount(String uriScheme) Returns default outgoing phone account set throughsetDefaultOutgoingPhoneAccount(String, PhoneAccountHandle)for correspondinguriScheme.Deprecated.protected StringgetLine1Number(PhoneAccountHandle accountHandle) protected PhoneAccountgetPhoneAccount(PhoneAccountHandle account) getPhoneAccountsSupportingScheme(String uriScheme) protected PhoneAccountHandlegetSimCallManager(int userId) protected Stringprotected StringgetVoiceMailNumber(PhoneAccountHandle accountHandle) protected booleanprotected booleanhandleMmi(String dialString, PhoneAccountHandle accountHandle) protected booleanisInCall()Overrides behavior ofTelecomManager.isInCall()to return pre-set result.protected booleanOverrides behavior ofTelecomManager.isInEmergencyCall()to return pre-set result.protected booleanisOutgoingCallPermitted(PhoneAccountHandle phoneAccountHandle) booleanprotected booleanprotected booleanisVoiceMailNumber(PhoneAccountHandle accountHandle, String number) newCallAudioState(boolean muted, int route, int supportedRouteMask, BluetoothDevice activeBluetoothDevice, Collection<BluetoothDevice> supportedBluetoothDevices) Creates a newCallAudioState.protected voidprotected voidregisterPhoneAccount(PhoneAccount account) voidremoveDefaultOutgoingPhoneAccount(String uriScheme) Remove default outgoing phone account for correspondinguriScheme.voidsetCallPhonePermission(boolean callPhonePermission) When set to false methods requiringandroid.Manifest.permission.CALL_PHONEpermission will throw aSecurityException.voidsetCallRequestMode(ShadowTelecomManager.CallRequestMode callRequestMode) voidsetConnectionService(ConnectionService service) Set connection service.booleansetDefaultDialer(String packageName) Deprecated.API deprecated since Q, for testing, use setDefaultDialerPackage insteadvoidsetDefaultDialerPackage(String packageName) Set returned value ofgetDefaultDialerPackage().voidsetDefaultOutgoingPhoneAccount(String uriScheme, PhoneAccountHandle handle) Set default outgoing phone account to be returned fromgetDefaultOutgoingPhoneAccount(String)for correspondinguriScheme.voidsetHandleMmiValue(boolean handleMmiValue) voidsetIsInCall(boolean isInCall) Sets the return value forTelecomManager.isInCall().voidsetIsInEmergencyCall(boolean isInEmergencyCall) Sets the return value forTelecomManager.isInEmergencyCall()andTelecomManager.isInCall().voidsetIsOutgoingCallPermitted(boolean isOutgoingCallPermitted) Sets the result ofTelecomManager.isOutgoingCallPermitted(PhoneAccountHandle).voidsetLine1Number(PhoneAccountHandle accountHandle, String number) voidsetManageBlockNumbersIntent(Intent intent) Sets the BlockNumbersIntent to be returned bycreateManageBlockedNumbersIntent()voidsetReadPhoneStatePermission(boolean readPhoneStatePermission) When set to false methods requiringandroid.Manifest.permission.READ_PHONE_STATEpermission will throw aSecurityException.voidsetSimCallManager(PhoneAccountHandle simCallManager) voidsetSystemDialerPackage(String packageName) Set returned value ofgetSystemDialerPackage().voidsetTtySupported(boolean isSupported) Sets the value to be returned byisTtySupported().voidsetUserSelectedOutgoingPhoneAccount(PhoneAccountHandle accountHandle) voidsetVoicemailNumber(PhoneAccountHandle accountHandle, String number) protected voidshowInCallScreen(boolean showDialpad) protected voidprotected voidunregisterPhoneAccount(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.IncomingCallRecordcreated viaTelecomManager.addNewIncomingCall(android.telecom.PhoneAccountHandle, android.os.Bundle).Specifically, this method sets up the relevant
ConnectionServiceand returns the result ofConnectionService.onCreateIncomingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest). -
denyIncomingCall
Denies anShadowTelecomManager.IncomingCallRecordcreated viaTelecomManager.addNewIncomingCall(android.telecom.PhoneAccountHandle, android.os.Bundle).Specifically, this method sets up the relevant
ConnectionServiceand callsConnectionService.onCreateIncomingConnectionFailed(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest). -
placeCall
-
getAllOutgoingCalls
-
getLastOutgoingCall
-
getOnlyOutgoingCall
-
allowOutgoingCall
Allows anShadowTelecomManager.OutgoingCallRecordcreated viaTelecomManager.placeCall(android.net.Uri, android.os.Bundle).Specifically, this method sets up the relevant
ConnectionServiceand returns the result ofConnectionService.onCreateOutgoingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest). -
denyOutgoingCall
Denies anShadowTelecomManager.OutgoingCallRecordcreated viaTelecomManager.placeCall(android.net.Uri, android.os.Bundle).Specifically, this method sets up the relevant
ConnectionServiceand 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 ofCallAudioStateis 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_STATEpermission 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_PHONEpermission will throw aSecurityException. By default it's set to true for backwards compatibility.
-
ShadowTelecomManager.IncomingCallRecordorShadowTelecomManager.UnknownCallRecordinstead.