Pass in callsite of SurfaceControl constructor explicitly (1/3)

Creating a new Throwable (and filling in the stack trace) can take
up to 150us. Since we do this on the critical path when sending
over SurfaceControl via binder multiple times, this is too much.
Instead, add an option to pass in callsite manually.

Bug: 159056748
Change-Id: I46c339c15a07192d61c4c546e46f260684a47120
Merged-In: I46c339c15a07192d61c4c546e46f260684a47120
Exempt-From-Owner-Approval: Large scale refactor
This commit is contained in:
Jorim Jaggi
2020-06-19 00:49:51 +02:00
parent cae0a5b56a
commit d42ab1b938
43 changed files with 131 additions and 44 deletions

View File

@@ -5149,7 +5149,7 @@ package android.view {
}
public final class SurfaceControl implements android.os.Parcelable {
ctor public SurfaceControl(@NonNull android.view.SurfaceControl);
ctor public SurfaceControl(@NonNull android.view.SurfaceControl, @NonNull String);
method public static long acquireFrameRateFlexibilityToken();
method public boolean isSameSurface(@NonNull android.view.SurfaceControl);
method public static void releaseFrameRateFlexibilityToken(long);

View File

@@ -1918,9 +1918,16 @@ public final class StrictMode {
}
private static class AndroidCloseGuardReporter implements CloseGuard.Reporter {
@Override
public void report(String message, Throwable allocationSite) {
onVmPolicyViolation(new LeakedClosableViolation(message, allocationSite));
}
@Override
public void report(String message) {
onVmPolicyViolation(new LeakedClosableViolation(message));
}
}
/** Called from Parcel.writeNoException() */

View File

@@ -21,4 +21,9 @@ public final class LeakedClosableViolation extends Violation {
super(message);
initCause(allocationSite);
}
/** @hide */
public LeakedClosableViolation(String message) {
super(message);
}
}

View File

