diff options
| author | 2023-06-26 05:48:44 +0000 | |
|---|---|---|
| committer | 2023-06-26 05:48:44 +0000 | |
| commit | 7111dd50ca36a2e9b010b45203fa41bb4c48b522 (patch) | |
| tree | fc76f1cdd1e713e408ddb239b84d6388c6601b4a /libs | |
| parent | b3c1422481931e6c58284e459de89b63b40131fc (diff) | |
| parent | 277bbab15044c0e0f28443eed8dacd19faaa7691 (diff) | |
Merge "Handle auto-pip change in split handling transitions" into udc-dev am: 277bbab150
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23727967
Change-Id: Ic617a5fff480620bdda3701023a4052e5d6e5e04
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'libs')
3 files changed, 43 insertions, 2 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 01d8967c7d60..8468aacffc69 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 @@ -2441,6 +2441,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, mSplitLayout.setFreezeDividerWindow(false); final StageChangeRecord record = new StageChangeRecord(); + final int transitType = info.getType(); + boolean hasEnteringPip = false; for (int iC = 0; iC < info.getChanges().size(); ++iC) { final TransitionInfo.Change change = info.getChanges().get(iC); if (change.getMode() == TRANSIT_CHANGE @@ -2448,6 +2450,10 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, mSplitLayout.update(startTransaction); } + if (mMixedHandler.isEnteringPip(change, transitType)) { + hasEnteringPip = true; + } + final ActivityManager.RunningTaskInfo taskInfo = change.getTaskInfo(); if (taskInfo == null) continue; if (taskInfo.token.equals(mRootTaskInfo.token)) { @@ -2496,6 +2502,13 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, } } } + + if (hasEnteringPip) { + mMixedHandler.animatePendingEnterPipFromSplit(transition, info, + startTransaction, finishTransaction, finishCallback); + return true; + } + final ArraySet<StageTaskListener> dismissStages = record.getShouldDismissedStage(); if (mMainStage.getChildCount() == 0 || mSideStage.getChildCount() == 0 || dismissStages.size() == 1) { 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 e83780a6fc77..49185d1a6ed7 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 @@ -447,7 +447,8 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler, } finishCallback.onTransitionFinished(mixed.mFinishWCT, wctCB); }; - if (isGoingHome) { + if (isGoingHome || mSplitHandler.getSplitItemPosition(pipChange.getLastParent()) + != SPLIT_POSITION_UNDEFINED) { ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " Animation is actually mixed " + "since entering-PiP caused us to leave split and return home."); // We need to split the transition into 2 parts: the pip part (animated by pip) @@ -516,10 +517,27 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler, } /** + * This is intended to be called by SplitCoordinator as a helper to mix a split handling + * transition with an entering-pip change. The use-case for this is when an auto-pip change + * gets collected into the transition which has already claimed by + * StageCoordinator.handleRequest. This happens when launching a fullscreen app while having an + * auto-pip activity in the foreground split pair. + */ + // TODO(b/287704263): Remove when split/mixed are reversed. + public boolean animatePendingEnterPipFromSplit(IBinder transition, TransitionInfo info, + SurfaceControl.Transaction startT, SurfaceControl.Transaction finishT, + Transitions.TransitionFinishCallback finishCallback) { + final MixedTransition mixed = new MixedTransition( + MixedTransition.TYPE_ENTER_PIP_FROM_SPLIT, transition); + mActiveTransitions.add(mixed); + return animateEnterPipFromSplit(mixed, info, startT, finishT, finishCallback); + } + + /** * This is intended to be called by SplitCoordinator as a helper to mix an already-pending * split transition with a display-change. The use-case for this is when a display * change/rotation gets collected into a split-screen enter/exit transition which has already - * been claimed by StageCoordinator.handleRequest . This happens during launcher tests. + * been claimed by StageCoordinator.handleRequest. This happens during launcher tests. */ public boolean animatePendingSplitWithDisplayChange(@NonNull IBinder transition, @NonNull TransitionInfo info, @NonNull SurfaceControl.Transaction startT, @@ -657,6 +675,13 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler, return mPipHandler.requestHasPipEnter(request); } + /** Whether a particular change is a window that is entering pip. */ + // TODO(b/287704263): Remove when split/mixed are reversed. + public boolean isEnteringPip(TransitionInfo.Change change, + @WindowManager.TransitionType int transitType) { + return mPipHandler.isEnteringPip(change, transitType); + } + @Override public void mergeAnimation(@NonNull IBinder transition, @NonNull TransitionInfo info, @NonNull SurfaceControl.Transaction t, @NonNull IBinder mergeTarget, 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 3b05651f884b..44c76de945b0 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 @@ -75,6 +75,7 @@ import com.android.wm.shell.common.SyncTransactionQueue; import com.android.wm.shell.common.TransactionPool; import com.android.wm.shell.common.split.SplitDecorManager; import com.android.wm.shell.common.split.SplitLayout; +import com.android.wm.shell.transition.DefaultMixedHandler; import com.android.wm.shell.transition.Transitions; import org.junit.Before; @@ -101,6 +102,7 @@ public class SplitTransitionTests extends ShellTestCase { @Mock private SurfaceSession mSurfaceSession; @Mock private IconProvider mIconProvider; @Mock private ShellExecutor mMainExecutor; + @Mock private DefaultMixedHandler mMixedHandler; private SplitLayout mSplitLayout; private MainStage mMainStage; private SideStage mSideStage; @@ -131,6 +133,7 @@ public class SplitTransitionTests extends ShellTestCase { mSyncQueue, mTaskOrganizer, mMainStage, mSideStage, mDisplayController, mDisplayImeController, mDisplayInsetsController, mSplitLayout, mTransitions, mTransactionPool, mMainExecutor, Optional.empty()); + mStageCoordinator.setMixedHandler(mMixedHandler); mSplitScreenTransitions = mStageCoordinator.getSplitTransitions(); doAnswer((Answer<IBinder>) invocation -> mock(IBinder.class)) .when(mTransitions).startTransition(anyInt(), any(), any()); |