اعتبارًا من 27 آذار (مارس) 2025، ننصحك باستخدام android-latest-release
بدلاً من aosp-main
لإنشاء AOSP والمساهمة فيه. لمزيد من المعلومات، يُرجى الاطّلاع على التغييرات في AOSP.
توفُّر محرِّر أسلوب الإدخال
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
في ما يلي التعديلات التي تم إجراؤها على هذه المناطق الخاصة بالشاشة:
يتيح نظام التشغيل Android 10 استخدام
لوحة المفاتيح البرمجية
للتطبيقات التي تعمل على شاشة غير تلقائية.
التطبيقات التي تعمل على شاشة غير تلقائية
هناك أوضاع مختلفة لشاشة عرض لوحة المفاتيح البرمجية في "أداة تعديل طريقة الإدخال" (IME). تظهر لوحة المفاتيح على الشاشة في:
- الشاشة نفسها التي يظهر عليها التطبيق المُركّز عليه
- شاشة العرض التلقائية عندما يكون التطبيق المُركّز عليه قيد التشغيل على شاشة عرض غير تلقائية
- لا يتم عرض أي محتوى.
يحدّد النظام الوضع الذي سيتم استخدامه استنادًا إلى إعدادات الشاشة
التي يظهر عليها التطبيق الذي يتم التركيز عليه. لمزيد من التفاصيل، يُرجى الاطّلاع على:
WindowManager#setDisplayImePolicy()
WindowManager#getDisplayImePolicy()

