summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lucas Dupin <dupin@google.com> 2020-03-11 01:48:46 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-03-11 01:48:46 +0000
commitd87fd3b56a64be551a0cd8c2a26e2264f479247e (patch)
tree51167999da2a7f9c6d746ced7a7a12109529f27a
parentead4f22509f247eb26d6fb7e7f96164120f126f3 (diff)
parent7890462180ec409a9c5e4845685304e8690378af (diff)
Merge "Properly rotate cutout protection rect" into qt-qpr1-dev
-rw-r--r--packages/SystemUI/src/com/android/systemui/ScreenDecorations.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
index 6ea6a748ae8d..e0a9bb166fb2 100644
--- a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
+++ b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
@@ -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.graphics.drawable.VectorDrawable;
import android.hardware.display.DisplayManager;
@@ -879,7 +880,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();
@@ -975,7 +977,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) {
@@ -1062,6 +1068,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);
}
}
@@ -1124,7 +1131,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));