summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Huang <tonyychuang@google.com>2023-04-11 08:55:45 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-04-28 15:55:18 +0000
commit1a2408080879d48e33cff8715ef2589fa4bd25e3 (patch)
treec71556ad2f02c290e5d5e0cdf9589d893fe71582
parentc71edbd8e02a106785efa6a097f3fad000c69c09 (diff)
downloadbase-1a2408080879d48e33cff8715ef2589fa4bd25e3.tar.gz
Update the timing of clearing SplitRequest
We clean splitRequest after enter split and use it as a flag to do some function such as active split by child adjacent task if split invisible. However, in some cases, such as a task start another new task and finish it immediately. In this case, split active finished and split request reset but split still didn't invisible and new child task appeared, and it trigger function mentioned above then cause bug. To avoid such case, we should update the timing of clearing SplitRequest to cover trampoline tasks launch so it won't evict child tasks unexpectedly while entering split. Fix: 277556204 Test: manual Test: pass existing tests (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:7ae38cb0c1c6d1da6b2c45e6b809199ca8900235) Merged-In: Ib3240c0b5037a3a20692c83e2daa8cd858125ca7 Change-Id: Ib3240c0b5037a3a20692c83e2daa8cd858125ca7
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java16
1 files changed, 13 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 77939c7c6964..65be1b0550d6 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
@@ -1034,7 +1034,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
private void onRemoteAnimationFinishedOrCancelled(WindowContainerTransaction evictWct) {
mIsDividerRemoteAnimating = false;
mShouldUpdateRecents = true;
- mSplitRequest = null;
+ clearRequestIfPresented();
// If any stage has no child after animation finished, it means that split will display
// nothing, such status will happen if task and intent is same app but not support
// multi-instance, we should exit split and expand that app as full screen.
@@ -1054,7 +1054,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
private void onRemoteAnimationFinished(RemoteAnimationTarget[] apps) {
mIsDividerRemoteAnimating = false;
mShouldUpdateRecents = true;
- mSplitRequest = null;
+ clearRequestIfPresented();
// If any stage has no child after finished animation, that side of the split will display
// nothing. This might happen if starting the same app on the both sides while not
// supporting multi-instance. Exit the split screen and expand that app to full screen.
@@ -1320,6 +1320,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
});
mShouldUpdateRecents = false;
mIsDividerRemoteAnimating = false;
+ mSplitRequest = null;
mSplitLayout.getInvisibleBounds(mTempRect1);
if (childrenToTop == null || childrenToTop.getTopVisibleChildTaskId() == INVALID_TASK_ID) {
@@ -1412,6 +1413,13 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
}
}
+ private void clearRequestIfPresented() {
+ if (mSideStageListener.mVisible && mSideStageListener.mHasChildren
+ && mMainStageListener.mVisible && mSideStageListener.mHasChildren) {
+ mSplitRequest = null;
+ }
+ }
+
/**
* Returns whether the split pair in the recent tasks list should be broken.
*/
@@ -1776,6 +1784,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
true /* setReparentLeafTaskIfRelaunch */);
setRootForceTranslucent(true, wct);
} else {
+ clearRequestIfPresented();
wct.setReparentLeafTaskIfRelaunch(mRootTaskInfo.token,
false /* setReparentLeafTaskIfRelaunch */);
setRootForceTranslucent(false, wct);
@@ -1926,7 +1935,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
}
if (mMainStageListener.mHasChildren && mSideStageListener.mHasChildren) {
mShouldUpdateRecents = true;
- mSplitRequest = null;
+ clearRequestIfPresented();
updateRecentTasksSplitPair();
if (!mLogger.hasStartedSession()) {
@@ -2565,6 +2574,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
}
});
mShouldUpdateRecents = false;
+ mSplitRequest = null;
// Update local states.
setSplitsVisible(false);