@@ -45,7 +45,7 @@ public class InsetsSourceControl implements Parcelable {
public InsetsSourceControl(InsetsSourceControl other) {
mType = other.mType;
if (other.mLeash != null) {
mLeash = new SurfaceControl(other.mLeash);
mLeash = new SurfaceControl(other.mLeash, "InsetsSourceControl");
} else {
mLeash = null;
}

View File

@@ -499,14 +499,12 @@ public final class SurfaceControl implements Parcelable {
private static final int INTERNAL_DATASPACE_DISPLAY_P3 = 143261696;
private static final int INTERNAL_DATASPACE_SCRGB = 411107328;
private void assignNativeObject(long nativeObject) {
private void assignNativeObject(long nativeObject, String callsite) {
if (mNativeObject != 0) {
release();
}
if (nativeObject != 0) {
Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "closeGuard");
mCloseGuard.open("release");
Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);
mCloseGuard.openWithCallSite("release", callsite);
}
mNativeObject = nativeObject;
mNativeHandle = mNativeObject != 0 ? nativeGetHandle(nativeObject) : 0;
@@ -515,12 +513,12 @@ public final class SurfaceControl implements Parcelable {
/**
* @hide
*/
public void copyFrom(@NonNull SurfaceControl other) {
public void copyFrom(@NonNull SurfaceControl other, String callsite) {
mName = other.mName;
mWidth = other.mWidth;
mHeight = other.mHeight;
mLocalOwnerView = other.mLocalOwnerView;
assignNativeObject(nativeCopyFromSurfaceControl(other.mNativeObject));
assignNativeObject(nativeCopyFromSurfaceControl(other.mNativeObject), callsite);
}
/**
@@ -621,6 +619,7 @@ public final class SurfaceControl implements Parcelable {
private WeakReference<View> mLocalOwnerView;
private SurfaceControl mParent;
private SparseIntArray mMetadata;
private String mCallsite = "SurfaceControl.Builder";
/**
* Begin building a SurfaceControl with a given {@link SurfaceSession}.
@@ -654,7 +653,7 @@ public final class SurfaceControl implements Parcelable {
}
return new SurfaceControl(
mSession, mName, mWidth, mHeight, mFormat, mFlags, mParent, mMetadata,
mLocalOwnerView);
mLocalOwnerView, mCallsite);
}
/**
@@ -912,6 +911,18 @@ public final class SurfaceControl implements Parcelable {
return this;
}
/**
* Sets the callsite this SurfaceControl is constructed from.
*
* @param callsite String uniquely identifying callsite that created this object. Used for
* leakage tracking.
* @hide
*/
public Builder setCallsite(String callsite) {
mCallsite = callsite;
return this;
}
private Builder setFlags(int flags, int mask) {
mFlags = (mFlags & ~mask) | flags;
return this;
@@ -943,10 +954,13 @@ public final class SurfaceControl implements Parcelable {
* @param h The surface initial height.
* @param flags The surface creation flags.
* @param metadata Initial metadata.
* @param callsite String uniquely identifying callsite that created this object. Used for
* leakage tracking.
* @throws throws OutOfResourcesException If the SurfaceControl cannot be created.
*/
private SurfaceControl(SurfaceSession session, String name, int w, int h, int format, int flags,
SurfaceControl parent, SparseIntArray metadata, WeakReference<View> localOwnerView)
SurfaceControl parent, SparseIntArray metadata, WeakReference<View> localOwnerView,
String callsite)
throws OutOfResourcesException, IllegalArgumentException {
if (name == null) {
throw new IllegalArgumentException("name must not be null");
@@ -978,18 +992,20 @@ public final class SurfaceControl implements Parcelable {
"Couldn't allocate SurfaceControl native object");
}
mNativeHandle = nativeGetHandle(mNativeObject);
mCloseGuard.open("release");
mCloseGuard.openWithCallSite("release", callsite);
}
/**
* Copy constructor. Creates a new native object pointing to the same surface as {@code other}.
*
* @param other The object to copy the surface from.
* @param callsite String uniquely identifying callsite that created this object. Used for
* leakage tracking.
* @hide
*/
@TestApi
public SurfaceControl(@NonNull SurfaceControl other) {
copyFrom(other);
public SurfaceControl(@NonNull SurfaceControl other, @NonNull String callsite) {
copyFrom(other, callsite);
}
private SurfaceControl(Parcel in) {
@@ -1015,7 +1031,7 @@ public final class SurfaceControl implements Parcelable {
if (in.readInt() != 0) {
object = nativeReadFromParcel(in);
}
assignNativeObject(object);
assignNativeObject(object, "readFromParcel");
}
@Override
@@ -2209,7 +2225,7 @@ public final class SurfaceControl implements Parcelable {
public static SurfaceControl mirrorSurface(SurfaceControl mirrorOf) {
long nativeObj = nativeMirrorSurface(mirrorOf.mNativeObject);
SurfaceControl sc = new SurfaceControl();
sc.assignNativeObject(nativeObj);
sc.assignNativeObject(nativeObj, "mirrorSurface");
return sc;
}

View File

@@ -167,9 +167,10 @@ public class SurfaceControlViewHost {
public SurfaceControlViewHost(@NonNull Context context, @NonNull Display display,
@Nullable IBinder hostToken) {
mSurfaceControl = new SurfaceControl.Builder()
.setContainerLayer()
.setName("SurfaceControlViewHost")
.build();
.setContainerLayer()
.setName("SurfaceControlViewHost")
.setCallsite("SurfaceControlViewHost")
.build();
mWm = new WindowlessWindowManager(context.getResources().getConfiguration(),
mSurfaceControl, hostToken);
mViewRoot = new ViewRootImpl(context, display, mWm);

View File

@@ -993,6 +993,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
.setFormat(mFormat)
.setParent(viewRoot.getBoundsLayer())
.setFlags(mSurfaceFlags)
.setCallsite("SurfaceView.updateSurface")
.build();
mBackgroundControl = new SurfaceControl.Builder(mSurfaceSession)
.setName("Background for -" + name)
@@ -1000,6 +1001,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
.setOpaque(true)
.setColorLayer()
.setParent(mSurfaceControl)
.setCallsite("SurfaceView.updateSurface")
.build();
} else if (mSurfaceControl == null) {

View File

@@ -26372,6 +26372,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
.setParent(root.getSurfaceControl())
.setBufferSize(shadowSize.x, shadowSize.y)
.setFormat(PixelFormat.TRANSLUCENT)
.setCallsite("View.startDragAndDrop")
.build();
final Surface surface = new Surface();
surface.copyFrom(surfaceControl);

View File

@@ -1780,6 +1780,7 @@ public final class ViewRootImpl implements ViewParent,
.setContainerLayer()
.setName("Bounds for - " + getTitle().toString())
.setParent(getRenderSurfaceControl())
.setCallsite("ViewRootImpl.getBoundsLayer")
.build();
setBoundsLayerCrop();
mTransaction.show(mBoundsLayer).apply();

View File

@@ -136,7 +136,8 @@ public class WindowlessWindowManager implements IWindowSession {
.setParent(mRootSurface)
.setFormat(attrs.format)
.setBufferSize(getSurfaceWidth(attrs), getSurfaceHeight(attrs))
.setName(attrs.getTitle().toString());
.setName(attrs.getTitle().toString())
.setCallsite("WindowlessWindowManager.addToDisplay");
final SurfaceControl sc = b.build();
if (((attrs.inputFeatures &
@@ -248,7 +249,7 @@ public class WindowlessWindowManager implements IWindowSession {
if (viewFlags == View.VISIBLE) {
t.setBufferSize(sc, getSurfaceWidth(attrs), getSurfaceHeight(attrs))
.setOpaque(sc, isOpaque(attrs)).show(sc).apply();
outSurfaceControl.copyFrom(sc);
outSurfaceControl.copyFrom(sc, "WindowlessWindowManager.relayout");
} else {
t.hide(sc).apply();
outSurfaceControl.release();

View File

@@ -1000,6 +1000,7 @@ public final class Magnifier {
.setName("magnifier surface")
.setFlags(SurfaceControl.HIDDEN)
.setParent(parentSurfaceControl)
.setCallsite("InternalPopupWindow")
.build();
mSurface = new Surface();
mSurface.copyFrom(mSurfaceControl);

View File

@@ -164,6 +164,7 @@ public abstract class TaskEmbedder {
.setContainerLayer()
.setParent(parent)
.setName(name)
.setCallsite("TaskEmbedder.initialize")
.build();
if (!onInitialize()) {

View File

@@ -717,7 +717,7 @@ public class InsetsControllerTest {
// Simulate binder behavior by copying SurfaceControl. Otherwise, InsetsController will
// attempt to release mLeash directly.
SurfaceControl copy = new SurfaceControl(mLeash);
SurfaceControl copy = new SurfaceControl(mLeash, "InsetsControllerTest.createControl");
return new InsetsSourceControl(type, copy, new Point());
}

View File

@@ -102,10 +102,14 @@ class SplitScreenTaskOrganizer extends TaskOrganizer {
// Initialize dim surfaces:
mPrimaryDim = new SurfaceControl.Builder(mSurfaceSession)
.setParent(mPrimarySurface).setColorLayer()
.setName("Primary Divider Dim").build();
.setName("Primary Divider Dim")
.setCallsite("SplitScreenTaskOrganizer.onTaskAppeared")
.build();
mSecondaryDim = new SurfaceControl.Builder(mSurfaceSession)
.setParent(mSecondarySurface).setColorLayer()
.setName("Secondary Divider Dim").build();
.setName("Secondary Divider Dim")
.setCallsite("SplitScreenTaskOrganizer.onTaskAppeared")
.build();
SurfaceControl.Transaction t = getTransaction();
t.setLayer(mPrimaryDim, Integer.MAX_VALUE);
t.setColor(mPrimaryDim, new float[]{0f, 0f, 0f});

View File

@@ -588,8 +588,9 @@ final class ColorFade {
if (mSurfaceControl == null) {
Transaction t = new Transaction();
try {
final SurfaceControl.Builder builder =
new SurfaceControl.Builder(mSurfaceSession).setName("ColorFade");
final SurfaceControl.Builder builder = new SurfaceControl.Builder(mSurfaceSession)
.setName("ColorFade")
.setCallsite("ColorFade.createSurface");
if (mMode == MODE_FADE) {
builder.setColorLayer();
} else {

View File

@@ -893,6 +893,7 @@ final class AccessibilityController {
.setName(SURFACE_TITLE)
.setBufferSize(mTempPoint.x, mTempPoint.y) // not a typo
.setFormat(PixelFormat.TRANSLUCENT)
.setCallsite("ViewportWindow")
.build();
} catch (OutOfResourcesException oore) {
/* ignore */

View File

@@ -5910,7 +5910,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
ProtoLog.i(WM_DEBUG_APP_TRANSITIONS_ANIM, "Creating animation bounds layer");
final SurfaceControl.Builder builder = makeAnimationLeash()
.setParent(getAnimationLeashParent())
.setName(getSurfaceControl() + " - animation-bounds");
.setName(getSurfaceControl() + " - animation-bounds")
.setCallsite("ActivityRecord.createAnimationBoundsLayer");
final SurfaceControl boundsLayer = builder.build();
t.show(boundsLayer);
return boundsLayer;

View File

@@ -50,6 +50,7 @@ public class BlackFrame {
.setName("BlackSurface")
.setColorLayer()
.setParent(surfaceControl)
.setCallsite("BlackSurface")
.build();
transaction.setWindowCrop(surface, w, h);
transaction.setAlpha(surface, 1);

View File

@@ -175,6 +175,7 @@ class Dimmer {
.setParent(mHost.getSurfaceControl())
.setColorLayer()
.setName("Dim Layer for - " + mHost.getName())
.setCallsite("Dimmer.makeDimLayer")
.build();
}

View File

@@ -114,7 +114,8 @@ public class DisplayAreaOrganizerController extends IDisplayAreaOrganizerControl
void onDisplayAreaAppeared(IDisplayAreaOrganizer organizer, DisplayArea da) {
try {
SurfaceControl outSurfaceControl = new SurfaceControl(da.getSurfaceControl());
SurfaceControl outSurfaceControl = new SurfaceControl(da.getSurfaceControl(),
"DisplayAreaOrganizerController.onDisplayAreaAppeared");
organizer.onDisplayAreaAppeared(da.getDisplayAreaInfo(), outSurfaceControl);
} catch (RemoteException e) {
// Oh well...

View File

@@ -987,7 +987,10 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
final SurfaceControl.Builder b = mWmService.makeSurfaceBuilder(mSession)
.setOpaque(true)
.setContainerLayer();
mSurfaceControl = b.setName("Root").setContainerLayer().build();
mSurfaceControl = b.setName("Root")
.setContainerLayer()
.setCallsite("DisplayContent")
.build();
getPendingTransaction()
.setLayer(mSurfaceControl, 0)
@@ -1110,7 +1113,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
return null;
}
mShellRoots.put(windowType, root);
SurfaceControl out = new SurfaceControl(rootLeash);
SurfaceControl out = new SurfaceControl(rootLeash, "DisplayContent.addShellRoot");
return out;
}

View File

@@ -152,7 +152,9 @@ class DragState {
mInputSurface = mService.makeSurfaceBuilder(
mService.mRoot.getDisplayContent(mDisplayContent.getDisplayId()).getSession())
.setContainerLayer()
.setName("Drag and Drop Input Consumer").build();
.setName("Drag and Drop Input Consumer")
.setCallsite("DragState.showInputSurface")
.build();
}
final InputWindowHandle h = getInputWindowHandle();
if (h == null) {

View File

@@ -62,6 +62,7 @@ class EmulatorDisplayOverlay {
.setName("EmulatorDisplayOverlay")
.setBufferSize(mScreenSize.x, mScreenSize.y)
.setFormat(PixelFormat.TRANSLUCENT)
.setCallsite("EmulatorDisplayOverlay")
.build();
t.setLayer(ctrl, zOrder);
t.setPosition(ctrl, 0, 0);

View File

@@ -89,8 +89,10 @@ class InputConsumerImpl implements IBinder.DeathRecipient {
mWindowHandle.inputFeatures = 0;
mWindowHandle.scaleFactor = 1.0f;
mInputSurface = mService.makeSurfaceBuilder(mService.mRoot.getDisplayContent(displayId)
.getSession()).setContainerLayer().setName("Input Consumer " + name)
mInputSurface = mService.makeSurfaceBuilder(mService.mRoot.getDisplayContent(displayId).getSession())
.setContainerLayer()
.setName("Input Consumer " + name)
.setCallsite("InputConsumerImpl")
.build();
}

View File

@@ -261,8 +261,12 @@ public class Letterbox {
}
private void createSurface(SurfaceControl.Transaction t) {
mSurface = mSurfaceControlFactory.get().setName("Letterbox - " + mType)
.setFlags(HIDDEN).setColorLayer().build();
mSurface = mSurfaceControlFactory.get()
.setName("Letterbox - " + mType)
.setFlags(HIDDEN)
.setColorLayer()
.setCallsite("LetterboxSurface.createSurface")
.build();
t.setLayer(mSurface, -1)
.setColor(mSurface, new float[]{0, 0, 0})
.setColorSpaceAgnostic(mSurface, true);

View File

@@ -188,17 +188,20 @@ class ScreenRotationAnimation {
mBackColorSurface = displayContent.makeChildSurface(null)
.setName("BackColorSurface")
.setColorLayer()
.setCallsite("ScreenRotationAnimation")
.build();
mScreenshotLayer = displayContent.makeOverlay()
.setName("RotationLayer")
.setBufferSize(mWidth, mHeight)
.setSecure(isSecure)
.setCallsite("ScreenRotationAnimation")
.build();
mEnterBlackFrameLayer = displayContent.makeOverlay()
.setName("EnterBlackFrameLayer")
.setContainerLayer()
.setCallsite("ScreenRotationAnimation")
.build();
// In case display bounds change, screenshot buffer and surface may mismatch so set a

View File

@@ -60,7 +60,10 @@ public class ShellRoot {
mToken = new WindowToken(
dc.mWmService, client.asBinder(), windowType, true, dc, true, false);
mSurfaceControl = mToken.makeChildSurface(null)
.setContainerLayer().setName("Shell Root Leash " + dc.getDisplayId()).build();
.setContainerLayer()
.setName("Shell Root Leash " + dc.getDisplayId())
.setCallsite("ShellRoot")
.build();
mToken.getPendingTransaction().show(mSurfaceControl);
}

View File

@@ -48,6 +48,7 @@ class StrictModeFlash {
.setName("StrictModeFlash")
.setBufferSize(1, 1)
.setFormat(PixelFormat.TRANSLUCENT)
.setCallsite("StrictModeFlash")
.build();
// one more than Watermark? arbitrary.

View File

@@ -395,7 +395,8 @@ class SurfaceAnimator {
// doesn't work, you will can see the 2/3 button nav bar flicker during seamless
// rotation.
.setHidden(hidden)
.setEffectLayer();
.setEffectLayer()
.setCallsite("SurfaceAnimator.createAnimationLeash");
final SurfaceControl leash = builder.build();
t.setWindowCrop(leash, width, height);
t.setPosition(leash, x, y);

View File

@@ -162,6 +162,7 @@ class SurfaceFreezer {
.setBufferSize(width, height)
.setFormat(PixelFormat.TRANSLUCENT)
.setParent(parent)
.setCallsite("SurfaceFreezer.Snapshot")
.build();
ProtoLog.i(WM_SHOW_TRANSACTIONS, " THUMBNAIL %s: CREATE", mSurfaceControl);

View File

@@ -682,15 +682,19 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> {
super.onParentChanged(newParent, oldParent, () -> {
mAppAnimationLayer = makeChildSurface(null)
.setName("animationLayer")
.setCallsite("TaskDisplayArea.onParentChanged")
.build();
mBoostedAppAnimationLayer = makeChildSurface(null)
.setName("boostedAnimationLayer")
.setCallsite("TaskDisplayArea.onParentChanged")
.build();
mHomeAppAnimationLayer = makeChildSurface(null)
.setName("homeAnimationLayer")
.setCallsite("TaskDisplayArea.onParentChanged")
.build();
mSplitScreenDividerAnchor = makeChildSurface(null)
.setName("splitScreenDividerAnchor")
.setCallsite("TaskDisplayArea.onParentChanged")
.build();
getSyncTransaction()
.show(mAppAnimationLayer)

View File

@@ -117,7 +117,8 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
final RunningTaskInfo taskInfo = task.getTaskInfo();
mDeferTaskOrgCallbacksConsumer.accept(() -> {
try {
SurfaceControl outSurfaceControl = new SurfaceControl(task.getSurfaceControl());
SurfaceControl outSurfaceControl = new SurfaceControl(task.getSurfaceControl(),
"TaskOrganizerController.onTaskAppeared");
if (!task.mCreatedByOrganizer && !visible) {
// To prevent flashes, we hide the task prior to sending the leash to the
// task org if the task has previously hidden (ie. when entering PIP)

View File

@@ -86,7 +86,9 @@ class TaskPositioningController {
if (mInputSurface == null) {
mInputSurface = mService.makeSurfaceBuilder(dc.getSession())
.setContainerLayer()
.setName("Drag and Drop Input Consumer").build();
.setName("Drag and Drop Input Consumer")
.setCallsite("TaskPositioningController.showInputSurface")
.build();
}
final InputWindowHandle h = getDragWindowHandleLocked();

View File

@@ -52,6 +52,7 @@ class TaskScreenshotAnimatable implements SurfaceAnimator.Animatable {
mSurfaceControl = surfaceControlFactory.apply(new SurfaceSession())
.setName("RecentTaskScreenshotSurface")
.setBufferSize(mWidth, mHeight)
.setCallsite("TaskScreenshotAnimatable")
.build();
if (buffer != null) {
final Surface surface = new Surface();

View File

@@ -374,6 +374,7 @@ class TaskSnapshotSurface implements StartingSurface {
.setBufferSize(buffer.getWidth(), buffer.getHeight())
.setFormat(buffer.getFormat())
.setParent(mSurfaceControl)
.setCallsite("TaskSnapshotSurface.drawSizeMismatchSnapshot")
.build();
Surface surface = mService.mSurfaceFactory.get();
surface.copyFrom(mChildSurfaceControl);

View File

@@ -121,6 +121,7 @@ class Watermark {
.setName("WatermarkSurface")
.setBufferSize(1, 1)
.setFormat(PixelFormat.TRANSLUCENT)
.setCallsite("Watermark")
.build();
t.setLayer(ctrl, WindowManagerService.TYPE_LAYER_MULTIPLIER * 100)
.setPosition(ctrl, 0, 0)

View File

@@ -413,7 +413,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
}
void setInitialSurfaceControlProperties(SurfaceControl.Builder b) {
setSurfaceControl(b.build());
setSurfaceControl(b.setCallsite("WindowContainer.setInitialSurfaceControlProperties").build());
getSyncTransaction().show(mSurfaceControl);
onSurfaceShown(getSyncTransaction());
updateSurfacePosition();

View File

@@ -103,6 +103,7 @@ class WindowContainerThumbnail implements Animatable {
.setFormat(PixelFormat.TRANSLUCENT)
.setMetadata(METADATA_WINDOW_TYPE, mWindowContainer.getWindowingMode())
.setMetadata(METADATA_OWNER_UID, Process.myUid())
.setCallsite("WindowContainerThumbnail")
.build();
ProtoLog.i(WM_SHOW_TRANSACTIONS, " THUMBNAIL %s: CREATE", mSurfaceControl);

View File

@@ -8229,7 +8229,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
final SurfaceControl mirror = SurfaceControl.mirrorSurface(displaySc);
outSurfaceControl.copyFrom(mirror);
outSurfaceControl.copyFrom(mirror, "WMS.mirrorDisplay");
return true;
}

View File

@@ -459,6 +459,7 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
.setBufferSize(bounds.width(), bounds.height())
.setFormat(PixelFormat.TRANSLUCENT)
.setParent(wc.getParentSurfaceControl())
.setCallsite("WindowOrganizerController.takeScreenshot")
.build();
Surface surface = new Surface();
@@ -466,7 +467,7 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
surface.attachAndQueueBufferWithColorSpace(buffer.getGraphicBuffer(), null);
surface.release();
outSurfaceControl.copyFrom(screenshot);
outSurfaceControl.copyFrom(screenshot, "WindowOrganizerController.takeScreenshot");
return true;
}

View File

@@ -116,7 +116,8 @@ class WindowSurfaceController {
.setFormat(format)
.setFlags(flags)
.setMetadata(METADATA_WINDOW_TYPE, windowType)
.setMetadata(METADATA_OWNER_UID, ownerUid);
.setMetadata(METADATA_OWNER_UID, ownerUid)
.setCallsite("WindowSurfaceController");
final boolean useBLAST = mService.mUseBLAST && ((win.getAttrs().privateFlags &
WindowManager.LayoutParams.PRIVATE_FLAG_USE_BLAST) != 0);
@@ -132,6 +133,7 @@ class WindowSurfaceController {
.setName(name + "(BLAST)")
.setHidden(false)
.setBLASTLayer()
.setCallsite("WindowSurfaceController")
.build();
}
@@ -493,12 +495,12 @@ class WindowSurfaceController {
}
void getSurfaceControl(SurfaceControl outSurfaceControl) {
outSurfaceControl.copyFrom(mSurfaceControl);
outSurfaceControl.copyFrom(mSurfaceControl, "WindowSurfaceController.getSurfaceControl");
}
void getBLASTSurfaceControl(SurfaceControl outSurfaceControl) {
if (mBLASTSurfaceControl != null) {
outSurfaceControl.copyFrom(mBLASTSurfaceControl);
outSurfaceControl.copyFrom(mBLASTSurfaceControl, "WindowSurfaceController.getBLASTSurfaceControl");
}
}

View File

@@ -44,5 +44,10 @@ public class ShadowCloseGuard {
public void report(String message, Throwable allocationSite) {
mReports += 1;
}
@Override
public void report(String message) {
mReports += 1;
}
}
}

View File

@@ -18,6 +18,7 @@ package com.android.server.wm;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.clearInvocations;
import static org.mockito.Mockito.doAnswer;