diff options
| author | 2023-05-04 13:02:52 +0000 | |
|---|---|---|
| committer | 2023-05-04 13:02:52 +0000 | |
| commit | 322d69469c48321f06d20bb0343af83d2a38778d (patch) | |
| tree | 314e5fec33fff68a98b7a633b250a597e78a0ddf | |
| parent | 5f3cda92f6b6cb014b5a29779096e0362986c797 (diff) | |
| parent | efc2c62779fd3e8d08f5dd690f478a76b8d65d1b (diff) | |
Merge "Send divider change to launcher to animate" into udc-dev
5 files changed, 40 insertions, 7 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java index 3e568e9cb996..387d39056ffc 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java @@ -431,6 +431,11 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler { " adding opening taskId=%d", taskInfo.taskId); mOpeningTasks.add(new TaskState(change, target.leash)); } + } else if (TransitionUtil.isDividerBar(change)) { + final RemoteAnimationTarget target = TransitionUtil.newTarget(change, + info.getChanges().size() - i, info, t, mLeashMap); + // Add this as a app and we will separate them on launcher side by window type. + apps.add(target); } } t.apply(); 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 e5ae10c097a5..a5a07b7de7b4 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 @@ -2788,8 +2788,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, } /** Call this when starting the open-recents animation while split-screen is active. */ - public void onRecentsInSplitAnimationStart(@NonNull SurfaceControl.Transaction t) { - setDividerVisibility(false, t); + public void onRecentsInSplitAnimationStart(TransitionInfo info) { + addDividerBarToTransition(info, false /* show */); } /** Call this when the recents animation during split-screen finishes. */ @@ -2806,6 +2806,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, || mSideStage.containsContainer(container))) { updateSurfaceBounds(mSplitLayout, finishT, false /* applyResizingOffset */); + finishT.reparent(mSplitLayout.getDividerLeash(), mRootTaskLeash); setDividerVisibility(true, finishT); return; } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultMixedHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultMixedHandler.java index 49429327572e..7d9ab668f18a 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultMixedHandler.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultMixedHandler.java @@ -524,7 +524,7 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler, finishCallback.onTransitionFinished(wct, wctCB); }; mixed.mInFlightSubAnimations = 1; - mSplitHandler.onRecentsInSplitAnimationStart(startTransaction); + mSplitHandler.onRecentsInSplitAnimationStart(info); final boolean handled = mixed.mLeftoversHandler.startAnimation(mixed.mTransition, info, startTransaction, finishTransaction, finishCB); if (!handled) { diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/util/TransitionUtil.java b/libs/WindowManager/Shell/src/com/android/wm/shell/util/TransitionUtil.java index 67a26fc97150..7d05c0e62e13 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/util/TransitionUtil.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/util/TransitionUtil.java @@ -110,6 +110,11 @@ public class TransitionUtil { && !change.hasFlags(FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY); } + /** Returns `true` if `change` is the divider. */ + public static boolean isDividerBar(TransitionInfo.Change change) { + return isNonApp(change) && change.hasFlags(FLAG_IS_DIVIDER_BAR); + } + /** Returns `true` if `change` is only re-ordering. */ public static boolean isOrderOnly(TransitionInfo.Change change) { return change.getMode() == TRANSIT_CHANGE @@ -175,6 +180,14 @@ public class TransitionUtil { t.setPosition(leash, absBounds.left - info.getRoot(rootIdx).getOffset().x, absBounds.top - info.getRoot(rootIdx).getOffset().y); + if (isDividerBar(change)) { + if (isOpeningType(mode)) { + t.setAlpha(leash, 0.f); + } + t.setLayer(leash, Integer.MAX_VALUE); + return; + } + // Put all the OPEN/SHOW on top if (TransitionUtil.isOpeningType(mode)) { if (isOpening) { @@ -245,6 +258,10 @@ public class TransitionUtil { */ public static RemoteAnimationTarget newTarget(TransitionInfo.Change change, int order, SurfaceControl leash) { + if (isDividerBar(change)) { + return getDividerTarget(change, leash); + } + int taskId; boolean isNotInRecents; ActivityManager.RunningTaskInfo taskInfo; @@ -284,8 +301,7 @@ public class TransitionUtil { new Rect(change.getStartAbsBounds()), taskInfo, change.getAllowEnterPip(), - (change.getFlags() & FLAG_IS_DIVIDER_BAR) != 0 - ? TYPE_DOCK_DIVIDER : INVALID_WINDOW_TYPE + INVALID_WINDOW_TYPE ); target.setWillShowImeOnTarget( (change.getFlags() & TransitionInfo.FLAG_WILL_IME_SHOWN) != 0); @@ -293,6 +309,17 @@ public class TransitionUtil { return target; } + private static RemoteAnimationTarget getDividerTarget(TransitionInfo.Change change, + SurfaceControl leash) { + return new RemoteAnimationTarget(-1 /* taskId */, -1 /* mode */, + leash, false /* isTranslucent */, null /* clipRect */, + null /* contentInsets */, Integer.MAX_VALUE /* prefixOrderIndex */, + new android.graphics.Point(0, 0) /* position */, change.getStartAbsBounds(), + change.getStartAbsBounds(), new WindowConfiguration(), true, null /* startLeash */, + null /* startBounds */, null /* taskInfo */, false /* allowEnterPip */, + TYPE_DOCK_DIVIDER); + } + /** * Finds the "correct" root idx for a change. The change's end display is prioritized, then * the start display. If there is no display, it will fallback on the 0th root in the diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/SplitTransitionTests.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/SplitTransitionTests.java index 92cbf7f068b4..b76d2dcc6e1e 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/SplitTransitionTests.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/SplitTransitionTests.java @@ -273,7 +273,7 @@ public class SplitTransitionTests extends ShellTestCase { // simulate the start of recents transition mMainStage.onTaskVanished(mMainChild); mSideStage.onTaskVanished(mSideChild); - mStageCoordinator.onRecentsInSplitAnimationStart(mock(SurfaceControl.Transaction.class)); + mStageCoordinator.onRecentsInSplitAnimationStart(mock(TransitionInfo.class)); assertTrue(mStageCoordinator.isSplitScreenVisible()); // Make sure it cleans-up if recents doesn't restore @@ -307,7 +307,7 @@ public class SplitTransitionTests extends ShellTestCase { // simulate the start of recents transition mMainStage.onTaskVanished(mMainChild); mSideStage.onTaskVanished(mSideChild); - mStageCoordinator.onRecentsInSplitAnimationStart(mock(SurfaceControl.Transaction.class)); + mStageCoordinator.onRecentsInSplitAnimationStart(mock(TransitionInfo.class)); assertTrue(mStageCoordinator.isSplitScreenVisible()); // Make sure we remain in split after recents restores. |