diff options
| author | 2024-04-26 18:47:42 -0700 | |
|---|---|---|
| committer | 2024-04-30 05:32:46 +0000 | |
| commit | 930cffe5f4ec101b9c8414e8ad6c9da877c6119a (patch) | |
| tree | 838c29203d56d40259326e3ef1f66c5de38b3959 | |
| parent | 0e2a08779ffc1808b5e2c7c3df4e6061d76d5540 (diff) | |
Allow devices to calculate their own split ratio instead of using fixed ratio
Previously, the 30-70 and 70-30 ratios were always calculated precisely at 34.15%, defined in docked_stack_divider_fixed_ratio.
This CL adds a boolean flag, config_flexibleSplitRatios, that allows devices to override docked_stack_divider_fixed_ratio. When overridden, the device will possibly use a larger split ratio to ensure that apps are shown with a minimum size.
Fixes: 330388049
Test: Manual
Change-Id: I491e895abab075e0319804fdec21f5e94053e7f3
| -rw-r--r-- | core/res/res/values/config.xml | 3 | ||||
| -rw-r--r-- | core/res/res/values/symbols.xml | 1 | ||||
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerSnapAlgorithm.java | 7 |
3 files changed, 11 insertions, 0 deletions
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 6f605e94c1eb..8249a91bd0be 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -6944,6 +6944,9 @@ <!-- Whether to enable left-right split in portrait on this device --> <bool name="config_leftRightSplitInPortrait">false</bool> + <!-- Whether to allow split screen ratios to flexibly calculate based on available space --> + <bool name="config_flexibleSplitRatios">false</bool> + <!-- Whether scroll haptic feedback is enabled for rotary encoder scrolls on {@link MotionEvent#AXIS_SCROLL} generated by {@link InputDevice#SOURCE_ROTARY_ENCODER} devices. --> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index f23cf98a75e2..765a76e51b9a 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -410,6 +410,7 @@ <java-symbol type="bool" name="config_supportsSplitScreenMultiWindow" /> <java-symbol type="bool" name="config_supportsMultiDisplay" /> <java-symbol type="bool" name="config_leftRightSplitInPortrait" /> + <java-symbol type="bool" name="config_flexibleSplitRatios" /> <java-symbol type="integer" name="config_supportsNonResizableMultiWindow" /> <java-symbol type="integer" name="config_respectsActivityMinWidthHeightMultiWindow" /> <java-symbol type="dimen" name="config_minPercentageMultiWindowSupportHeight" /> diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerSnapAlgorithm.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerSnapAlgorithm.java index f9a286ec804f..bc6ed1f63c8a 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerSnapAlgorithm.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerSnapAlgorithm.java @@ -84,6 +84,8 @@ public class DividerSnapAlgorithm { private final int mMinimalSizeResizableTask; private final int mTaskHeightInMinimizedMode; private final float mFixedRatio; + /** Allows split ratios to calculated dynamically instead of using {@link #mFixedRatio}. */ + private final boolean mAllowFlexibleSplitRatios; private boolean mIsHorizontalDivision; /** The first target which is still splitting the screen */ @@ -144,6 +146,8 @@ public class DividerSnapAlgorithm { com.android.internal.R.fraction.docked_stack_divider_fixed_ratio, 1, 1); mMinimalSizeResizableTask = res.getDimensionPixelSize( com.android.internal.R.dimen.default_minimal_size_resizable_task); + mAllowFlexibleSplitRatios = res.getBoolean( + com.android.internal.R.bool.config_flexibleSplitRatios); mTaskHeightInMinimizedMode = isHomeResizable ? res.getDimensionPixelSize( com.android.internal.R.dimen.task_height_of_minimized_mode) : 0; calculateTargets(isHorizontalDivision, dockSide); @@ -349,6 +353,9 @@ public class DividerSnapAlgorithm { ? mDisplayHeight - mInsets.bottom : mDisplayWidth - mInsets.right; int size = (int) (mFixedRatio * (end - start)) - mDividerSize / 2; + if (mAllowFlexibleSplitRatios) { + size = Math.max(size, mMinimalSizeResizableTask); + } int topPosition = start + size; int bottomPosition = end - size - mDividerSize; addNonDismissingTargets(isHorizontalDivision, topPosition, bottomPosition, dividerMax); |