Merge "Polish home-key from split to pip transition" into udc-dev am: c7a500cc4d

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23833763

Change-Id: Ia7d8641fed42d07eecaf90e99814792a2048bc23
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Hongwei Wang
2023-06-29 17:36:12 +00:00
committed by Automerger Merge Worker
3 changed files with 22 additions and 10 deletions

View File

@@ -840,7 +840,7 @@ public class PipTransition extends PipTransitionController {
} }
final Rect destinationBounds = mPipBoundsAlgorithm.getEntryDestinationBounds(); final Rect destinationBounds = mPipBoundsAlgorithm.getEntryDestinationBounds();
final Rect currentBounds = taskInfo.configuration.windowConfiguration.getBounds(); final Rect currentBounds = pipChange.getStartAbsBounds();
int rotationDelta = deltaRotation(startRotation, endRotation); int rotationDelta = deltaRotation(startRotation, endRotation);
Rect sourceHintRect = PipBoundsAlgorithm.getValidSourceHintRect( Rect sourceHintRect = PipBoundsAlgorithm.getValidSourceHintRect(
taskInfo.pictureInPictureParams, currentBounds, destinationBounds); taskInfo.pictureInPictureParams, currentBounds, destinationBounds);

View File

@@ -2841,18 +2841,24 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
} }
} }
final ArrayMap<Integer, SurfaceControl> dismissingTasks = new ArrayMap<>();
for (int i = info.getChanges().size() - 1; i >= 0; --i) {
final TransitionInfo.Change change = info.getChanges().get(i);
final ActivityManager.RunningTaskInfo taskInfo = change.getTaskInfo();
if (taskInfo == null) continue;
if (getStageOfTask(taskInfo) != null
|| getSplitItemPosition(change.getLastParent()) != SPLIT_POSITION_UNDEFINED) {
dismissingTasks.put(taskInfo.taskId, change.getLeash());
}
}
if (shouldBreakPairedTaskInRecents(dismissReason)) { if (shouldBreakPairedTaskInRecents(dismissReason)) {
// Notify recents if we are exiting in a way that breaks the pair, and disable further // Notify recents if we are exiting in a way that breaks the pair, and disable further
// updates to splits in the recents until we enter split again // updates to splits in the recents until we enter split again
mRecentTasks.ifPresent(recentTasks -> { mRecentTasks.ifPresent(recentTasks -> {
for (int i = info.getChanges().size() - 1; i >= 0; --i) { for (int i = dismissingTasks.keySet().size() - 1; i >= 0; --i) {
final TransitionInfo.Change change = info.getChanges().get(i); recentTasks.removeSplitPair(dismissingTasks.keyAt(i));
final ActivityManager.RunningTaskInfo taskInfo = change.getTaskInfo();
if (taskInfo != null && (getStageOfTask(taskInfo) != null
|| getSplitItemPosition(change.getLastParent())
!= SPLIT_POSITION_UNDEFINED)) {
recentTasks.removeSplitPair(taskInfo.taskId);
}
} }
}); });
} }
@@ -2870,6 +2876,10 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
t.hide(toStage == STAGE_TYPE_MAIN ? mSideStage.mRootLeash : mMainStage.mRootLeash); t.hide(toStage == STAGE_TYPE_MAIN ? mSideStage.mRootLeash : mMainStage.mRootLeash);
t.setPosition(toStage == STAGE_TYPE_MAIN t.setPosition(toStage == STAGE_TYPE_MAIN
? mMainStage.mRootLeash : mSideStage.mRootLeash, 0, 0); ? mMainStage.mRootLeash : mSideStage.mRootLeash, 0, 0);
} else {
for (int i = dismissingTasks.keySet().size() - 1; i >= 0; --i) {
finishT.hide(dismissingTasks.valueAt(i));
}
} }
if (toStage == STAGE_TYPE_UNDEFINED) { if (toStage == STAGE_TYPE_UNDEFINED) {
@@ -2879,7 +2889,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
} }
// Hide divider and dim layer on transition finished. // Hide divider and dim layer on transition finished.
setDividerVisibility(false, finishT); setDividerVisibility(false, t);
finishT.hide(mMainStage.mDimLayer); finishT.hide(mMainStage.mDimLayer);
finishT.hide(mSideStage.mDimLayer); finishT.hide(mSideStage.mDimLayer);
} }

View File

@@ -25,6 +25,7 @@ import static android.window.TransitionInfo.FLAG_IS_WALLPAPER;
import static com.android.wm.shell.common.split.SplitScreenConstants.FLAG_IS_DIVIDER_BAR; import static com.android.wm.shell.common.split.SplitScreenConstants.FLAG_IS_DIVIDER_BAR;
import static com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_UNDEFINED; import static com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_UNDEFINED;
import static com.android.wm.shell.pip.PipAnimationController.ANIM_TYPE_ALPHA;
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_UNDEFINED; import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_UNDEFINED;
import static com.android.wm.shell.splitscreen.SplitScreenController.EXIT_REASON_CHILD_TASK_ENTER_PIP; import static com.android.wm.shell.splitscreen.SplitScreenController.EXIT_REASON_CHILD_TASK_ENTER_PIP;
import static com.android.wm.shell.util.TransitionUtil.isOpeningType; import static com.android.wm.shell.util.TransitionUtil.isOpeningType;
@@ -477,6 +478,7 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler,
} }
} }
mPipHandler.setEnterAnimationType(ANIM_TYPE_ALPHA);
mPipHandler.startEnterAnimation(pipChange, startTransaction, finishTransaction, mPipHandler.startEnterAnimation(pipChange, startTransaction, finishTransaction,
finishCB); finishCB);
// Dispatch the rest of the transition normally. This will most-likely be taken by // Dispatch the rest of the transition normally. This will most-likely be taken by