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

Commit 119c1dff authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Properly rotate cutout protection rect" into qt-qpr1-dev am: d87fd3b5...

Merge "Properly rotate cutout protection rect" into qt-qpr1-dev am: d87fd3b5 am: f087bcf9 am: 2d883643 am: 810fa4f2

Change-Id: I4dda823ff3b3d3131faa757d7c6764866111d2f0
parents 988f2cd5 810fa4f2
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Region;
import android.hardware.display.DisplayManager;
import android.os.Handler;
@@ -725,7 +726,8 @@ public class ScreenDecorations extends SystemUI implements Tunable {
        private final Rect mBoundingRect = new Rect();
        private final Path mBoundingPath = new Path();
        // Don't initialize these yet because they may never exist
        private Rect mProtectionRect;
        private RectF mProtectionRect;
        private RectF mProtectionRectOrig;
        private Path mProtectionPath;
        private Path mProtectionPathOrig;
        private Rect mTotalBounds = new Rect();
@@ -818,7 +820,11 @@ public class ScreenDecorations extends SystemUI implements Tunable {
                mProtectionPath = new Path();
            }
            mProtectionPathOrig.set(protectionPath);
            mProtectionRect = pathBounds;
            if (mProtectionRectOrig == null) {
                mProtectionRectOrig = new RectF();
                mProtectionRect = new RectF();
            }
            mProtectionRectOrig.set(pathBounds);
        }

        void setShowProtection(boolean shouldShow) {
@@ -898,6 +904,7 @@ public class ScreenDecorations extends SystemUI implements Tunable {
                // Reset the protection path so we don't aggregate rotations
                mProtectionPath.set(mProtectionPathOrig);
                mProtectionPath.transform(m);
                m.mapRect(mProtectionRect, mProtectionRectOrig);
            }
        }

@@ -964,7 +971,8 @@ public class ScreenDecorations extends SystemUI implements Tunable {
            if (mShowProtection) {
                // Make sure that our measured height encompases the protection
                mTotalBounds.union(mBoundingRect);
                mTotalBounds.union(mProtectionRect);
                mTotalBounds.union((int) mProtectionRect.left, (int) mProtectionRect.top,
                        (int) mProtectionRect.right, (int) mProtectionRect.bottom);
                setMeasuredDimension(
                        resolveSizeAndState(mTotalBounds.width(), widthMeasureSpec, 0),
                        resolveSizeAndState(mTotalBounds.height(), heightMeasureSpec, 0));