الشكل 1: لوحة المفاتيح البرمجية لنظام IME كما تظهر على الشاشة الثانوية،
بما في ذلك التطبيق المستهدَف
يستخدم النظام معالجًا متعدّد اللغات واحدًا، ولكن يمكنه التبديل بين الشاشات لمتابعة
تركيز المستخدم. يتوقّع نظام التشغيل Android 10 تلقائيًا أن تراجع جميع تطبيقات IME التابعة للجهات الخارجية والتطبيقات المضمّنة في الجهاز
التنسيق وتغيّر حجمه وفقًا لحجم الشاشة الجديد عند إنشائه.
إذا كان هناك اتصال نشط على الشاشة "أ"، وطلب حقل إدخال
التركيز على الإدخال على الشاشة "ب"، يحدث المسار التالي:
- تأتي عملية ربط إدخال جديدة من حقل الإدخال على الشاشة "ب".
- يتحقق
InputMethodManagerService
مما إذا كان يجب
الموافقة على عملية الربط.
- يتم اختيار شاشة لنظام IME. إذا كان العرض "ب" يتيح عرض IME ويُسمح له بعرضه، يتم استخدام العرض "ب". بخلاف ذلك، يتم
اختيار شاشة الجهاز الأساسية.
- إذا لم تكن الشاشة المحدّدة من الشاشة "أ"، تتم إعادة تأسيس الربط. يتمّ إتلاف
InputMethodService
ثمّ إنشاؤه مرّة أخرى.
قيود الأمان
لن يعرض النظام IME على الشاشات الافتراضية التي لا يملكها
النظام. ويعود السبب في ذلك إلى مخاوف أمنية من أنّه يمكن لتطبيق ضار إنشاء سطح شاشة افتراضي مع تفعيل دعم زخارف النظام قراءة معلومات حساسة للمستخدم من الشاشة، مثل اقتراحات الكتابة
والخلفيات المخصّصة.
التنفيذ
في الإصدار 9 من نظام Android (والإصدارات الأقدم)، كان أسلوب إدخال النصوص متاحًا فقط على الشاشة التلقائية، كما هو описан في طرق
الإدخال على الشاشة. في Android 10 (والإصدارات الأحدث)، يمكن للمستخدم التبديل
بين حقول نص الإدخال المختلفة على شاشات مختلفة من خلال تبديل التركيز،
وتتم نقل نافذة IME إلى الشاشات الثانوية.
يتتبّع التنفيذ في WindowManager
نافذة أسلوب الإدخال (نافذة أسلوب الإدخال التي يتم فيها رسم لوحة المفاتيح المتوفّرة على الشاشة) وهدف أسلوب الإدخال (النافذة التي يتم فيها إدخال أسلوب الإدخال) لإدارة حالة أسلوب الإدخال.
بالنسبة إلى InputMethodManagerService
(IMMS)، لا يمكن لأي آلية مدمجة أخرى
نشر تغيير الشاشة إلى InputMethodService
(IMS) و
إعادة ضبط تنسيق لوحة المفاتيح أثناء التشغيل عند نقل التركيز إلى شاشة أخرى.
لتنفيذ عملية تبديل نافذة IME بين الشاشات، ينفِّذ نظام التشغيل Android
10 ما يلي:
- يتم الآن تتبُّع IME وإطار استهداف الإدخال لكل شاشة في
DisplayContent#mInputMethodWindow
و
DisplayContent#mInputMethodTarget
، حتى يتمكّن WindowManager (WM) من إدارة
حالة تركيز IME بشكل مستقل عن كل شاشة.
- من جانب IMMS، عند تلقّي طلب تركيز عميل التطبيق من الشاشة الخارجية
من خلال
ViewRootImpl#handleWindowFocusChanged ->
InputMethodManager#onPostWindowFocus ->
IMMS#startInputOrWindowGainedFocus
، يتم أولاً إلغاء ربط خدمة أسلوب الإدخال
الحالية ثم إعادة ربط الخدمة لإعادة إرفاق رمز علامة تبويب نافذة IME الجديد
للشاشة الخارجية في onServiceConnected()
.
- من جانب IMS، بعد استلام
IMS#attachToken
، يتم تنفيذ الخطوات التالية:
- يتمّ استدعاء
ContextImpl#updateDisplay
لتعديل عرض
سياق الخدمة في InputMethodService#attachToken()
. يؤدي ذلك إلى استدعاء
ViewGroup#addView()
لمراجعة تنسيق لوحة المفاتيح والتكيّف
مع الشاشة المستهدَفة من خلال التحقّق من السياق الحالي.
- بعد استدعاء
DisplayContent#setInputMethodWindowLocked()
،
يُرسِل التنفيذ تغييرات إعدادات العرض على مستوى العملية باستخدام
WindowProcessController
إلى عملية IME لإلغاء الموارد ومقاييس
العرض.
- يحصل برنامج
InputMethodService
على الإعداد الصحيح
مع مقاييس العرض الصحيحة بعد onConfigurationChanged()
و
طلب ViewGroup#addView()
لإعادة بدء عرض الإدخال.
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ 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,["# Input method editor support\n\nUpdates made to these display-specific areas are provided below:\n\n- [Apps running on a non-default display](/docs/core/display/multi_display/ime-support#non-default)\n- [Multi-session input method editor support](/docs/core/display/multi_display/ime-support#ime-multi)\n\nAndroid 10 supports\n[software keyboard](https://developer.android.com/guide/topics/text/creating-input-method)\nfor apps running on a non-default display.\n\nApps running on a non-default display\n-------------------------------------\n\nIn terms of which display shows the software keyboard of the Input Method Editor\n(IME), there are different modes. The software keyboard is shown on the:\n\n- *Same* display on which the focused app appears.\n- *Default* display while the focused app is running on a non-default display.\n- *No* display at all.\n\nThe system determines which mode to use based on the settings of the display\non which the focused app appears. For more details, see:\n\n- `WindowManager#setDisplayImePolicy()`\n- `WindowManager#getDisplayImePolicy()`\n\n**Figure 1.** IME software keyboard as it appears on secondary display,\nincluding target app\n\nThe system uses a single IME, but can shift between displays to follow\nuser focus. Android 10 automatically expects all first- and third-party IMEs to\nrevise the layout and resize according to the new display size when created.\n\nIf there's an active connection on display A, and an input field requests\ninput focus on display B, then the following flow occurs:\n\n1. A new input connection comes from the input field on display B.\n2. `InputMethodManagerService` checks if the connection should be approved.\n3. A display is selected for the IME. If display B supports showing the IME and is allowed to show it, then B is used. Otherwise, the primary device display is selected.\n4. If the selected display is not from display A, then the connection is re-established. `InputMethodService` is destroyed and then created again.\n\n### Security restriction\n\nThe system won't show an IME on virtual displays that aren't owned by the\nsystem. This is due to a security concern that a malicious app could create a\nvirtual display with enabled\n[system decorations support](/docs/core/display/multi_display/system-decorations)\nand read user-sensitive information from the surface, such as typing predictions\nand custom backgrounds.\n\n### Implementation\n\nIn Android 9 (and lower), the IME was only available on the default screen, as\ndescribed in [On-Screen\nInput methods](https://android-developers.googleblog.com/2009/04/updating-applications-for-on-screen.html). In Android 10 (and higher), a user can switch\nbetween different input text fields on different displays by switching focus,\nand the IME window moves to the secondary displays.\n\nThe implementation in `WindowManager` tracks the input method\nwindow (the IME window where the soft keyboard is drawn) and the input method\ntarget (the window where the IME input goes) to manage the IME state.\n\nFor `InputMethodManagerService` (IMMS), no other built-in mechanism can\npropagate the display change to `InputMethodService` (IMS) and\nreconfigure the keyboard layout at runtime when moving focus to another display.\n\nTo achieve the IME window switch between displays, Android\n10 implements the following:\n\n- The IME and input target window are now tracked per display in `DisplayContent#mInputMethodWindow` and `DisplayContent#mInputMethodTarget`, so that the WindowManager (WM) can manage the IME focus state independently of each display.\n- On the IMMS side, when an app client's focus request from the external display is received through `ViewRootImpl#handleWindowFocusChanged -\u003e\n InputMethodManager#onPostWindowFocus -\u003e\n IMMS#startInputOrWindowGainedFocus`, it first unbinds the current input method service and then rebinds the service to reattach the new IME window token for the external display in `onServiceConnected()`.\n- On the IMS side, after the `IMS#attachToken` is received, the following flow occurs:\n - `ContextImpl#updateDisplay` is called to update the service context's display in `InputMethodService#attachToken()`. This calls `ViewGroup#addView()` to revise the layout of the keyboard and adapt to the target display checking the current context.\n - After `DisplayContent#setInputMethodWindowLocked()` is called, the implementation sends process-level display configuration changes using the `WindowProcessController` to IME process to override resources and display metrics.\n - The `InputMethodService` client gets the correct configuration with the correct display metrics after `onConfigurationChanged()` and the `ViewGroup#addView()` call to reinitialize the input view."]]