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

Commit 27663eb7 authored by Mateusz Cicheński's avatar Mateusz Cicheński Committed by Automerger Merge Worker
Browse files

Merge "Validate aspect ratio on PiP params change." into tm-qpr-dev am: 8975d9a0 am: 3f5d786f

parents 6dc2ea79 3f5d786f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -198,7 +198,7 @@ public class PipBoundsAlgorithm {
    /**
     * @return whether the given {@param aspectRatio} is valid.
     */
    private boolean isValidPictureInPictureAspectRatio(float aspectRatio) {
    public boolean isValidPictureInPictureAspectRatio(float aspectRatio) {
        return Float.compare(mMinAspectRatio, aspectRatio) <= 0
                && Float.compare(aspectRatio, mMaxAspectRatio) <= 0;
    }
+10 −1
Original line number Diff line number Diff line
@@ -1259,7 +1259,16 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
    protected void applyNewPictureInPictureParams(@NonNull PictureInPictureParams params) {
        if (mDeferredTaskInfo != null || PipUtils.aspectRatioChanged(params.getAspectRatioFloat(),
                mPictureInPictureParams.getAspectRatioFloat())) {
            if (mPipBoundsAlgorithm.isValidPictureInPictureAspectRatio(
                    params.getAspectRatioFloat())) {
                mPipParamsChangedForwarder.notifyAspectRatioChanged(params.getAspectRatioFloat());
            } else {
                ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                        "%s: New aspect ratio is not valid."
                                + " hasAspectRatio=%b"
                                + " aspectRatio=%f",
                        TAG, params.hasSetAspectRatio(), params.getAspectRatioFloat());
            }
        }
        if (mDeferredTaskInfo != null
                || PipUtils.remoteActionsChanged(params.getActions(),