2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
ドメイン選択サービス
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Android 15 以降を搭載したデバイスでは、DomainSelectionService
システム API を使用して回路切り替えネットワークを介する IMS サービスと以前のサービス間のドメイン選択を実装できます。DomainSelectionService
は、Android プラットフォームとベンダーが提供するドメイン選択実装の間に介在する、明確に定義されたインターフェースです。このインターフェースにより、ベンダーの実装は信号情報(発信や SMS が発生するドメイン、ネットワーク スキャンでのネットワークの種類の設定など)をプラットフォームに提供します。
図 1. ドメイン選択機能のアーキテクチャ図
例とソース
Android には、TelephonyDomainSelectionService
に AOSP のドメイン選択機能向けのリファレンス実装が用意されています。DomainSelectionService
API の詳細については、DomainSelectionService
、およびこの API のその他のクラスをご覧ください。
実装
Android デバイスにドメイン選択機能を実装するために必要な手順は次のとおりです。
ドメイン選択アプリを作成します。AndroidManifest.xml
ファイルでサービスを定義する必要があります。
デバイス オーバーレイに設定を追加し、プラットフォームが DomainSelectionService
実装にバインドできるようにします。
ドメイン選択機能向けの必須のラジオ HAL インターフェースをサポートします。
次に、上記の手順を詳しく説明します。
AndroidManifest.xml にサービス エントリを追加する
ドメイン選択アプリが DomainSelectionService
サービスをフレームワークに登録できるよう、以下の形式でマニフェスト ファイルにサービス エントリを追加します。
<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>
AndroidManifest.xml
内のサービス定義では、ドメイン選択機能が動作するように以下の属性を定義する必要があります。
directBootAware="true"
: ユーザーがデバイスのロックを解除する前に、電話通信によってサービスが検出され、実行されるようにします。ユーザーがデバイスをロック解除するまで、サービスはデバイス暗号化ストレージにアクセスできません。詳細については、ダイレクト ブートモードのサポートとファイルベースの暗号化をご覧ください。
persistent="true"
: このサービスを永続的に実行し、メモリの再利用を目的にシステムによって停止されないようにします。この属性は、アプリがシステムアプリとしてビルドされている場合にのみ有効です。
permission="android.permission.BIND_DOMAIN_SELECTION_SERVICE"
: BIND_DOMAIN_SELECTION_SERVICE
権限を付与されたプロセスのみがアプリにバインドできるようにします。フレームワークからこの権限を付与できるのはシステムアプリのみであるため、不正なアプリがサービスにバインドされるのを防止できます。
サービスでは、android.telephony.DomainSelectionService
アクションを含む intent-filter
要素も指定する必要があります。これによって、フレームワークが DomainSelectionService
サービスを見つけられるようになります。
デバイス オーバーレイで設定を定義する
プラットフォームが DomainSelectionService
サービスに安全にバインドできるよう、デバイス オーバーレイに以下の設定を追加します。
Android はサードパーティのダウンロード可能な DomainSelectionService
を実装するアプリをサポートしていないため、ドメイン選択アプリは、/system_ext/priv-app/
または /product/priv-app/
フォルダにあるシステムアプリにする必要があります。フレームワークは、実装のパッケージ名がデバイス オーバーレイの値と一致するかどうかを確認し、信頼できるプリインストールされたアプリのみがバインドされるようにします。
ラジオ HAL インターフェースをサポートする
ドメイン選択機能を有効にするため、以下の必須のラジオ HAL インターフェースをサポートします。
IRadioNetwork
void setEmergencyMode(int serial, EmergencyMode emcModeType);
void triggerEmergencyNetworkScan(int serial,
EmergencyNetworkScanTrigger request);
void cancelEmergencyNetworkScan(int serial, boolean resetScan);
void exitEmergencyMode(int serial);
IRadioNetworkIndication
void emergencyNetworkScanResult(RadioIndicationType type,
EmergencyRegResult result);
検証
電話通信フレームワークが DomainSelectionService
インターフェースに適切に応答することをテストするため、DomainSelectionServiceTestOnMockModem
で CTS テストを実行します。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-03-25 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-03-25 UTC。"],[],[],null,["# Domain selection service\n\nFor devices running Android 15 or higher, you can\nimplement domain selection\nbetween the IMS service and legacy services over circuit switched networks using\nthe [`DomainSelectionService`](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/telephony/java/android/telephony/DomainSelectionService.java) system API. `DomainSelectionService`\nis a well-defined interface between the Android platform and a vendor provided\ndomain selection implementation. This interface lets the vendor implementation\nprovide signaling information, such as the domain that outgoing calls and SMS\nare placed and network type preference in network scanning, to the platform.\n\n**Figure 1.** Architecture diagram for the domain selection feature\n\nExamples and source\n-------------------\n\nAndroid provides a reference implementation for the domain selection feature in\nAOSP at [`TelephonyDomainSelectionService`](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/services/Telephony/src/com/android/services/telephony/domainselection/). For detailed\ndocumentation for the `DomainSelectionService` API, see\n[`DomainSelectionService`](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/telephony/java/android/telephony/DomainSelectionService.java) and the other classes in the API.\n\nImplementation\n--------------\n\nTo implement the domain selection feature on an Android device, the following\nsteps are required:\n\n1. Create a domain selection app. The service must be defined in the\n `AndroidManifest.xml` file.\n\n2. Add a configuration to the device overlay to let the platform bind to the\n `DomainSelectionService` implementation.\n\n3. Support the required radio HAL interfaces for the domain selection feature.\n\nThis section provides further details of these steps.\n\n### Add service entry in AndroidManifest.xml\n\nFor your domain selection app to register the `DomainSelectionService` service\nwith the framework, add a service entry in the manifest file using the following\nformat: \n\n \u003cservice\n android:name=\"com.example.domainselection.DomainSelectionService\"\n android:directBootAware=\"true\"\n android:persistent=\"true\"\n ...\n android:permission=\"android.permission.BIND_DOMAIN_SELECTION_SERVICE\"\n ...\n \u003cintent-filter\u003e\n \u003caction android:name=\"android.telephony.DomainSelectionService\"/\u003e\n \u003c/intent-filter\u003e\n ...\n \u003c/service\u003e\n\nThe service definition in `AndroidManifest.xml` must define the following\nattributes for the domain selection feature to operate.\n\n- `directBootAware=\"true\"`: Lets the service be discovered and run by\n telephony before the user unlocks the device. The service can't access\n *device-encrypted* storage before the user unlocks the device. For more\n information,\n see [Support Direct Boot mode](https://developer.android.com/privacy-and-security/direct-boot) and [File-Based Encryption](/docs/security/features/encryption/file-based).\n\n- `persistent=\"true\"`: Lets the service be run persistently and not be\n killed by the system to reclaim memory. This attribute works *only* if the\n app is built as a system app.\n\n- `permission=\"android.permission.BIND_DOMAIN_SELECTION_SERVICE\"`: Ensures\n that only a process that has the `BIND_DOMAIN_SELECTION_SERVICE` permission\n granted to it can bind to the app. This prevents a rogue app from binding to\n the service, because only system apps can be granted the permission by the\n framework.\n\nThe service must also specify the `intent-filter` element with the\n`android.telephony.DomainSelectionService` action. This lets the framework find\nthe `DomainSelectionService` service.\n\n### Define configuration in device overlay\n\nFor the platform to securely bind to the `DomainSelectionService` service, add\nthe following configuration to the device overlay:\n\n- [`config_domain_selection_service_component_name`](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/services/Telephony/res/values/config.xml?q=config_domain_selection_service_component_name): The component name (a flattened `ComponentName` string) for the `DomainSelectionService` service\n\nBecause Android doesn't support apps with third-party downloadable\n`DomainSelectionService` implementations, the domain selection app must be a\nsystem app that resides in the `/system_ext/priv-app/` or `/product/priv-app/`\nfolder. The framework verifies whether the package name of the implementation\nmatches the device overlay value to ensure only trusted, preinstalled apps are\nbound.\n\n### Support radio HAL interfaces\n\nTo enable the domain selection feature, support the following required radio HAL\ninterfaces:\n\n- [`IRadioNetwork`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl)\n\n void setEmergencyMode(int serial, EmergencyMode emcModeType);\n void triggerEmergencyNetworkScan(int serial,\n EmergencyNetworkScanTrigger request);\n void cancelEmergencyNetworkScan(int serial, boolean resetScan);\n void exitEmergencyMode(int serial);\n\n- [`IRadioNetworkIndication`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl)\n\n void emergencyNetworkScanResult(RadioIndicationType type,\n EmergencyRegResult result);\n\nValidation\n----------\n\nTo test that the telephony framework properly responds to the\n`DomainSelectionService` interface, run the CTS tests in\n[`DomainSelectionServiceTestOnMockModem`](https://cs.android.com/android/platform/superproject/+/android-latest-release:cts/tests/tests/telephony/current/src/android/telephony/cts/DomainSelectionServiceTestOnMockModem.java)."]]