diff options
| author | 2022-06-28 17:43:20 +0800 | |
|---|---|---|
| committer | 2022-06-29 15:22:28 +0800 | |
| commit | 04bd0fa0434d42a92b843d1b0c0efea2c2c3df6c (patch) | |
| tree | 698ee20b44699bd64257651a5f99e48359aa436f | |
| parent | b8cbfd3fd52ef53b12277571a80f3e10e5c0eab3 (diff) | |
Avoid re-launch button show after split switching
Due to difference of both side insets value, split bounds will
change after split switching. But bounds difference are actually
small. For users, they might not notice bounds change but re-launch
button show there might cause them confused.
Igonre insets difference and make them same as the larger one on split
axis. This will offset drag target position but should cause bad UX
experience because the offset should be very small and both insest
should not have big difference on general case.
Fix: 236400046
Test: manual
Test: pass existing tests
Change-Id: I91d3a43015b7ef0a35c4e755de085053dfb9977b
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java index c962de67a93b..992aecf3e1b2 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java @@ -449,13 +449,25 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange private DividerSnapAlgorithm getSnapAlgorithm(Context context, Rect rootBounds, @Nullable Rect stableInsets) { final boolean isLandscape = isLandscape(rootBounds); + final Rect insets = stableInsets != null ? stableInsets : getDisplayInsets(context); + + // Make split axis insets value same as the larger one to avoid bounds1 and bounds2 + // have difference after split switching for solving issues on non-resizable app case. + if (isLandscape) { + final int largerInsets = Math.max(insets.left, insets.right); + insets.set(largerInsets, insets.top, largerInsets, insets.bottom); + } else { + final int largerInsets = Math.max(insets.top, insets.bottom); + insets.set(insets.left, largerInsets, insets.right, largerInsets); + } + return new DividerSnapAlgorithm( context.getResources(), rootBounds.width(), rootBounds.height(), mDividerSize, !isLandscape, - stableInsets != null ? stableInsets : getDisplayInsets(context), + insets, isLandscape ? DOCKED_LEFT : DOCKED_TOP /* dockSide */); } |