From 7d2761e465113bde98f516b542e0e63e5ab8909b Mon Sep 17 00:00:00 2001 From: Tony Huang Date: Sat, 22 Jan 2022 15:56:12 +0800 Subject: [PATCH] Fix divider animation and wrong split bounds Use a flag to prevent we should divider during luancher is animtating the divider and set surface bounds on this transition. Fix: 215667718 Fix: 215667829 Test: manual Test: pass existing tests Change-Id: I4bee717d8be314dd59ec303e73b1dd66be98c0c3 --- .../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 219530b46da47..029d073cb3d53 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 @@ -163,6 +163,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler, // and exit, since exit itself can trigger a number of changes that update the stages. private boolean mShouldUpdateRecents; private boolean mExitSplitScreenOnHide; + private boolean mIsDividerRemoteAnimating; /** The target stage to dismiss to when unlock after folded. */ @StageType @@ -389,6 +390,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler, RemoteAnimationTarget[] wallpapers, RemoteAnimationTarget[] nonApps, final IRemoteAnimationFinishedCallback finishedCallback) { + mIsDividerRemoteAnimating = true; RemoteAnimationTarget[] augmentedNonApps = new RemoteAnimationTarget[nonApps.length + 1]; for (int i = 0; i < nonApps.length; ++i) { @@ -400,6 +402,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler, new IRemoteAnimationFinishedCallback.Stub() { @Override public void onAnimationFinished() throws RemoteException { + mIsDividerRemoteAnimating = false; mShouldUpdateRecents = true; mSyncQueue.queue(evictWct); mSyncQueue.runInSync(t -> setDividerVisibility(true, t)); @@ -423,6 +426,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler, @Override public void onAnimationCancelled() { + mIsDividerRemoteAnimating = false; mShouldUpdateRecents = true; mSyncQueue.queue(evictWct); mSyncQueue.runInSync(t -> setDividerVisibility(true, t)); @@ -467,6 +471,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler, // Using legacy transitions, so we can't use blast sync since it conflicts. mTaskOrganizer.applyTransaction(wct); + mSyncQueue.runInSync(t -> updateSurfaceBounds(mSplitLayout, t)); } /** Start an intent and a task ordered by {@code intentFirst}. */ @@ -1055,7 +1060,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler, private void applyDividerVisibility(SurfaceControl.Transaction t) { final SurfaceControl dividerLeash = mSplitLayout.getDividerLeash(); - if (dividerLeash == null) return; + if (mIsDividerRemoteAnimating || dividerLeash == null) return; if (mDividerVisible) { t.show(dividerLeash);