Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 373ede85 authored by Jeremy Sim's avatar Jeremy Sim Committed by Android (Google) Code Review
Browse files

Merge "Allow devices to calculate their own split ratio instead of using fixed ratio" into main

parents bc7a4d0b 2e46c77c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -6973,6 +6973,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. -->
+1 −0
Original line number Diff line number Diff line
@@ -408,6 +408,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" />
+7 −0
Original line number Diff line number Diff line
@@ -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);