Always using middle position to resize layout

After rotation, the divider should always in middle if not in
minimized mode, so it should use middle position rather than
divider current position to resize split on rotation callback.

Fix: 192219057
Test: manual
Test: atest WMShellUnitTests
Change-Id: I255c1d6aad9a796ca3ec722f45977eb360fe3805
This commit is contained in:
Tony Huang
2021-06-28 17:20:39 +08:00
parent 556ca21ecf
commit ad813d0c45

View File

@@ -146,10 +146,8 @@ public class LegacySplitScreenController implements DisplayController.OnDisplays
new LegacySplitDisplayLayout(mContext, displayLayout, mSplits);
sdl.rotateTo(toRotation);
mRotateSplitLayout = sdl;
final int position = isDividerVisible()
? (mMinimized ? mView.mSnapTargetBeforeMinimized.position
: mView.getCurrentPosition())
// snap resets to middle target when not in split-mode
// snap resets to middle target when not minimized and rotation changed.
final int position = mMinimized ? mView.mSnapTargetBeforeMinimized.position
: sdl.getSnapAlgorithm().getMiddleTarget().position;
DividerSnapAlgorithm snap = sdl.getSnapAlgorithm();
final DividerSnapAlgorithm.SnapTarget target =