اعتبارًا من 27 آذار (مارس) 2025، ننصحك باستخدام android-latest-release
بدلاً من aosp-main
لإنشاء AOSP والمساهمة فيه. لمزيد من المعلومات، يُرجى الاطّلاع على التغييرات في AOSP.
WindowManager
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
توفّر WindowManager
dumps لقطة شاشة لـ WindowManager في وقت محدّد. تعرض عمليات تتبُّع WindowManager
تسلسلاً زمنيًا للحالات التي توفّر إحصاءات قيّمة
عن سبب ظهور نافذة على الشاشة أو إعداداتها أو إعدادات نشاطها
أو مهمتها أو عرضها أو أي عنصر آخر في التسلسل الهرمي لـ WindowManager. تكون هذه
المعلومات مفيدة لتحديد المشاكل وحلّها، مثل لماذا لا يظهر تطبيقي
أو حدث وميض أثناء التبديل بين التطبيقات.
يعرض عارض WindowManager في Winscope هذه المعلومات لكلّ من عمليات التتبّع
والتجميع.
اطّلِع على
WindowManager
لمزيد من المعلومات عن جمع عمليات التتبُّع.
الشكل 1: تحليل تتبُّع WindowManager
يعرض الجانب الأيمن من الشاشة عرضًا ثلاثي الأبعاد للنوافذ. تأخذ طريقة عرض المستطيلات
في الاعتبار حدود النافذة وترتيب z ودرجة التعتيم.
يعرض الجزء المركزي من علامة التبويب التسلسل الهرمي للنافذة. بالإضافة إلى روابط التبعية بين النوافذ والأنشطة والمهام، يتضمّن هذا العرض أيضًا المعلومات التالية:
- V: لتحديد النوافذ المرئية
يعرض الجانب الأيمن من الشاشة تجميعًا لبيانات proto لجميع
الخصائص المتاحة. لمزيد من المعلومات عن ميزات قسم "تجميع بيانات proto"،
اطّلِع على الخصائص.
ترجمة @IntDef
@IntDef
الترجمة هي خاصية رئيسية في لوحة خصائص WindowManager.
يشير الرمز @IntDef
إلى أنّ العنصر الذي تمّت التعليق عليه من النوع الصحيح يمثّل نوعًا
منطقيًا وأنّ قيمته يجب أن تكون إحدى الثوابت المُسمّاة صراحةً.
يتم استخدام @IntDef
ضمن قاعدة بيانات Android بدلاً من القوائم المحددة للتخفيف من أثر
الذاكرة والأداء.
في ما يلي مثال على استخدام @IntDef:
/**
* The modes to control how root task is moved to the front when calling {@link Task#reparent}.
*/
@Retention(RetentionPolicy.SOURCE)
@IntDef({
REPARENT_MOVE_ROOT_TASK_TO_FRONT,
REPARENT_KEEP_ROOT_TASK_AT_FRONT,
REPARENT_LEAVE_ROOT_TASK_IN_PLACE
})
@interface ReparentMoveRootTaskMode {}
// Moves the root task to the front if it was not at the front
static final int REPARENT_MOVE_ROOT_TASK_TO_FRONT = 0;
// Only moves the root task to the front if it was focused or frontmost already
static final int REPARENT_KEEP_ROOT_TASK_AT_FRONT = 1;
// Do not move the root task as a part of reparenting
static final int REPARENT_LEAVE_ROOT_TASK_IN_PLACE = 2;
يتم تخزين العلامات على شكل أعداد صحيحة، بدلاً من استخدام
قيم قابلة للقراءة من قِبل البشر، والتي قد يكون من الصعب تفسيرها. تُحوِّل أداة Winscope
هذه العلامات إلى قيم قابلة للقراءة من قِبل الإنسان باستخدام تعريفات @IntDef
.
أثناء عمليات الترجمة، يجمع Winscope قاموسًا لقيم @IntDef
ويستخدم
هذه القائمة لفك ترميز نُسخ @IntDef
إلى تنسيق يمكن قراءته بالعين أثناء
وقت التشغيل. على سبيل المثال، يتم ترجمة نشاط يتضمن activityType
من 2
إلى
activityType
من ACTIVITY_TYPE_HOME
. وبالمثل، يتم ترجمة نافذة تحتوي على
flags=2173763840
في Winscope على النحو التالي:
flags=FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS | FLAG_HARDWARE_ACCELERATED |
FLAG_SPLIT_TOUCH | FLAG_SHOW_WALLPAPER | FLAG_LAYOUT_INSET_DECOR |
FLAG_LAYOUT_IN_SCREEN
إذا لم يترجم Winscope مثيل @IntDef
بشكل صحيح،
اتّبِع الخطوات الواردة في تعديل تعيين @IntDef
لتعديل قائمة مثيلات @IntDef
المعروفة لدى Winscope.
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ 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,["# WindowManager\n\n[WindowManager](/docs/core/graphics/surfaceflinger-windowmanager#windowmanager)\ndumps provide a snapshot of WindowManager at a specific time. WindowManager\ntraces feature a chronological sequence of states that provide valuable insights\ninto why a window appears on screen, its configuration, or that of its activity,\ntask, display or of any other element in the WindowManager hierarchy. This\ninformation is useful for troubleshooting issues like *why isn't my app\nvisible* or *I experienced flickering while changing between apps*.\n\nWinscope's WindowManager viewer displays this information for both traces\nand dumps.\n\nSee\n[WindowManager](/docs/core/graphics/winscope/capture/adb#capture-adb-wm)\nfor more information about trace collection.\n\n**Figure 1.** WindowManager trace analysis.\n\nThe left side of the screen features a 3D view of the windows. The rects view\nconsiders window bounds, z-order, and opacity.\n\nThe tab's central segment shows the window hierarchy. In addition to the\nparent-child relationships between windows, activities, and tasks, this view\nalso includes the following information:\n\n- **V:** Identifies visible windows.\n\nThe right side of the screen features a **proto dump** of all available\nproperties. For more information about the features of the proto dump section\nsee [Properties](/docs/core/graphics/winscope/analyze/overview#analyze-properties).\n\n@IntDef translation\n-------------------\n\n`@IntDef` translation is a key property of the WindowManager properties panel.\n`@IntDef` denotes that the annotated element of integer type represents a\nlogical type and that its value must be one of the explicitly named constants.\n`@IntDef` is used within the Android codebase instead of enums for mitigating\nmemory and performance impact.\n\nThe following is an example of @IntDef usage: \n\n /**\n * The modes to control how root task is moved to the front when calling {@link Task#reparent}.\n */\n @Retention(RetentionPolicy.SOURCE)\n @IntDef({\n REPARENT_MOVE_ROOT_TASK_TO_FRONT,\n REPARENT_KEEP_ROOT_TASK_AT_FRONT,\n REPARENT_LEAVE_ROOT_TASK_IN_PLACE\n })\n @interface ReparentMoveRootTaskMode {}\n\n // Moves the root task to the front if it was not at the front\n static final int REPARENT_MOVE_ROOT_TASK_TO_FRONT = 0;\n // Only moves the root task to the front if it was focused or frontmost already\n static final int REPARENT_KEEP_ROOT_TASK_AT_FRONT = 1;\n // Do not move the root task as a part of reparenting\n static final int REPARENT_LEAVE_ROOT_TASK_IN_PLACE = 2;\n\nFlags are stored as *integers* , instead of using\nhuman-readable values, which can be challenging to interpret. Winscope\ntranslates these flags into human-readable values using `@IntDef` definitions.\nDuring compilations, Winscope collects a dictionary of `@IntDef` values and uses\nthis list to decode `@IntDef` instances into a human-readable format at\nruntime. For example, an activity with `activityType` of `2` is translated into\n`activityType` of `ACTIVITY_TYPE_HOME`. Similarly, a window with\n`flags=2173763840` is translated in Winscope as:\n\n`flags=FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS | FLAG_HARDWARE_ACCELERATED |\nFLAG_SPLIT_TOUCH | FLAG_SHOW_WALLPAPER | FLAG_LAYOUT_INSET_DECOR |\nFLAG_LAYOUT_IN_SCREEN`\n\nIf Winscope doesn't translate an `@IntDef` instance correctly,\nfollow the steps in [Update @IntDef mapping](/docs/core/graphics/winscope/run#update-intdef)\nto update the list of `@IntDef` instances known by Winscope."]]