DebugTelecomFacade

class DebugTelecomFacade(context: Context)

Helper class to simulate incoming and outgoing calls. It is also able to change current call's state. Simulated calls can be created after registering a debug phone account in the system.

Note that the helper classes (DebugConnectionServiceHolder, DebugConnectionService, DebugTelecomHelperEvents) have to be part of com.tomtom.ivi.platform.telecom.api.common.debug package. Otherwise a SecurityException is thrown due to this restriction when registering the phone account: https://developer.android.com/reference/kotlin/android/telecom/TelecomManager#registerphoneaccount

Also the package name has to be part of the same app UID, otherwise the SecurityException is raised: SecurityException: Package com.example.mydigitalcockpitapp.integration.test.product does not belong to 10171 (UID of com.example.mydigitalcockpitapp).

So those helpers cannot be moved as part of the tooling package and the testing app. Also this will be used by the Telecom Debug panel, and it makes sens to keep this part of the com.tomtom.ivi.platform.telecom.api.common.debug package.

Constructors

Link copied to clipboard
fun DebugTelecomFacade(context: Context)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun applyCallState(    phoneNumber: String,     callState: CallState,     disconnectCause: DisconnectCause?)

Updates a call state.

Link copied to clipboard
fun createIncomingCall(phoneNumber: String)

Creates an incoming call using the debugPhoneAccount.

Link copied to clipboard
fun createOutgoingCall(phoneNumber: String)

Creates an outgoing call using the debugPhoneAccount.

Link copied to clipboard
fun getCallState(phoneNumber: String): CallState?

Returns a call state for the given phoneNumber. If the call is disconnected, it can be already destroyed and null can be returned.

Link copied to clipboard
fun isDebugConnectionServiceReady(): Boolean

Checks if the connection service is ready.

Returns true if the debugPhoneAccount is registered in the system else return false. Require Manifest.permission.READ_PHONE_STATE.

Link copied to clipboard
fun registerDebugPhoneAccount(): Boolean

Registers the debug phone account in the system. Needed before calling createIncomingCall or createOutgoingCall.

Link copied to clipboard
suspend fun unregisterDebugPhoneAccount(): Boolean

Unregisters the debug phone account from the system. The recent calls related to the debug phone account will be deleted as well.