自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
实现实时信息
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本页介绍如何在 Android 9 中实现实时信息 (RTT)。RTT 这项功能面向失聪用户或听障用户提供,可替代电传打字机 (TTY) 技术。借助此功能,设备可以使用同一电话号码进行语音通话和 RTT 通话,即时传输信息(信息是逐个字符输入的),支持拨打 911,并且向后兼容 TTY。
在 RTT 通话中,来电者和接听者均能知晓自己正在进行 RTT 通话。建立连接后,双方都会进入 RTT 通话,此时信息输入和键盘将启用。信息在输入时将会显示,同时逐个字符发送。
示例和源代码
AOSP 的 Call.RttCall 和 Connection.RttTextStream 中提供了框架组件。IMS/调制解调器组件是专有的,应由 IMS/调制解调器供应商提供。您还可以使用拨号器 RTT 的参考实现。
RTT 的 AOSP 拨号器代码:
实现
要实现 RTT,您应该与调制解调器/SoC 提供商合作,因为您需要用到支持 RTT 的调制解调器。您可以升级到 Android 9,也可以将一系列电话框架补丁程序向后移植到 Android 8.0 中。在 Android 8.0 AOSP 中添加 API 将不起作用。
此功能使用 AOSP 的 android.telecom
中的公共 API,以及 android.telephony.ims
中带 @SystemApis 标记的公共 API。所有界面都位于 com.android.phone
和 AOSP 拨号器中。
如需实现 RTT,请导入 AOSP 代码,并提供为 RTT 实现 IMS 端 @SystemApis 的 IMS 堆栈。这需要:
自定义
您可以启用或停用此功能,方法是使用 packages/services/Telephony
的设备配置覆盖中的设备配置 config_support_rtt
,以及运营商配置文件中的运营商配置标记 CarrierConfigManager.RTT_SUPPORTED_BOOL
。根据配置,该功能可通过“无障碍功能”设置提供,也可以不通过该设置提供。您可以使用设备配置来更改默认设置。默认情况下,该功能设置为关闭。
验证
要验证 RTT 实现,请运行 CTS 测试,并执行拨号器 RTT 测试。
CTS 测试
CTS 测试 (android.cts.telecom.RttOperationsTest
) 涵盖了实现的 AOSP 部分。对于实现的 IMS 堆栈部分,您必须提供自己的测试。
拨号器 RTT 测试
场景说明 |
界面模拟 |
如果设备停用 RTT,则会显示一条有关 RTT 的对话框。 |

|
在拨号器设置中,在“设置”>“无障碍功能”下有一个“实时信息”屏幕,其中提供了选择其他 RTT 模式的选项。 |

|
默认情况下 RTT 处于启用状态时:
- 在拨打电话时,系统显示标准的通话中拨号界面。
- 建立通话连接后,系统显示 RTT 模式视图。如果接听用户未默认进入 RTT 模式,则在用户等待响应时,系统将显示一条表明已请求 RTT 模式的横幅。
|

|
如果设备停用了 RTT:
|

|
如果设备上启用了 RTT 并且 RTT 默认设置为以 RTT 形式接听所有通话:
- 来电屏幕显示 RTT 接听器和相关联的通话标签页。
- 如果用户接听电话,则系统会加载 RTT 模式视图,同时启用键盘。
|

|
RTT 的通话中界面提供了多个选项,以允许用户控制语音通话的状态以及获得 RTT 用法方面的一般性帮助:
- 开启和关闭麦克风。
- 开启和关闭扬声器。
- 使用拨号键盘输入。
- 添加其他通话。
- 从 RTT 通话切换到语音通话。
- 开启和关闭保持通话功能。
|

|
在“通话详情”屏幕中,选择“查看转录内容”链接可显示包含 RTT 会话全文的完整对话视图。系统将显示时间戳。用户可以使用“返回”按钮返回“通话详情”屏幕。 |

