From 4915f0b290a711d6cb4258b904bae5ab65101353 Mon Sep 17 00:00:00 2001 From: Jerry Chang Date: Fri, 17 Jun 2022 10:13:58 +0000 Subject: [PATCH] Prevent setting position to a surface attached to leash Make sure to only update surface position when it's not attached to leash to prevent double offset the surface. Fix: 232745449 Test: add log to verify taskbar won't disappear with the same flow in bug. Change-Id: Ide9a2a5ebee40783620a14d7d7835cd87d892140 --- services/core/java/com/android/server/wm/WindowState.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 70499603801cc..aeef062e18929 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -809,7 +809,8 @@ class WindowState extends WindowContainer implements WindowManagerP }; private final Consumer mSetSurfacePositionConsumer = t -> { - if (mSurfaceControl != null && mSurfaceControl.isValid()) { + // Only apply the position to the surface when there's no leash created. + if (mSurfaceControl != null && mSurfaceControl.isValid() && !mSurfaceAnimator.hasLeash()) { t.setPosition(mSurfaceControl, mSurfacePosition.x, mSurfacePosition.y); } };