Do not set very small bounds for non-drag case

When non drag drop intent enter split case, we will set main stage
as fullscreen bounds and set very small bounds for side stage.
This might lead some race condition to compat mode. To avoid this,
we could set invisible bounds at first for this case, invisible
bounds is a normal half screen size bounds but outside of screen.

Fix: 286613903
Fix: 289583969
Test: manual
Test: pass existing tests
Change-Id: I5e8fffed1c7deda1d9591b1452ed0097048e3c59
This commit is contained in:
Tony Huang
2023-07-03 18:03:51 +08:00
parent 8e94c2816c
commit 66aa980c23
2 changed files with 11 additions and 4 deletions

View File

@@ -773,15 +773,13 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
ActivityManager.RunningTaskInfo task1, ActivityManager.RunningTaskInfo task2) {
boolean boundsChanged = false;
if (!mBounds1.equals(mWinBounds1) || !task1.token.equals(mWinToken1)) {
wct.setBounds(task1.token, mBounds1);
wct.setSmallestScreenWidthDp(task1.token, getSmallestWidthDp(mBounds1));
setTaskBounds(wct, task1, mBounds1);
mWinBounds1.set(mBounds1);
mWinToken1 = task1.token;
boundsChanged = true;
}
if (!mBounds2.equals(mWinBounds2) || !task2.token.equals(mWinToken2)) {
wct.setBounds(task2.token, mBounds2);
wct.setSmallestScreenWidthDp(task2.token, getSmallestWidthDp(mBounds2));
setTaskBounds(wct, task2, mBounds2);
mWinBounds2.set(mBounds2);
mWinToken2 = task2.token;
boundsChanged = true;
@@ -789,6 +787,13 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
return boundsChanged;
}
/** Set bounds to the {@link WindowContainerTransaction} for single task. */
public void setTaskBounds(WindowContainerTransaction wct,
ActivityManager.RunningTaskInfo task, Rect bounds) {
wct.setBounds(task.token, bounds);
wct.setSmallestScreenWidthDp(task.token, getSmallestWidthDp(bounds));
}
private int getSmallestWidthDp(Rect bounds) {
mTempRect.set(bounds);
mTempRect.inset(getDisplayStableInsets(mContext));

View File

@@ -1561,6 +1561,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
// split bounds.
wct.setSmallestScreenWidthDp(mMainStage.mRootTaskInfo.token,
SMALLEST_SCREEN_WIDTH_DP_UNDEFINED);
mSplitLayout.getInvisibleBounds(mTempRect1);
mSplitLayout.setTaskBounds(wct, mSideStage.mRootTaskInfo, mTempRect1);
}
wct.reorder(mRootTaskInfo.token, true);
setRootForceTranslucent(false, wct);