From a19699eaa1137e7b09a6b320e528ab1e24141130 Mon Sep 17 00:00:00 2001 From: Jerry Chang Date: Mon, 14 Feb 2022 09:55:27 +0000 Subject: [PATCH] Fix dragging the same app over a split app dismisses the split Do not evict splitting children if the app start animation was canceled. So it won't apply the evict transaction which empties the split. Fix: 219139163 Test: manual check dropping the same app on the same side of the split won't dismiss the split. Change-Id: I5a450e53d857813f4fd59ab157be7d36985673ea --- .../splitscreen/SplitScreenController.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java index 990b53a601f30..c221f8afba4bc 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java @@ -349,17 +349,20 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, RemoteAnimationTarget[] wallpapers, RemoteAnimationTarget[] nonApps, IRemoteAnimationFinishedCallback finishedCallback, SurfaceControl.Transaction t) { - mStageCoordinator.updateSurfaceBounds(null /* layout */, t); - - if (apps != null) { - for (int i = 0; i < apps.length; ++i) { - if (apps[i].mode == MODE_OPENING) { - t.show(apps[i].leash); - } - } + if (apps == null || apps.length == 0) { + // Do nothing when the animation was cancelled. + t.apply(); + return; } + mStageCoordinator.updateSurfaceBounds(null /* layout */, t); + for (int i = 0; i < apps.length; ++i) { + if (apps[i].mode == MODE_OPENING) { + t.show(apps[i].leash); + } + } t.apply(); + if (finishedCallback != null) { try { finishedCallback.onAnimationFinished();