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
This commit is contained in:
Jerry Chang
2022-06-17 10:13:58 +00:00
parent 4c2b5c8470
commit 4915f0b290

View File

@@ -809,7 +809,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
};
private final Consumer<SurfaceControl.Transaction> 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);
}
};