WindowManager dumps provide a snapshot of WindowManager at a specific time. WindowManager traces feature a chronological sequence of states that provide valuable insights into why a window appears on screen, its configuration, or that of its activity, task, display or of any other element in the WindowManager hierarchy. This information is useful for troubleshooting issues like why isn't my app visible or I experienced flickering while changing between apps.
Winscope's WindowManager viewer displays this information for both traces and dumps.
See WindowManager for more information about trace collection.
Figure 1. WindowManager trace analysis.
The left side of the screen features a 3D view of the windows. The rects view considers window bounds, z-order, and opacity.
The tab's central segment shows the window hierarchy. In addition to the parent-child relationships between windows, activities, and tasks, this view also includes the following information:
- V: Identifies visible windows.
The right side of the screen features a proto dump of all available properties. For more information about the features of the proto dump section see Properties.
@IntDef translation
@IntDef
translation is a key property of the WindowManager properties panel.
@IntDef
denotes that the annotated element of integer type represents a
logical type and that its value must be one of the explicitly named constants.
@IntDef
is used within the Android codebase instead of enums for mitigating
memory and performance impact.
The following is an example of @IntDef usage:
/**
* 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;
Flags are stored as integers, instead of using
human-readable values, which can be challenging to interpret. Winscope
translates these flags into human-readable values using @IntDef
definitions.
During compilations, Winscope collects a dictionary of @IntDef
values and uses
this list to decode @IntDef
instances into a human-readable format at
runtime. For example, an activity with activityType
of 2
is translated into
activityType
of ACTIVITY_TYPE_HOME
. Similarly, a window with
flags=2173763840
is translated in Winscope as:
flags=FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS | FLAG_HARDWARE_ACCELERATED |
FLAG_SPLIT_TOUCH | FLAG_SHOW_WALLPAPER | FLAG_LAYOUT_INSET_DECOR |
FLAG_LAYOUT_IN_SCREEN
If Winscope doesn't translate an @IntDef
instance correctly,
follow the steps in Update @IntDef mapping
to update the list of @IntDef
instances known by Winscope.