自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
实现企业电话服务
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本页介绍了 Android 框架中支持企业用例的电话相关部分。本文档的适用对象为制造商,专门介绍与框架相关的电话方面的更改。此外,本页还简要介绍了 OEM 需要对负责处理电话相关功能的预加载应用做出哪些更改。
Android 7.0 引入了几项新功能来支持企业电话用例,具体包括:
- 跨资料联系人搜索功能 - 允许个人资料中的应用搜索由受管理资料联系人提供程序提供的联系人,联系人信息可存储在任何数据存储服务中,例如存储在设备本机或企业目录内。
- 跨资料联系人标记 - 将工作联系人与个人联系人明确区分开来。
- 使连接服务可感知受管理资料 - 受管理资料中的应用可藉此提供各种电话功能,例如提供单独的工作拨号器和工作连接服务
Android 5.0 支持以下企业电话功能:
示例和源代码
Android 开源项目 (AOSP) 在拨号器、通讯录和即时通讯应用的实现中集成了跨资料联系人搜索和标记功能。
示例:
- 为工作联系人添加标记:请参阅
packages/apps/ContactsCommon
f3eb5a207bfe0ff3b4ed2350ae5865ed8bc59798
- 跨资料搜索:请参阅
packages/apps/ContactsCommon
cd0b29ddbf3648e48f048196c62245d545bc6122
实现
设备实现人员必须在拨号器、通讯录和短信或彩信应用中实现联系人的跨资料使用、搜索、查询和标记功能。
跨资料联系人搜索应使用 Enterprise Contacts API(ContactsContract.Contacts.ENTERPRISE_CONTENT_FILTER_URI
等)来实现,该 API 可在 Android 开发者网站上的工作资料联系人指南中找到。
工作资料联系人标记可通过检查 ContactsContract.Directory.isEnterpriseDirectoryId()
(如果有)或 isEnterpriseContactId()
来实现。如需了解详情,请参阅工作资料联系人。
可感知受管理资料的 ConnectionService
制造商应该不需要修改框架代码即可支持此功能,但应该了解它对电信服务及其他电话功能的影响。
验证
跨资料联系人搜索和标记功能可通过以下方式验证:
- 使用 TestDPC 在测试设备上设置受管理资料。
- 启用跨资料联系人搜索。
- 在受管理资料中添加本机工作联系人。
- 在个人资料中的系统拨号器、通讯录和短信/彩信应用内搜索该联系人,确认该联系人可以找到并已正确标记。
添加了 CTS 测试,以确保在 com/android/cts/managedprofile/ContactsTest.java
中实现了底层跨资料联系人搜索 API。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Implement enterprise telephony\n\nThis page outlines the telephony-related parts of the Android framework that\nsupport enterprise use cases. This document is targeted at manufacturers and\nfocuses entirely on framework-related telephony changes. In addition, this\npage outlines the changes that OEMs need to make to their preloaded\napps that handle telephony-related functions.\n\n\nAndroid 7.0 introduced several new features to support enterprise telephony use\ncases, in particular:\n\n- Cross profile contact search - Allows apps in the personal profile to search for contacts that are supplied by the managed profile contacts provider, which can be backed by any datastore, for example local to the device or perhaps within an enterprise directory.\n- Cross profile contact badging - Allows work contacts to be clearly distinguished from personal contacts.\n- Making Connection Service managed profile aware - Allows apps within the Managed Profile to offer telephony features, such as to provide a separate work dialer and work ConnectionService\n\n\nAndroid 5.0 supported the following enterprise telephony feature:\n\n- Work contact name lookup for telephone numbers using [`ENTERPRISE_CONTENT_FILTER_URI`](https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookup#ENTERPRISE_CONTENT_FILTER_URI)\n\nExamples and source\n-------------------\n\n\nThe Android Open Source Project (AOSP) implementations of Dialer, Contacts, and\nMessaging apps have integrated the cross profile contact search and badging\ncapability.\n\nExamples:\n\n- **Adding badge to work contacts:** See `packages/apps/ContactsCommon` *f3eb5a207bfe0ff3b4ed2350ae5865ed8bc59798*\n- **Cross profile search:** See `packages/apps/ContactsCommon` *cd0b29ddbf3648e48f048196c62245d545bc6122*\n\nImplementation\n--------------\n\n\nDevice implementers must implement cross-profile, search, lookup and badging\nfor contacts in their Dialer Contacts and SMS or MMS messaging apps.\n\n### Cross-profile contact search\n\n\nCross profile contact search should be implemented using the Enterprise Contacts\nAPI (`ContactsContract.Contacts.ENTERPRISE_CONTENT_FILTER_URI` etc.), which can be found\nin the\n[Work\nprofile contacts](https://developer.android.com/work/contacts) guide on the Android Developers site.\n\n### Work profile contact badging\n\n\nWork profile contact badging can be implemented by checking\n`ContactsContract.Directory.isEnterpriseDirectoryId()` if available or\n[`isEnterpriseContactId()`](http://developer.android.com/reference/android/provider/ContactsContract.Contacts.html#isEnterpriseContactId(long)). To learn more, see\n[Work profile contacts](https://developer.android.com/work/contacts).\n\n### Managed Profile Aware\nConnectionService\n\n\nManufacturers should not need to modify the framework code to support this\nfunctionality, but should be aware of its impact on the Telecomm service and\nother telephony features.\n\nValidation\n----------\n\n\nThe cross profile contact search and badging feature can be validated by:\n\n1. Setting up a managed profile on a test device using [TestDPC](https://github.com/googlesamples/android-testdpc).\n2. Enabling cross profile contact search.\n3. Adding a local work contact within the managed profile.\n4. Searching for that contact within the system Dialer Contacts and SMS/MMS Messaging Apps within the personal profile, checking that this contact is found and it is correctly badged.\n\n\nCTS tests have been added to ensure the underlying cross profile contact search\nAPI has been implemented in\n`com/android/cts/managedprofile/ContactsTest.java`."]]