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
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java
index 21bea46..c1092df 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java
@@ -400,8 +400,6 @@
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);
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 2229e26..e9d1055 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
@@ -1211,7 +1211,7 @@
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 @@
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);