Fix wrong split layout after drag drop

This cl fix two different issues but both belong to split layout
issue.

1. We will reset split layout after exitSplit, but when dismiss on
   non-onStageHasChildrenChange case, it reparent both split root
   children to TDA then no children remained. At this moment,
   onStageHasChildrenChange will callback and we will do
   flingDividerToDismiss and make layout change again then cause
   split layout wrong on next split active. This should be block
   by the active flag.
2. In some race condition, the applySurfaceChanges transtion might
   be merged to one transition and lead to surface bounds not set as
   our expectation. To avoid this issue, we should remove
   unnecessary applySurfaceChanges using.

Fix: 227142506
Test: manual
Test: pass existing tests
Change-Id: Id8741c88cf778a26fe39fa5c8223344a9bef4d46
This commit is contained in:
Tony Huang
2022-07-20 17:25:00 +08:00
parent e2137ed5b3
commit 55f0c287b7
2 changed files with 2 additions and 4 deletions

View File

@@ -400,8 +400,6 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
return;
}
mStageCoordinator.updateSurfaceBounds(null /* layout */, t,
false /* applyResizingOffset */);
for (int i = 0; i < apps.length; ++i) {
if (apps[i].mode == MODE_OPENING) {
t.show(apps[i].leash);

View File

@@ -1211,7 +1211,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
private void onStageHasChildrenChanged(StageListenerImpl stageListener) {
final boolean hasChildren = stageListener.mHasChildren;
final boolean isSideStage = stageListener == mSideStageListener;
if (!hasChildren && !mIsExiting) {
if (!hasChildren && !mIsExiting && mMainStage.isActive()) {
if (isSideStage && mMainStageListener.mVisible) {
// Exit to main stage if side stage no longer has children.
if (ENABLE_SHELL_TRANSITIONS) {
@@ -1231,7 +1231,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
EXIT_REASON_APP_FINISHED);
}
}
} else if (isSideStage && !mMainStage.isActive()) {
} else if (isSideStage && hasChildren && !mMainStage.isActive()) {
if (mFocusingTaskInfo != null && !isValidToEnterSplitScreen(mFocusingTaskInfo)) {
final WindowContainerTransaction wct = new WindowContainerTransaction();
mSideStage.removeAllTasks(wct, true);