[null,null,["最后更新时间 (UTC):2025-03-04。"],[],[],null,["# SurfaceFlinger\n\n[SurfaceFlinger](/docs/core/graphics/surfaceflinger-windowmanager#surfaceflinger)\ndumps provide a snapshot of SurfaceFlinger at a specific time. SurfaceFlinger\ntraces feature a chronological sequence of states that provide valuable insights\ninto how a window appears on screen and determines which window receives touch\nresponses at specific locations. This information is essential for\ntroubleshooting issues such as *the app isn't responding to my touch* or *I\nexperienced flickering while watching a video*.\n\nWinscope's SurfaceFlinger viewer displays this information for traces\ncollected using either the active mode or generated from the transactions trace\nwhen taking a bug report (by default, the Droidfood configuration), as well as\nfor dumps.\n\nSee [SurfaceFlinger (layers)](/docs/core/graphics/winscope/capture/adb#capture-adb-sf)\nfor more information about trace collection.\n\n**Figure 1.** SurfaceFlinger trace analysis.\n\nThe left side of the screen features a 3D view of the layers. The rects view\nconsiders layer bounds, z-order, opacity, relative Z, and rounded corners.\n\nHierarchy chips\n---------------\n\nThe tab's central segment shows the layer hierarchy with chips for more\ninformation, such as the parent-child relationships between layers, as follows:\n\n- **V**: Identifies visible layers.\n- **RelZParent** : Identifies layers with a **RelZ** child.\n- **RelZ** : Identifies layers with a **RelZParent** and drawn in z-order as their hierarchy.\n\n| **Warning:** The following items are deprecated since Android 15 but available on older traces.\n\n- **HWC**: Identifies layers composed by the Hardware Composer.\n- **GPU**: Identifies layers composed by the GPU.\n\nThe right side of the screen features a list of curated **properties** , as well\nas a **proto dump** of all available layer properties. For more information\nabout the features of the proto dump section see\n[Properties](/docs/core/graphics/winscope/analyze/overview#analyze-properties).\n\nCurated properties\n------------------\n\nTo make debugging easier, the SurfaceFlinger viewer provides a curated list of\nproperties, presenting the most commonly used information in a more organized\nformat:\n\n**Figure 2.** SurfaceFlinger properties.\n\nThis list includes the following categories.\n\n### Visibility\n\nThis block contains information about the layer visibility and an explanation to\nwhy it isn't visible. It includes:\n\n**Flags:** These control visibility, for example, `HIDDEN` and `OPAQUE`.\n\n**Invisibility reason:** An explanation for why the layer or surface is\ninvisible on the screen if applicable, for example, hidden by itself or its\nparent, or have no buffer to draw.\n\n**Occluded** , **Partially occluded** , or **Covered:**\n\n- **Occluded:** The current layer is calculated as visible, but another opaque layer is drawn on top of it, making the current layer invisible. The layer above the **Occluded** layer is opaque, that is, either its `OPAQUE` flag is set, or the pixel format doesn't contain alpha or no alpha is set on the layer.\n- **Partially Occluded:** The current layer is partially visible as the opaque layer drawn on top of it doesn't entirely cover it. The layer above the **Partially Occluded** layer is opaque, that is, the `OPAQUE` flag is set, or the pixel format doesn't contain alpha or no alpha is set on the layer.\n- **Covered:** The current layer is covered, either entirely or partially, by\n a non opaque layer and may still be visible on screen. The layer above the\n **Covered** layer isn't opaque, that is, the `OPAQUE` flag isn't set or\n the pixel format contains alpha or alpha is set on the layer. However, for\n SurfaceFlinger traces, a **Covered** layer is shown as visible, for layers\n below SurfaceFlinger:\n\n **Figure 3.** Covered layer on SurfaceFlinger.\n | **Note:** A non opaque layer supports translucent pixels. If the layer contents are fully opaque the layer below it won't appear on screen.\n\n| **Note:** The layer may be considered visible, but isn't shown on screen if it's occluded by one or more opaque layers or covered by a translucent layer with opaque pixels.\n\n### Geometry and Effects\n\nThis section describes the requested and computed geometry and effects for the\ncurrent layer.\n\nThe **Requested** section shows the properties being set on the layer. In\ncontrast, the **Calculated** section displays the properties that are being\napplied to the layer. This distinction is because geometry and effects are\npassed down the hierarchy and inherited from parent elements.\n\nIn Figure 2, the layer requests the **Corner Radius** to be set to\n0 px. However, one of its parent layers sets the **Corner Radius** to be\n97.419 px, which is the applied value:\n\n### Buffer\n\nThe following properties display information about whether the layer has a\nbuffer, its size, and transform.\n\n- **Frame Number:** Incremental number starting when an app is created.\n- **Destination Frame:** Used to scale the buffer to the bounds defined by destination frame.\n\n### Hierarchy\n\nThe following properties describe how the hierarchy of layers is determined:\n\n- **z-order:** In the hierarchy of layers, the z-ordering determines the relative positioning of a layer in relation to its siblings. A layer with a z-value of 0 is positioned above its parent. If multiple layers share the same z-value, the layer with the higher layer ID is placed on top.\n- **relative parent:** Indicates the relative parent layer in the z-order. The child doesn't inherit any properties from its relative parent except for the hidden flag.\n\n### Input\n\nThe following properties contain information about touchable region and focus:\n\n- **Crop touch region with item:** Use layer bounds to crop the touchable region.\n- **Replace touch region with crop:** Use current layers crop as its touchable region."]]