From fd4d652197d136fe074539768e36ca535e588714 Mon Sep 17 00:00:00 2001 From: Tony Huang Date: Tue, 12 Jul 2022 16:17:45 +0800 Subject: [PATCH] Fix launch existing split pair fail after unfold device After unfold device then launch split pair, it might got remote animation cancelled callback. Because when we got this callback, both split roots still do not have child then we will dismiss split due to previous error handling. We should ignore cancelled case for this because cancel should indicate the transition still not finished, we should not do this if transition still not finished. Fix: 231952106 Test: manual Test: pass existing tests Change-Id: Iad5bce9025d1dc4a84765898e42289d47759828a --- .../android/wm/shell/splitscreen/StageCoordinator.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 e19c572c48504..2764f96022b9c 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 @@ -442,7 +442,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, new IRemoteAnimationFinishedCallback.Stub() { @Override public void onAnimationFinished() throws RemoteException { - onRemoteAnimationFinishedOrCancelled(evictWct); + onRemoteAnimationFinishedOrCancelled(false /* cancel */, evictWct); finishedCallback.onAnimationFinished(); } }; @@ -463,7 +463,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, @Override public void onAnimationCancelled(boolean isKeyguardOccluded) { - onRemoteAnimationFinishedOrCancelled(evictWct); + onRemoteAnimationFinishedOrCancelled(true /* cancel */, evictWct); try { adapter.getRunner().onAnimationCancelled(isKeyguardOccluded); } catch (RemoteException e) { @@ -513,13 +513,14 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, }); } - private void onRemoteAnimationFinishedOrCancelled(WindowContainerTransaction evictWct) { + private void onRemoteAnimationFinishedOrCancelled(boolean cancel, + WindowContainerTransaction evictWct) { mIsDividerRemoteAnimating = false; mShouldUpdateRecents = true; // If any stage has no child after animation finished, it means that split will display // nothing, such status will happen if task and intent is same app but not support // multi-instagce, we should exit split and expand that app as full screen. - if (mMainStage.getChildCount() == 0 || mSideStage.getChildCount() == 0) { + if (!cancel && (mMainStage.getChildCount() == 0 || mSideStage.getChildCount() == 0)) { mMainExecutor.execute(() -> exitSplitScreen(mMainStage.getChildCount() == 0 ? mSideStage : mMainStage, EXIT_REASON_UNKNOWN));