summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
author mattsziklay <mattsziklay@google.com> 2024-09-10 11:58:47 -0700
committer mattsziklay <mattsziklay@google.com> 2024-09-12 10:20:45 -0700
commit57f15aaf40ef1f51f155073fb97eee780bbfc41d (patch)
tree0822bccad4a6a60fe63aacf08eea9527ed3d69a3 /libs
parent4d05eceb317f418777783268bc944cc2967cf53d (diff)
Perform view model onTaskInfoChanged after split animation.
Currently, we perform DesktopModeWindowDecorViewModel#onTaskInfoChanged when StageCoordinator#onTaskInfoChanged is called. However, this results in a race condition where sometimes the window decoration's relayout would occur before the split transition is complete, causing the relayout to finish with outdated split information. This in turn causes the DesktopModeWindowDecoration's statusBarInputLayer to be positioned incorrectly as the passed TaskInfo would indicate that split tasks are still in fullscreen. This CL moves StageCoordinator's call to ViewModel's onTaskInfoChanged to after the animation is complete. This fix exposes a side effect where when a split task is dragged to split again, the opposite stage decor's statusBarInputLayer is not disposed of. This CL remedies that as well. Bug: 356953522 Test: Manual; perform repeated drag to split transitions and confirm app handle is responsive. Flag: EXEMPT, bugfix Change-Id: I8fad5a61f6ea6f7176633b63e1c3685b834d9246
Diffstat (limited to 'libs')
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java6
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java17
2 files changed, 20 insertions, 3 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 dad0d4eb4d8d..8d8184bafa25 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
@@ -34,7 +34,6 @@ import static android.view.WindowManager.transitTypeToString;
import static android.window.TransitionInfo.FLAG_IS_DISPLAY;
import static android.window.WindowContainerTransaction.HierarchyOp.HIERARCHY_OP_TYPE_REORDER;
-import static com.android.wm.shell.Flags.enableFlexibleSplit;
import static com.android.wm.shell.common.split.SplitLayout.PARALLAX_ALIGN_CENTER;
import static com.android.wm.shell.common.split.SplitScreenUtils.reverseSplitPosition;
import static com.android.wm.shell.common.split.SplitScreenUtils.splitFailureMessage;
@@ -1665,7 +1664,6 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
if (mRootTaskInfo == null || mRootTaskInfo.taskId != taskInfo.taskId) {
throw new IllegalArgumentException(this + "\n Unknown task info changed: " + taskInfo);
}
- mWindowDecorViewModel.ifPresent(viewModel -> viewModel.onTaskInfoChanged(taskInfo));
mRootTaskInfo = taskInfo;
if (mSplitLayout != null
&& mSplitLayout.updateConfiguration(mRootTaskInfo.configuration)
@@ -2814,6 +2812,10 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
mSplitLayout.flingDividerToCenter(this::notifySplitAnimationFinished);
}
callbackWct.setReparentLeafTaskIfRelaunch(mRootTaskInfo.token, false);
+ mWindowDecorViewModel.ifPresent(viewModel -> {
+ viewModel.onTaskInfoChanged(finalMainChild.getTaskInfo());
+ viewModel.onTaskInfoChanged(finalSideChild.getTaskInfo());
+ });
mPausingTasks.clear();
});
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java
index 79190689adc1..30ef428cde26 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java
@@ -41,6 +41,7 @@ import static com.android.wm.shell.desktopmode.DesktopModeVisualIndicator.Indica
import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE;
import static com.android.wm.shell.shared.split.SplitScreenConstants.SPLIT_POSITION_BOTTOM_OR_RIGHT;
import static com.android.wm.shell.shared.split.SplitScreenConstants.SPLIT_POSITION_TOP_OR_LEFT;
+import static com.android.wm.shell.shared.split.SplitScreenConstants.SPLIT_POSITION_UNDEFINED;
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_UNDEFINED;
import android.annotation.NonNull;
@@ -1091,8 +1092,22 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel {
// If we are entering split select, handle will no longer be visible and
// should not be receiving any input.
if (resultType == TO_SPLIT_LEFT_INDICATOR
- || resultType != TO_SPLIT_RIGHT_INDICATOR) {
+ || resultType == TO_SPLIT_RIGHT_INDICATOR) {
relevantDecor.disposeStatusBarInputLayer();
+ // We should also dispose the other split task's input layer if
+ // applicable.
+ final int splitPosition = mSplitScreenController
+ .getSplitPosition(relevantDecor.mTaskInfo.taskId);
+ if (splitPosition != SPLIT_POSITION_UNDEFINED) {
+ final int oppositePosition =
+ splitPosition == SPLIT_POSITION_TOP_OR_LEFT
+ ? SPLIT_POSITION_BOTTOM_OR_RIGHT
+ : SPLIT_POSITION_TOP_OR_LEFT;
+ final RunningTaskInfo oppositeTaskInfo =
+ mSplitScreenController.getTaskInfo(oppositePosition);
+ mWindowDecorByTaskId.get(oppositeTaskInfo.taskId)
+ .disposeStatusBarInputLayer();
+ }
}
mMoveToDesktopAnimator = null;
return;