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

Commit bd04196f authored by Winson Chung's avatar Winson Chung
Browse files

Updating to new aspect ratio limits.

Bug: 35949789
Test: android.server.cts.ActivityManagerPinnedStackTests
Change-Id: Id47bdee0903744efb6aa3200691cd7817463aa13
parent af4bb686
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -2580,12 +2580,14 @@
    <integer name="config_defaultPictureInPictureGravity">0x55</integer>

    <!-- The minimum aspect ratio (width/height) that is supported for picture-in-picture.  Any
         ratio smaller than this is considered too tall and thin to be usable. -->
    <item name="config_pictureInPictureMinAspectRatio" format="float" type="dimen">0.5</item>
         ratio smaller than this is considered too tall and thin to be usable. Currently, this
         is the inverse of the max landscape aspect ratio (1:2.39), but this is an extremely
         skinny aspect ratio that is not expected to be widely used. -->
    <item name="config_pictureInPictureMinAspectRatio" format="float" type="dimen">0.41841004184</item>

    <!-- The minimum aspect ratio (width/height) that is supported for picture-in-picture. Any
         ratio larger than this is considered to wide and short to be usable. -->
    <item name="config_pictureInPictureMaxAspectRatio" format="float" type="dimen">2.35</item>
         ratio larger than this is considered to wide and short to be usable. Currently 2.39:1. -->
    <item name="config_pictureInPictureMaxAspectRatio" format="float" type="dimen">2.39</item>

    <!-- The snap mode to use for picture-in-picture. These values correspond to constants defined
         in PipSnapAlgorithm and should not be changed independently.
+2 −1
Original line number Diff line number Diff line
@@ -195,7 +195,8 @@ class PinnedStackController {
     * @return whether the given {@param aspectRatio} is valid.
     */
    public boolean isValidPictureInPictureAspectRatio(float aspectRatio) {
        return mMinAspectRatio <= aspectRatio && aspectRatio <= mMaxAspectRatio;
        return Float.compare(mMinAspectRatio, aspectRatio) <= 0 &&
                Float.compare(aspectRatio, mMaxAspectRatio) <= 0;
    }

    /**