2025년 3월 27일부터 AOSP를 빌드하고 기여하려면 aosp-main
대신 android-latest-release
를 사용하는 것이 좋습니다. 자세한 내용은 AOSP 변경사항을 참고하세요.
WindowManager
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
WindowManager 덤프는 특정 시점의 WindowManager 스냅샷을 제공합니다. WindowManager 트레이스는 창이 화면에 표시되는 이유, 구성, 활동, 작업, 디스플레이 또는 WindowManager 계층 구조의 다른 요소에 관한 유용한 정보를 제공하는 상태의 연대순 시퀀스를 갖습니다. 이 정보는 앱이 표시되지 않는 이유 또는 앱 간에 전환하는 동안 깜박임이 발생함과 같은 문제를 해결하는 데 유용합니다.
Winscope의 WindowManager 뷰어는 트레이스와 덤프 모두에 이 정보를 표시합니다.
trace 수집에 관한 자세한 내용은 WindowManager를 참고하세요.
그림 1. WindowManager 트레이스 분석
화면 왼쪽에는 창의 3D 뷰가 표시됩니다. 직사각형 뷰는 창 경계, z 순서, 불투명도를 고려합니다.
탭의 중앙 세그먼트에는 창 계층 구조가 표시됩니다. 이 뷰에는 창, 활동, 작업 간의 상위-하위 관계 외에도 다음 정보가 포함됩니다.
화면 오른쪽에는 사용 가능한 모든 속성의 프로토 덤프가 표시됩니다. proto 덤프 섹션의 기능에 관한 자세한 내용은 속성을 참고하세요.
@IntDef 번역
@IntDef
변환은 WindowManager 속성 패널의 핵심 속성입니다.
@IntDef
은 주석이 달린 정수 유형의 요소가 논리적 유형을 나타내며 값이 명시적으로 이름이 지정된 상수 중 하나여야 함을 나타냅니다.
@IntDef
는 메모리 및 성능 영향을 완화하기 위해 enum 대신 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
인스턴스를 사람이 읽을 수 있는 형식으로 디코딩합니다. 예를 들어 2
의 activityType
가 있는 활동은 ACTIVITY_TYPE_HOME
의 activityType
로 변환됩니다. 마찬가지로 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 매핑 업데이트의 단계에 따라 Winscope에서 알고 있는 @IntDef
인스턴스 목록을 업데이트합니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[[["이해하기 쉬움","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(UTC)"],[],[],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."]]