summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jeremy Sim <jeremysim@google.com> 2025-03-12 20:17:27 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2025-03-12 20:17:27 -0700
commit0800ef92e35529f09badfa88a102a1fe9dfc97ca (patch)
treeb7e95206f5ef4c8ec8659e63ac4f61f123818264
parent7e9e9181e14b63c70f4e659c807d665625f7ee85 (diff)
parent124ab11a3770e62f188f55c11c32f1a1ea580d43 (diff)
Merge "Fix flex split layout on landscape phones" into main
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java21
1 files changed, 14 insertions, 7 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 fec1f56c76bb..2b0885ed65a1 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
@@ -559,7 +559,12 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
true /* setEffectBounds */);
}
- /** Updates recording bounds of divider window and both of the splits. */
+ /**
+ * Updates the bounds of the divider window and both split apps.
+ * @param position The left/top edge of the visual divider, where the edge of app A meets the
+ * divider. Not to be confused with the actual divider surface, which is larger
+ * and overlaps the apps a bit.
+ */
private void updateBounds(int position, Rect bounds1, Rect bounds2, Rect dividerBounds,
boolean setEffectBounds) {
dividerBounds.set(mRootBounds);
@@ -574,10 +579,11 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
// For flexible split, expand app offscreen as well
if (mDividerSnapAlgorithm.areOffscreenRatiosSupported()) {
- if (position <= mDividerSnapAlgorithm.getMiddleTarget().position) {
- bounds1.left = bounds1.right - bounds2.width();
+ int distanceToCenter = position - mDividerSnapAlgorithm.getMiddleTarget().position;
+ if (position < mDividerSnapAlgorithm.getMiddleTarget().position) {
+ bounds1.left += distanceToCenter * 2;
} else {
- bounds2.right = bounds2.left + bounds1.width();
+ bounds2.right += distanceToCenter * 2;
}
}
@@ -590,10 +596,11 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
// For flexible split, expand app offscreen as well
if (mDividerSnapAlgorithm.areOffscreenRatiosSupported()) {
- if (position <= mDividerSnapAlgorithm.getMiddleTarget().position) {
- bounds1.top = bounds1.bottom - bounds2.height();
+ int distanceToCenter = position - mDividerSnapAlgorithm.getMiddleTarget().position;
+ if (position < mDividerSnapAlgorithm.getMiddleTarget().position) {
+ bounds1.top += distanceToCenter * 2;
} else {
- bounds2.bottom = bounds2.top + bounds1.height();
+ bounds2.bottom += distanceToCenter * 2;
}
}
}