اعتبارًا من 27 آذار (مارس) 2025، ننصحك باستخدام android-latest-release
بدلاً من aosp-main
لإنشاء AOSP والمساهمة فيه. لمزيد من المعلومات، يُرجى الاطّلاع على التغييرات في AOSP.
اقتراح حساب على الهاتف
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
في Android 10، تسمح خدمة اقتراحات حسابات الهاتف
بعرض اقتراحات لحسابات
الهاتف للمستخدمين عند إجراء مكالمة. على سبيل المثال، بالنسبة إلى المستخدمين الذين لديهم
جهاز مزوّد بشرائح SIM متعددة ومعدّلات أقل للمكالمات داخل الشبكة، تحدد هذه
الخدمة أولاً مشغّل شبكة المتصل ثم تقترح استخدام شريحة SIM على
الشبكة نفسها التي يستخدمها المتصل.
خدمة اقتراح حسابات الهاتف اختيارية ويمكن تنفيذها على
الأجهزة التي تعمل بنظام التشغيل Android 10 أو إصدار أحدث.
التنفيذ
لتنفيذ اقتراحات حسابات الهواتف، نفِّذ خدمة واحدة
PhoneAccountSuggestionService
في تطبيق يقع في /system/priv-app/
. لا تتم معالجة طلب البحث في الخدمة إذا تم تنفيذ أكثر من PhoneAccountSuggestionService
واحدة. يجب أن تذكر
الخدمة إذن
android.Manifest.permission.BIND_PHONE_ACCOUNT_SUGGESTION_SERVICE
.
عندما يجري مستخدم مكالمة خارجية بدون ضبط
حساب الهاتف التلقائي للمكالمات الصادرة
أو
حساب الهاتف المفضّل
للمُتصل به، ترتبط خدمة الاتصالات السلكية واللاسلكية بملف تعريف العميل
PhoneAccountSuggestionService
لجمع معلومات عن الحسابات، ويتم استدعاء
onAccountSuggestionRequest(String number)
، ويتم تعليق عملية المكالمة الصادرة.
على "PhoneAccountSuggestionService
" الاتصال برقم العميل التالي:
suggestPhoneAccounts(String number, List<PhoneAccountSuggestion> suggestions)
الذي تم إرجاعه من العميل التالي:
onAccountSuggestionRequest(String number)
.
عند استدعاء
suggestPhoneAccounts(String number, List<PhoneAccountSuggestion> suggestions)
، تعرض خدمة الاتصالات قائمة بحسابات الهاتف المقترَحة. يجب أن يعرض
أداة الاتصال بعد ذلك قائمة حسابات الهاتف المقترَحة للمستخدمين لتحديد حساب من أجل إجراء المكالمة.
PhoneAccountSuggestion
لتقديم اقتراحات، استخدِم فئة
PhoneAccountSuggestion.
على سبيل المثال، إذا حدّدت الخدمة أنّ المُتصل به يستخدم مشغّل شبكة الجوّال نفسه الذي يستخدمه أحد
شرائح SIM في الجهاز، يجب أن تضع الخدمة علامة على حساب الهاتف باستخدام
REASON_INTRA_CARRIER
.
ويمكن بعد ذلك إرسال هذه المعلومات إلى المستخدم في تطبيق الاتصال.
على سبيل المثال، في حال ضبط المستخدم للجهاز لاستخدام
شريحة SIM للعمل مع جميع جهات الاتصال
في حساب Google للعمل، يجب أن تضع الخدمة علامة على حساب الهاتف باستخدام
REASON_USER_SET
وتضبط
shouldAutoSelect
على true للسماح لتطبيق الاتصال بتجاوز مربّع الحوار للاختيار وتلقائيًا
إجراء المكالمة باستخدام حساب الهاتف.
للحصول على معلومات عن الاقتراحات الأخرى، يُرجى الاطّلاع على
PhoneAccountSuggestion
.
Dialer
عندما تدخل المكالمة في حالة
STATE_SELECT_PHONE_ACCOUNT
، يجب أن يستخدم تطبيق الاتصال المعلومات الواردة من
PhoneAccountSuggestion
للتعامل مع
EXTRA_SUGGESTED_PHONE_ACCOUNTS
.
إيقاف الخدمة
لتخصيص عملية التنفيذ لمشغّلي شبكات الجوّال المحدّدين، يمكنك تفعيل الخدمة أو
إيقافها باستخدام
setComponentEnabledSetting
.
لا يتم طلب الخدمة إذا كانت غير مفعّلة.
تنفيذ واجهة مستخدم النظام
قد تكون هناك حاجة إلى إجراء تغييرات على واجهة مستخدم النظام، وذلك استنادًا إلى عملية التنفيذ. على سبيل المثال، للسماح للمستخدمين بتحديد أنّ جميع المكالمات التي يتم إجراؤها إلى جهة اتصال معيّنة تتم من حساب هاتف معيّن، يجب تنفيذ عملية إعداد مخصّصة
وواجهة مستخدم مخصّصة للإعدادات على الجهاز.
التحقُّق
للتأكّد من صحة عملية التنفيذ، عليك إجراء اختبارات CTS التالية:
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-07-27 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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-07-27 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Phone account suggestion\n\nIn Android 10, the phone account suggestion service\nallows suggestions for phone\naccounts to be shown to users when making a call. For example, for users with a\ndevice with multiple SIMs and lower rates for intra-network calls, this\nservice first identifies the callee's carrier and then suggests using the SIM on\nthe same network as the callee.\n\nThe phone account suggestion service is optional and can be implemented on\ndevices running Android 10 or higher.\n\nImplementation\n--------------\n\nTo implement phone account suggestions, implement *one*\n[`PhoneAccountSuggestionService`](https://android.googlesource.com/platform/frameworks/base/+/android16-release/telecomm/java/android/telecom/PhoneAccountSuggestionService.java)\nservice in an app that is located in `/system/priv-app/`. The service isn't\nqueried if more than one `PhoneAccountSuggestionService`is implemented. The\nservice must declare the\n`android.Manifest.permission.BIND_PHONE_ACCOUNT_SUGGESTION_SERVICE` permission.\n\nWhen a user makes an outgoing call where neither the\n[default outgoing phone account](https://developer.android.com/reference/android/telecom/TelecomManager.html#getDefaultOutgoingPhoneAccount(java.lang.String))\nnor the\n[preferred phone account](https://developer.android.com/reference/android/provider/ContactsContract.DataColumns.html#PREFERRED_PHONE_ACCOUNT_COMPONENT_NAME)\nis set for the callee, the telecom service binds to\n`PhoneAccountSuggestionService` to gather information about the accounts,\n[`onAccountSuggestionRequest(String number)`](https://android.googlesource.com/platform/frameworks/base/+/android16-release/telecomm/java/android/telecom/PhoneAccountSuggestionService.java#98)\nis called, and the outgoing call process is suspended.\n\n`PhoneAccountSuggestionService` must call\n[`suggestPhoneAccounts(String number, List\u003cPhoneAccountSuggestion\u003e suggestions)`](https://android.googlesource.com/platform/frameworks/base/+/android16-release/telecomm/java/android/telecom/PhoneAccountSuggestionService.java#110)\nwith the number returned by\n[`onAccountSuggestionRequest(String number)`](https://android.googlesource.com/platform/frameworks/base/+/android16-release/telecomm/java/android/telecom/PhoneAccountSuggestionService.java#98).\n\nWhen\n[`suggestPhoneAccounts(String number, List\u003cPhoneAccountSuggestion\u003e suggestions)`](https://android.googlesource.com/platform/frameworks/base/+/android16-release/telecomm/java/android/telecom/PhoneAccountSuggestionService.java#110)\nis called, the telecom service returns a list of suggested phone accounts. The\ndialer must then display the list of suggested phone accounts for the user to\nchoose from to make the call.\n\n### PhoneAccountSuggestion\n\nTo make suggestions, use the\n[PhoneAccountSuggestion](https://android.googlesource.com/platform/frameworks/base/+/android16-release/telecomm/java/android/telecom/PhoneAccountSuggestion.java)\nclass.\nFor example, if the service determines the callee is on the same carrier as one\nof the SIMs in the device, the service should mark the phone account with\n[`REASON_INTRA_CARRIER`](https://android.googlesource.com/platform/frameworks/base/+/android16-release/telecomm/java/android/telecom/PhoneAccountSuggestion.java#46).\nThis information can then be conveyed to the user in the dialer.\n\nFor example, in a situation where the user has configured the device to use\na work SIM for all contacts\nin a work Google Account, the service should mark the phone account with\n[`REASON_USER_SET`](https://android.googlesource.com/platform/frameworks/base/+/android16-release/telecomm/java/android/telecom/PhoneAccountSuggestion.java#58)\nand set\n[`shouldAutoSelect`](https://android.googlesource.com/platform/frameworks/base/+/android16-release/telecomm/java/android/telecom/PhoneAccountSuggestion.java#121)\nto true to allow the dialer to bypass the selection dialog and automatically\nplace the call using the phone account.\n\nFor information on other suggestions, see\n[`PhoneAccountSuggestion`](https://android.googlesource.com/platform/frameworks/base/+/android16-release/telecomm/java/android/telecom/PhoneAccountSuggestion.java).\n\n### Dialer\n\nWhen the call enters the\n[`STATE_SELECT_PHONE_ACCOUNT`](https://android.googlesource.com/platform/frameworks/base/+/android16-release/telecomm/java/android/telecom/Call.java#84)\nstate, the dialer must use the information from\n[`PhoneAccountSuggestion`](https://android.googlesource.com/platform/frameworks/base/+/android16-release/telecomm/java/android/telecom/PhoneAccountSuggestion.java)\nto handle\n[`EXTRA_SUGGESTED_PHONE_ACCOUNTS`](https://android.googlesource.com/platform/frameworks/base/+/android16-release/telecomm/java/android/telecom/Call.java#136).\n\n### Disable the service\n\nTo customize your implementation for specific carriers, you can enable or\ndisable the service using\n[`setComponentEnabledSetting`](https://developer.android.com/reference/android/content/pm/PackageManager.html#setComponentEnabledSetting(android.content.ComponentName,%20int,%20int)%60).\nThe service is not queried if disabled.\n\n### System UI implementation\n\nDepending on your implementation, changes to the system UI may be required. For\nexample, to allow users to specify that all calls to a specific contact are\nmade from a specific phone account, you must implement a customized set up flow\nand settings UI for the device.\n\nValidation\n----------\n\nTo validate your implementation, run the following CTS tests:\n\n- [`/cts/tests/tests/telecom/src/android/telecom/cts/PhoneAccountSuggestionServiceTest.java`](https://android.googlesource.com/platform/cts/+/android16-release/tests/tests/telecom/src/android/telecom/cts/PhoneAccountSuggestionServiceTest.java)\n- [`/cts/tests/tests/telecom/src/android/telecom/cts/PhoneAccountSuggestionTest.java`](https://android.googlesource.com/platform/cts/+/android16-release/tests/tests/telecom/src/android/telecom/cts/PhoneAccountSuggestionTest.java)"]]