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

Commit 7b681c93 authored by Diego Vela's avatar Diego Vela Committed by Automerger Merge Worker
Browse files

Merge "Add better error message when fold bounds are incorrect." into...

Merge "Add better error message when fold bounds are incorrect." into udc-qpr-dev am: ca108697 am: db06eda2

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



Change-Id: Icfb94290def323bac13b4e92854d8db256e42647
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents cf3a5f78 db06eda2
Loading
Loading
Loading
Loading
+25 −3
Original line number Diff line number Diff line
@@ -328,10 +328,32 @@ public class WindowLayoutComponentImpl implements WindowLayoutComponent {
            rotateRectToDisplayRotation(displayId, featureRect);
            transformToWindowSpaceRect(windowConfiguration, featureRect);

            if (!isZero(featureRect)) {
            if (isZero(featureRect)) {
                // TODO(b/228641877): Remove guarding when fixed.
                features.add(new FoldingFeature(featureRect, baseFeature.getType(), state));
                continue;
            }
            if (featureRect.left != 0 && featureRect.top != 0) {
                throw new IllegalArgumentException("Bounding rectangle must start at the top or "
                        + "left of the window. BaseFeatureRect: " + baseFeature.getRect()
                        + ", FeatureRect: " + featureRect
                        + ", WindowConfiguration: " + windowConfiguration);

            }
            if (featureRect.left == 0
                    && featureRect.width() != windowConfiguration.getBounds().width()) {
                throw new IllegalArgumentException("Horizontal FoldingFeature must have full width."
                        + " BaseFeatureRect: " + baseFeature.getRect()
                        + ", FeatureRect: " + featureRect
                        + ", WindowConfiguration: " + windowConfiguration);
            }
            if (featureRect.top == 0
                    && featureRect.height() != windowConfiguration.getBounds().height()) {
                throw new IllegalArgumentException("Vertical FoldingFeature must have full height."
                        + " BaseFeatureRect: " + baseFeature.getRect()
                        + ", FeatureRect: " + featureRect
                        + ", WindowConfiguration: " + windowConfiguration);
            }
            features.add(new FoldingFeature(featureRect, baseFeature.getType(), state));
        }
        return features;
    }