From 738f779b79bea4ca38fa571635b9f7817a359df9 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Tue, 6 Jun 2023 06:01:14 +0000 Subject: [PATCH] Update callsites for leashes in a transition - Helps clarify what the surfaces are in the registry when dumping Bug: 266978825 Test: dumpsys activity service SystemUIService WMShell Change-Id: Ifd34bb2977e1a8c1a1ef9fcaaaa3e3677ec35f9b --- core/java/android/window/TransitionInfo.java | 10 ++++++++++ .../com/android/wm/shell/transition/Transitions.java | 1 + 2 files changed, 11 insertions(+) diff --git a/core/java/android/window/TransitionInfo.java b/core/java/android/window/TransitionInfo.java index 59238b40e0c8e..d2a16a3a92126 100644 --- a/core/java/android/window/TransitionInfo.java +++ b/core/java/android/window/TransitionInfo.java @@ -549,6 +549,16 @@ public final class TransitionInfo implements Parcelable { } } + /** + * Updates the callsites of all the surfaces in this transition, which aids in the debugging of + * lingering surfaces. + */ + public void setUnreleasedWarningCallSiteForAllSurfaces(String callsite) { + for (int i = mChanges.size() - 1; i >= 0; --i) { + mChanges.get(i).getLeash().setUnreleasedWarningCallSite(callsite); + } + } + /** * Makes a copy of this as if it were parcel'd and unparcel'd. This implies that surfacecontrol * refcounts are incremented which allows the "remote" receiver to release them without breaking diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java index de20c2d900662..2314376e8d27b 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java @@ -641,6 +641,7 @@ public class Transitions implements RemoteCallable, @VisibleForTesting void onTransitionReady(@NonNull IBinder transitionToken, @NonNull TransitionInfo info, @NonNull SurfaceControl.Transaction t, @NonNull SurfaceControl.Transaction finishT) { + info.setUnreleasedWarningCallSiteForAllSurfaces("Transitions.onTransitionReady"); ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, "onTransitionReady %s: %s", transitionToken, info); final int activeIdx = findByToken(mPendingTransitions, transitionToken);