Plumb pid to Layer Metadata during Layer creation

For shared timeline visualization, the pid of the process owning the
layer is needed to show the information in the respective process
tracks. This change adds pid to the layer metadata that is passed around
during the creation of a layer.

Bug: 170911969
Test: pid section of `adb shell dumpsys SurfaceFlinger --frametimeline -<all/jank>`

Change-Id: Ibd16bf7740d0c1be07cdbd300a1741cfcb6d2ad8
This commit is contained in:
Adithya Srinivasan
2020-10-19 10:51:03 -07:00
parent c6ac5e15cb
commit 2bc43dcaa8
2 changed files with 8 additions and 1 deletions

View File

@@ -545,6 +545,12 @@ public final class SurfaceControl implements Parcelable {
*/
public static final int METADATA_ACCESSIBILITY_ID = 5;
/**
* owner PID.
* @hide
*/
public static final int METADATA_OWNER_PID = 6;
/**
* A wrapper around HardwareBuffer that contains extra information about how to
* interpret the screenshot HardwareBuffer.

View File

@@ -17,7 +17,7 @@
package com.android.server.wm;
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
import static android.view.Surface.SCALING_MODE_SCALE_TO_WINDOW;
import static android.view.SurfaceControl.METADATA_OWNER_PID;
import static android.view.SurfaceControl.METADATA_OWNER_UID;
import static android.view.SurfaceControl.METADATA_WINDOW_TYPE;
@@ -103,6 +103,7 @@ class WindowSurfaceController {
.setFlags(flags)
.setMetadata(METADATA_WINDOW_TYPE, windowType)
.setMetadata(METADATA_OWNER_UID, ownerUid)
.setMetadata(METADATA_OWNER_PID, mWindowSession.mPid)
.setCallsite("WindowSurfaceController");
final boolean useBLAST = mService.mUseBLAST && ((win.getAttrs().privateFlags &