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

Commit 9c3a317e authored by Ikram Gabiyev's avatar Ikram Gabiyev Committed by Automerger Merge Worker
Browse files

Merge "Default to true for new pip size spec flag" into tm-qpr-dev am:...

Merge "Default to true for new pip size spec flag" into tm-qpr-dev am: 54e56426 am: 0c3c1c5e am: 464fbc8b

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



Change-Id: I2777596c1817eeeba8cdcafa131fdd7b2a21c83f
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 0bcec7cf 464fbc8b
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -212,24 +212,25 @@ public class PipSizeSpecHandler {
         */
        @Override
        public Size getSizeForAspectRatio(Size size, float aspectRatio) {
            // getting the percentage of the max size that current size takes
            float currAspectRatio = (float) size.getWidth() / size.getHeight();

            // getting the percentage of the max size that current size takes
            Size currentMaxSize = getMaxSize(currAspectRatio);
            float currentPercent = (float) size.getWidth() / currentMaxSize.getWidth();

            // getting the max size for the target aspect ratio
            Size updatedMaxSize = getMaxSize(aspectRatio);

            int width = (int) (updatedMaxSize.getWidth() * currentPercent);
            int height = (int) (updatedMaxSize.getHeight() * currentPercent);
            int width = Math.round(updatedMaxSize.getWidth() * currentPercent);
            int height = Math.round(updatedMaxSize.getHeight() * currentPercent);

            // adjust the dimensions if below allowed min edge size
            if (width < getMinEdgeSize() && aspectRatio <= 1) {
                width = getMinEdgeSize();
                height = (int) (width / aspectRatio);
                height = Math.round(width / aspectRatio);
            } else if (height < getMinEdgeSize() && aspectRatio > 1) {
                height = getMinEdgeSize();
                width = (int) (height * aspectRatio);
                width = Math.round(height * aspectRatio);
            }

            // reduce the dimensions of the updated size to the calculated percentage
@@ -366,7 +367,7 @@ public class PipSizeSpecHandler {
        mPipDisplayLayoutState = pipDisplayLayoutState;

        boolean enablePipSizeLargeScreen = SystemProperties
                .getBoolean("persist.wm.debug.enable_pip_size_large_screen", false);
                .getBoolean("persist.wm.debug.enable_pip_size_large_screen", true);

        // choose between two implementations of size spec logic
        if (enablePipSizeLargeScreen) {