For devices running Android 15 or higher, you can
implement domain selection
between the IMS service and legacy services over circuit switched networks using
the DomainSelectionService
system API. DomainSelectionService
is a well-defined interface between the Android platform and a vendor provided
domain selection implementation. This interface lets the vendor implementation
provide signaling information, such as the domain that outgoing calls and SMS
are placed and network type preference in network scanning, to the platform.
Figure 1. Architecture diagram for the domain selection feature
Examples and source
Android provides a reference implementation for the domain selection feature in
AOSP at TelephonyDomainSelectionService
. For detailed
documentation for the DomainSelectionService
API, see
DomainSelectionService
and the other classes in the API.
Implementation
To implement the domain selection feature on an Android device, the following steps are required:
Create a domain selection app. The service must be defined in the
AndroidManifest.xml
file.Add a configuration to the device overlay to let the platform bind to the
DomainSelectionService
implementation.Support the required radio HAL interfaces for the domain selection feature.
This section provides further details of these steps.
Add service entry in AndroidManifest.xml
For your domain selection app to register the DomainSelectionService
service
with the framework, add a service entry in the manifest file using the following
format:
<service
android:name="com.example.domainselection.DomainSelectionService"
android:directBootAware="true"
android:persistent="true"
…
android:permission="android.permission.BIND_DOMAIN_SELECTION_SERVICE"
…
<intent-filter>
<action android:name="android.telephony.DomainSelectionService"/>
</intent-filter>
…
</service>
The service definition in AndroidManifest.xml
must define the following
attributes for the domain selection feature to operate.
directBootAware="true"
: Lets the service be discovered and run by telephony before the user unlocks the device. The service can't access device-encrypted storage before the user unlocks the device. For more information, see Support Direct Boot mode and File-Based Encryption.persistent="true"
: Lets the service be run persistently and not be killed by the system to reclaim memory. This attribute works only if the app is built as a system app.permission="android.permission.BIND_DOMAIN_SELECTION_SERVICE"
: Ensures that only a process that has theBIND_DOMAIN_SELECTION_SERVICE
permission granted to it can bind to the app. This prevents a rogue app from binding to the service, because only system apps can be granted the permission by the framework.
The service must also specify the intent-filter
element with the
android.telephony.DomainSelectionService
action. This lets the framework find
the DomainSelectionService
service.
Define configuration in device overlay
For the platform to securely bind to the DomainSelectionService
service, add
the following configuration to the device overlay:
config_domain_selection_service_component_name
: The component name (a flattenedComponentName
string) for theDomainSelectionService
service
Because Android doesn't support apps with third-party downloadable
DomainSelectionService
implementations, the domain selection app must be a
system app that resides in the /system_ext/priv-app/
or /product/priv-app/
folder. The framework verifies whether the package name of the implementation
matches the device overlay value to ensure only trusted, preinstalled apps are
bound.
Support radio HAL interfaces
To enable the domain selection feature, support the following required radio HAL interfaces:
-
void setEmergencyMode(int serial, EmergencyMode emcModeType); void triggerEmergencyNetworkScan(int serial, EmergencyNetworkScanTrigger request); void cancelEmergencyNetworkScan(int serial, boolean resetScan); void exitEmergencyMode(int serial);
-
void emergencyNetworkScanResult(RadioIndicationType type, EmergencyRegResult result);
Validation
To test that the telephony framework properly responds to the
DomainSelectionService
interface, run the CTS tests in
DomainSelectionServiceTestOnMockModem
.