|
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-27。
[null,null,["最后更新时间 (UTC):2025-03-27。"],[],[],null,["# Implement real-time text\n\nThis page describes how to implement real-time text (RTT) in Android\n9. RTT is a feature for deaf or hard of hearing users\nthat replaces teletypewriter (TTY) technology. With this feature, devices can\nuse the same phone number for voice and RTT calls, simultaneously transmit text\nas it is being typed on a character-by-character basis, support 911\ncommunications, and provide backward capability with TTY.\n\nIn an RTT call, both the caller and receiver have indications that they are in\nan RTT call. When connected, both sides enter the RTT call where the text input\nand keyboard is activated. When typing, the text appears and is sent as it is\ntyped, character by character.\n\nExamples and source\n-------------------\n\nFramework components are available in AOSP at\n[Call.RttCall](https://developer.android.com/reference/android/telecom/Call.RttCall)\nand\n[Connection.RttTextStream](https://developer.android.com/reference/android/telecom/Connection.RttTextStream).\nIMS/modem components are proprietary and should be supplied by the IMS/modem\nvendor. Dialer RTT reference implementation is also available.\n\nAOSP Dialer code for RTT:\n\n- InCall: [/java/com/android/incallui/rtt](https://android.googlesource.com/platform/packages/apps/Dialer/+/android16-release/java/com/android/incallui/rtt)\n- Call log: [/java/com/android/dialer/rtt](https://android.googlesource.com/platform/packages/apps/Dialer/+/android16-release/java/com/android/dialer/rtt)\n\nImplementation\n--------------\n\nTo implement RTT, you should work with a modem/SoC provider because a modem that\nsupports RTT is required. You can upgrade to Android\n9 or backport a list of telephony framework patches\ninto Android 8.0. APIs added in Android 8.0 AOSP will not work.\n\nThis feature uses public APIs in AOSP in `android.telecom` and @SystemApis in\n`android.telephony.ims`. All UI lies within `com.android.phone` and the AOSP\ndialer.\n\nTo implement RTT, import the AOSP code and supply an IMS stack that implements\nthe IMS-side @SystemApis for RTT. This requires:\n\n- Turning RTT on/off using `ImsConfig#setProvisionedValue(RTT_SETTING_ENABLED)`\n- Indicating RTT status of a call using `ImsStreamMediaProfile#mRttMode`\n- Support for the following methods in `ImsCallSession`:\n\n - `sendRttMessage`\n - `sendRttModifyRequest`\n - `sendRttModifyResponse`\n- Support for calling the following methods in `ImsCallSessionListener`:\n\n - `callSessionRttModifyRequestReceived`\n - `callSessionRttModifyResponseReceived`\n - `callSessionRttMessageReceived`\n\nCustomization\n-------------\n\nYou can enable or disable this feature using the device config,\n`config_support_rtt`, in the device config overlay for\n`packages/services/Telephony`, and the carrier config flag,\n`CarrierConfigManager.RTT_SUPPORTED_BOOL`, in the carrier config files.\nDepending on the configuration, the feature is either available through the\nAccessibility settings or not. Use the device config to change the default\nsettings. By default, the feature is set to Off.\n\nValidation\n----------\n\nTo validate your implementation of RTT, run CTS tests, and perform dialer RTT\ntesting.\n\n### CTS testing\n\nThe CTS tests (`android.cts.telecom.RttOperationsTest`) cover the AOSP portion\nof the implementation. You must provide your own tests for the IMS stack portion\nof the implementation.\n\n### Dialer RTT testing\n\n| **Scenario description** | **UI mock** |\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|\n| If RTT is disabled on the device, a dialog about RTT is displayed. | |\n| In Dialer settings, a Real-Time Text screen is available under **Settings \\\u003e Accessibility** that provides an option to choose a different RTT mode. | |\n| When RTT is enabled by default: - While the call is placed, the standard in-call dialing UI is displayed. - Upon call connection, the RTT mode view is displayed. If the receiving user doesn't default into RTT mode, a banner indicating that RTT mode has been requested is displayed while waiting for a response. | |\n| If RTT is disabled on the device: - Incoming call screen displays standard answering puck and standard call labels. | |\n| If RTT is enabled on the device and has the default set to answer all calls as RTT: - Incoming call screen displays RTT puck and associated call labels. - Answering the call loads the RTT mode view with keyboard enabled. | |\n| In the in-call UI for RTT, options are provided to allow users to control the state of the voice call and get general help on using RTT: - Toggle microphone on and off. - Toggle speaker on and off. - Use keypad as an input. - Add another call. - Switch to a voice call from an RTT call. - Toggle hold on and off. | |\n| In the Call details screen, selecting the See transcript link displays a full conversation view with the full text of the RTT session. Timestamps are displayed. The user can return to the Call details screen using the back button. | |"]]