Merge "Fix splitting with wrong apps when entering split with rotation" into tm-qpr-dev

This commit is contained in:
Jerry Chang
2023-03-03 01:56:13 +00:00
committed by Android (Google) Code Review

View File

@@ -204,7 +204,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
// and exit, since exit itself can trigger a number of changes that update the stages. // and exit, since exit itself can trigger a number of changes that update the stages.
private boolean mShouldUpdateRecents; private boolean mShouldUpdateRecents;
private boolean mExitSplitScreenOnHide; private boolean mExitSplitScreenOnHide;
private boolean mIsSplitEntering; private boolean mIsDividerRemoteAnimating;
private boolean mIsDropEntering; private boolean mIsDropEntering;
private boolean mIsExiting; private boolean mIsExiting;
@@ -881,7 +881,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
// Set false to avoid record new bounds with old task still on top; // Set false to avoid record new bounds with old task still on top;
mShouldUpdateRecents = false; mShouldUpdateRecents = false;
mIsSplitEntering = true; mIsDividerRemoteAnimating = true;
if (mSplitRequest == null) { if (mSplitRequest == null) {
mSplitRequest = new SplitRequest(mainTaskId, mSplitRequest = new SplitRequest(mainTaskId,
mainPendingIntent != null ? mainPendingIntent.getIntent() : null, mainPendingIntent != null ? mainPendingIntent.getIntent() : null,
@@ -974,7 +974,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
} }
private void onRemoteAnimationFinishedOrCancelled(WindowContainerTransaction evictWct) { private void onRemoteAnimationFinishedOrCancelled(WindowContainerTransaction evictWct) {
mIsSplitEntering = false; mIsDividerRemoteAnimating = false;
mShouldUpdateRecents = true; mShouldUpdateRecents = true;
mSplitRequest = null; mSplitRequest = null;
// If any stage has no child after animation finished, it means that split will display // If any stage has no child after animation finished, it means that split will display
@@ -1240,7 +1240,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
} }
}); });
mShouldUpdateRecents = false; mShouldUpdateRecents = false;
mIsSplitEntering = false; mIsDividerRemoteAnimating = false;
mSplitLayout.getInvisibleBounds(mTempRect1); mSplitLayout.getInvisibleBounds(mTempRect1);
if (childrenToTop == null || childrenToTop.getTopVisibleChildTaskId() == INVALID_TASK_ID) { if (childrenToTop == null || childrenToTop.getTopVisibleChildTaskId() == INVALID_TASK_ID) {
@@ -1573,7 +1573,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
&& !ENABLE_SHELL_TRANSITIONS) { && !ENABLE_SHELL_TRANSITIONS) {
// Clear the divider remote animating flag as the divider will be re-rendered to apply // Clear the divider remote animating flag as the divider will be re-rendered to apply
// the new rotation config. // the new rotation config.
mIsSplitEntering = false; mIsDividerRemoteAnimating = false;
mSplitLayout.update(null /* t */); mSplitLayout.update(null /* t */);
onLayoutSizeChanged(mSplitLayout); onLayoutSizeChanged(mSplitLayout);
} }
@@ -1623,9 +1623,9 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
} }
void onChildTaskAppeared(StageListenerImpl stageListener, int taskId) { void onChildTaskAppeared(StageListenerImpl stageListener, int taskId) {
// Handle entering split screen while there is a split pair running in the background.
if (stageListener == mSideStageListener && !isSplitScreenVisible() && isSplitActive() if (stageListener == mSideStageListener && !isSplitScreenVisible() && isSplitActive()
&& !mIsSplitEntering) { && mSplitRequest == null) {
// Handle entring split case here if split already running background.
if (mIsDropEntering) { if (mIsDropEntering) {
mSplitLayout.resetDividerPosition(); mSplitLayout.resetDividerPosition();
} else { } else {
@@ -1717,7 +1717,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
mDividerVisible = visible; mDividerVisible = visible;
sendSplitVisibilityChanged(); sendSplitVisibilityChanged();
if (mIsSplitEntering) { if (mIsDividerRemoteAnimating) {
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN, ProtoLog.d(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN,
" Skip animating divider bar due to it's remote animating."); " Skip animating divider bar due to it's remote animating.");
return; return;
@@ -1737,7 +1737,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
" Skip animating divider bar due to divider leash not ready."); " Skip animating divider bar due to divider leash not ready.");
return; return;
} }
if (mIsSplitEntering) { if (mIsDividerRemoteAnimating) {
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN, ProtoLog.d(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN,
" Skip animating divider bar due to it's remote animating."); " Skip animating divider bar due to it's remote animating.");
return; return;
@@ -1805,7 +1805,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
mSplitLayout.flingDividerToDismiss( mSplitLayout.flingDividerToDismiss(
mSideStagePosition != SPLIT_POSITION_BOTTOM_OR_RIGHT, mSideStagePosition != SPLIT_POSITION_BOTTOM_OR_RIGHT,
EXIT_REASON_APP_FINISHED); EXIT_REASON_APP_FINISHED);
} else if (!isSplitScreenVisible() && !mIsSplitEntering) { } else if (!isSplitScreenVisible() && mSplitRequest == null) {
// Dismiss split screen in the background once any sides of the split become empty.
exitSplitScreen(null /* childrenToTop */, EXIT_REASON_APP_FINISHED); exitSplitScreen(null /* childrenToTop */, EXIT_REASON_APP_FINISHED);
} }
} else if (isSideStage && hasChildren && !mMainStage.isActive()) { } else if (isSideStage && hasChildren && !mMainStage.isActive()) {