From 7e4324b49685a192e6a6ecb49136abbfa39967d3 Mon Sep 17 00:00:00 2001 From: Tony Huang Date: Tue, 22 Nov 2022 07:57:50 +0000 Subject: Fix surface offset issue when enter split from recents The animation issue is cased by task surface has a offset while it is under animation leash. And this offset is a race condition which caused by split side set its bounds on same time. Fix this by applying bounds before animation start rather than on animation starting. Fix: 247466887 Test: manual Test: pass existing tests Change-Id: Id3de8358dbf3c1209e0e3986aca6dba854be17f4 --- .../src/com/android/wm/shell/splitscreen/StageCoordinator.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java index acb71a80ee8a..94ca9d322d8d 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java @@ -669,6 +669,12 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, mSplitLayout.init(); mSplitLayout.setDivideRatio(splitRatio); + // Apply surface bounds before animation start. + SurfaceControl.Transaction startT = mTransactionPool.acquire(); + updateSurfaceBounds(mSplitLayout, startT, false /* applyResizingOffset */); + startT.apply(); + mTransactionPool.release(startT); + // Set false to avoid record new bounds with old task still on top; mShouldUpdateRecents = false; mIsDividerRemoteAnimating = true; @@ -742,7 +748,6 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, mSyncQueue.queue(wct); mSyncQueue.runInSync(t -> { setDividerVisibility(true, t); - updateSurfaceBounds(mSplitLayout, t, false /* applyResizingOffset */); }); setEnterInstanceId(instanceId); -- cgit v1.2.3-59-g8ed1b