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

Commit c241755d authored by Hongwei Wang's avatar Hongwei Wang Committed by Android (Google) Code Review
Browse files

Merge "Restrict the overridden min size for PiP" into sc-dev

parents 9c302594 8c511131
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -690,6 +690,13 @@
    <!-- The default minimal size of a PiP task, in both dimensions. -->
    <dimen name="default_minimal_size_pip_resizable_task">108dp</dimen>

    <!--
      The overridable minimal size of a PiP task, in both dimensions.
      Different from default_minimal_size_pip_resizable_task, this is to limit the dimension
      when the pinned stack size is overridden by app via minWidth/minHeight.
    -->
    <dimen name="overridable_minimal_size_pip_resizable_task">48dp</dimen>

    <!-- Height of a task when in minimized mode from the top when launcher is resizable. -->
    <dimen name="task_height_of_minimized_mode">80dp</dimen>

+1 −0
Original line number Diff line number Diff line
@@ -1948,6 +1948,7 @@
  <java-symbol type="fraction" name="config_dimBehindFadeDuration" />
  <java-symbol type="dimen" name="default_minimal_size_resizable_task" />
  <java-symbol type="dimen" name="default_minimal_size_pip_resizable_task" />
  <java-symbol type="dimen" name="overridable_minimal_size_pip_resizable_task" />
  <java-symbol type="dimen" name="task_height_of_minimized_mode" />
  <java-symbol type="fraction" name="config_screenAutoBrightnessDozeScaleFactor" />
  <java-symbol type="bool" name="config_allowPriorityVibrationsInLowPowerMode" />
+7 −1
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ public class PipBoundsAlgorithm {
    private float mMaxAspectRatio;
    private int mDefaultStackGravity;
    private int mDefaultMinSize;
    private int mOverridableMinSize;
    private Point mScreenEdgeInsets;

    public PipBoundsAlgorithm(Context context, @NonNull PipBoundsState pipBoundsState) {
@@ -78,6 +79,8 @@ public class PipBoundsAlgorithm {
                com.android.internal.R.integer.config_defaultPictureInPictureGravity);
        mDefaultMinSize = res.getDimensionPixelSize(
                com.android.internal.R.dimen.default_minimal_size_pip_resizable_task);
        mOverridableMinSize = res.getDimensionPixelSize(
                com.android.internal.R.dimen.overridable_minimal_size_pip_resizable_task);
        final String screenEdgeInsetsDpString = res.getString(
                com.android.internal.R.string.config_defaultPictureInPictureScreenEdgeInsets);
        final Size screenEdgeInsetsDp = !screenEdgeInsetsDpString.isEmpty()
@@ -155,7 +158,10 @@ public class PipBoundsAlgorithm {
        // -1 will be populated if an activity specifies defaultWidth/defaultHeight in <layout>
        // without minWidth/minHeight
        if (windowLayout.minWidth > 0 && windowLayout.minHeight > 0) {
            return new Size(windowLayout.minWidth, windowLayout.minHeight);
            // If either dimension is smaller than the allowed minimum, adjust them
            // according to mOverridableMinSize
            return new Size(Math.max(windowLayout.minWidth, mOverridableMinSize),
                    Math.max(windowLayout.minHeight, mOverridableMinSize));
        }
        return null;
    }
+3 −4
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ import com.android.wm.shell.ShellTestCase;
import com.android.wm.shell.TestShellExecutor;
import com.android.wm.shell.common.DisplayController;
import com.android.wm.shell.common.DisplayLayout;
import com.android.wm.shell.legacysplitscreen.LegacySplitScreen;
import com.android.wm.shell.legacysplitscreen.LegacySplitScreenController;
import com.android.wm.shell.pip.phone.PhonePipMenuController;

@@ -125,7 +124,7 @@ public class PipTaskOrganizerTest extends ShellTestCase {

    @Test
    public void startSwipePipToHome_updatesOverrideMinSize() {
        final Size minSize = new Size(100, 80);
        final Size minSize = new Size(400, 320);

        mSpiedPipTaskOrganizer.startSwipePipToHome(mComponent1, createActivityInfo(minSize),
                createPipParams(null));
@@ -153,7 +152,7 @@ public class PipTaskOrganizerTest extends ShellTestCase {

    @Test
    public void onTaskAppeared_updatesOverrideMinSize() {
        final Size minSize = new Size(100, 80);
        final Size minSize = new Size(400, 320);

        mSpiedPipTaskOrganizer.onTaskAppeared(
                createTaskInfo(mComponent1, createPipParams(null), minSize),
@@ -191,7 +190,7 @@ public class PipTaskOrganizerTest extends ShellTestCase {
        mSpiedPipTaskOrganizer.onTaskAppeared(createTaskInfo(mComponent1,
                createPipParams(null)), null /* leash */);

        final Size minSize = new Size(100, 80);
        final Size minSize = new Size(400, 320);
        mSpiedPipTaskOrganizer.onTaskInfoChanged(createTaskInfo(mComponent2,
                createPipParams(null), minSize));