What is Android Server Telecom?
Android Server Telecom is the framework that manages calls on your device. It handles SIM-based calls and VOIP calls via the SIP or third-party VOIP Connection Service APIs.
It also manages audio focus and routing of calls. It does this by integrating with SIM-card modules and in-call service implementations.
Incall service
The incall service is an android server telecom component that manages calls and interactions between your phone and the InCallUI application. It handles SIM-based and VoIP calls, enables the phone to display video choices, and lets you check your call and text history.
The Telecom framework acts as a switchboard that routes calls from ConnectionService implementations to the calling user interfaces that InCallService implementations provide. This allows your app to create a replacement for the system Phone App, and integrate a calling solution into the Android calling experience.
When you implement both the InCallService and ConnectionService APIs, your application must not make any assumptions about the sources of calls it displays. It also must continue to work even if the default Phone App is not set to your custom InCallService.
To use the incall service, your app must fill RoleManager.ROLE_DIALER, and it must not make any changes at runtime that cause it to no longer fulfil the requirements of this role. It must also fully implement the InCallService API, and provide both an incoming call UI and an ongoing call UI.
Connection service
Android Server Telecom is a code library that connects your device to a carrier’s network. It establishes connections for calls, manages call logs, and records video profiles.
It supports SIM-based calling, VOIP calls via SIP, and third-party VOIP ConnectionServices. It also handles audio focus and routing.
This service can replace the default system Phone App by offering a user interface for calls. You can implement it by implementing the managed ConnectionService API or by a third-party implementation of SIP or VOIP calling services.
A self-managed ConnectionService must contain EXTRA_PHONE_ACCOUNT_HANDLE in the Bundle extra to specify the PhoneAccountHandle associated with it. It uses a registered PhoneAccount to place a phone or VoIP call.
It also provides a DisconnectCause module to check and fetch call-related information after the connection is established. This includes call logs, network error details, and other call-related data.
Audio focus
If your app is playing audio, it should know how to request and receive audio focus as well as respond appropriately to a loss of audio focus. This is a good practice for any media or game app with audio.
Before you start playback, make sure your app calls requestAudioFocus() with the AudioManager.AUDIOFOCUS_GAIN usage attribute and verify that your request is granted (AUDIOFOCUS_REQUEST_GRANTED). If you lose audio focus, call abandonAudioFocus() to signal to the system that your app should stop playing audio.
Android 12 (API level 31) and higher enforces a special rule when an app that has audio focus loses it: The audio system forces all the players of the first app to fade out. This fade-out provides a smoother transition between apps that are playing audio.
You can control how your app reacts to a loss of audio focus with an OnAudioFocusChangeListener and an onAudioFocusChange() callback method that implements the pause/resume behavior you want. This listener can also be used for delayable requests if you need to notify the current audio focus holders when you’re going to delay your request.
Telecom framework
Telecom framework is a code-related service on an Android device that establishes connections for calls and manages calls. It has multiple functions, including initiating & receiving calls, managing phone accounts, providing video profiles, and keeping call logs.
The telecom framework is designed to support both SIM-based and VOIP calls, as well as third party VOIP ConnectionService implementations. It acts like a switchboard, routing calls between ConnectionService implementations and displaying call logs and audio focus.
It also has a basic function DisconnectCause module to check and fetch call-related information after a call is disconnected. This includes network error, after-call logs, and more.
Telecom also supports InCallService implementations that provide user interfaces to calls being managed by telecom. In these instances, telecom requires that the in-call service API does not assume the nature of a call. Likewise, it must not implement calling restrictions that depend on the ConnectionService API, such as enforcement of telephony restrictions for video calls.
Visit also at Tech In Journal for more qaulity tech information.