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

Commit 1626a96b authored by Ben Lin's avatar Ben Lin Committed by Automerger Merge Worker
Browse files

Merge "PiP: Allow customization of PiP minimum size." into sc-dev am: c312c648 am: 9b550d2c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14077517

Change-Id: I03bd0ddb2472c66a59a43ec1c316405940bba524
parents 9d0b3112 9b550d2c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -36,6 +36,9 @@
    <!-- Allow PIP to resize via dragging the corner of PiP. -->
    <bool name="config_pipEnableDragCornerResize">false</bool>

    <!-- PiP minimum size, which is a % based off the shorter side of display width and height -->
    <fraction name="config_pipShortestEdgePercent">40%</fraction>

    <!-- Animation duration when using long press on recents to dock -->
    <integer name="long_press_dock_anim_duration">250</integer>

+4 −3
Original line number Diff line number Diff line
@@ -63,7 +63,6 @@ import java.io.PrintWriter;
 * the PIP.
 */
public class PipTouchHandler {
    @VisibleForTesting static final float MINIMUM_SIZE_PERCENT = 0.4f;

    private static final String TAG = "PipTouchHandler";
    private static final float DEFAULT_STASH_VELOCITY_THRESHOLD = 18000.f;
@@ -115,6 +114,7 @@ public class PipTouchHandler {
    private float mSavedSnapFraction = -1f;
    private boolean mSendingHoverAccessibilityEvents;
    private boolean mMovementWithinDismiss;
    private float mMinimumSizePercent;

    // Touch state
    private final PipTouchState mTouchState;
@@ -252,6 +252,7 @@ public class PipTouchHandler {
        mExpandedShortestEdgeSize = res.getDimensionPixelSize(
                R.dimen.pip_expanded_shortest_edge_size);
        mImeOffset = res.getDimensionPixelSize(R.dimen.pip_ime_offset);
        mMinimumSizePercent = res.getFraction(R.fraction.config_pipShortestEdgePercent, 1, 1);
        mPipDismissTargetHandler.updateMagneticTargetSize();
    }

@@ -481,12 +482,12 @@ public class PipTouchHandler {
                + (mPipBoundsState.getDisplayBounds().height() - insetBounds.bottom);
        final int minWidth, minHeight, maxWidth, maxHeight;
        if (aspectRatio > 1f) {
            minWidth = (int) Math.min(normalBounds.width(), shorterLength * MINIMUM_SIZE_PERCENT);
            minWidth = (int) Math.min(normalBounds.width(), shorterLength * mMinimumSizePercent);
            minHeight = (int) (minWidth / aspectRatio);
            maxWidth = (int) Math.max(normalBounds.width(), shorterLength - totalHorizontalPadding);
            maxHeight = (int) (maxWidth / aspectRatio);
        } else {
            minHeight = (int) Math.min(normalBounds.height(), shorterLength * MINIMUM_SIZE_PERCENT);
            minHeight = (int) Math.min(normalBounds.height(), shorterLength * mMinimumSizePercent);
            minWidth = (int) (minHeight * aspectRatio);
            maxHeight = (int) Math.max(normalBounds.height(), shorterLength - totalVerticalPadding);
            maxWidth = (int) (maxHeight * aspectRatio);