summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src
diff options
context:
space:
mode:
authorBill Lin <lbill@google.com>2020-02-14 15:08:13 +0800
committerBill Lin <lbill@google.com>2020-02-21 07:46:18 +0000
commit9ae18fa2d9bafbd2df4cfdbf93a9714b90be6b6a (patch)
tree9e3c0b1477132e75123768823e9cbb276a52ca12 /packages/SystemUI/src
parentc1e78426b5632271e501bbc91ace4b8a68ee791e (diff)
downloadbase-9ae18fa2d9bafbd2df4cfdbf93a9714b90be6b6a.tar.gz
DO NOT MERGE Respect rounded.xml size in ScreenDecorations
Suppose vendors will customize rounded.xml with corresponding multiple radius path and size, ScreenDecorations should not resize it by rounded_corner_radius in case jagged edges problem Test: atest SystemUITests Test: atest ScreenDecorationsTest Bug: 145707162 Bug: 148912090 Change-Id: Ie33526214072ad324ca00a10074ad212dfbf4258
Diffstat (limited to 'packages/SystemUI/src')
-rw-r--r--packages/SystemUI/src/com/android/systemui/ScreenDecorations.java24
1 files changed, 18 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
index f38b4f259c88..953e9f54ba28 100644
--- a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
+++ b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
@@ -45,6 +45,7 @@ import android.graphics.Path;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.Region;
+import android.graphics.drawable.VectorDrawable;
import android.hardware.display.DisplayManager;
import android.os.Handler;
import android.os.HandlerThread;
@@ -129,6 +130,7 @@ public class ScreenDecorations extends SystemUI implements Tunable,
private boolean mAssistHintBlocked = false;
private boolean mIsReceivingNavBarColor = false;
private boolean mInGesturalMode;
+ private boolean mIsRoundedCornerMultipleRadius;
/**
* Converts a set of {@link Rect}s into a {@link Region}
@@ -323,6 +325,8 @@ public class ScreenDecorations extends SystemUI implements Tunable,
private void startOnScreenDecorationsThread() {
mRotation = RotationUtils.getExactRotation(mContext);
mWindowManager = mContext.getSystemService(WindowManager.class);
+ mIsRoundedCornerMultipleRadius = mContext.getResources().getBoolean(
+ R.bool.config_roundedCornerMultipleRadius);
updateRoundedCornerRadii();
if (hasRoundedCorners() || shouldDrawCutout() || shouldHostHandles()) {
setupDecorations();
@@ -528,17 +532,24 @@ public class ScreenDecorations extends SystemUI implements Tunable,
com.android.internal.R.dimen.rounded_corner_radius_top);
final int newRoundedDefaultBottom = mContext.getResources().getDimensionPixelSize(
com.android.internal.R.dimen.rounded_corner_radius_bottom);
-
final boolean roundedCornersChanged = mRoundedDefault != newRoundedDefault
|| mRoundedDefaultBottom != newRoundedDefaultBottom
|| mRoundedDefaultTop != newRoundedDefaultTop;
if (roundedCornersChanged) {
- mRoundedDefault = newRoundedDefault;
- mRoundedDefaultTop = newRoundedDefaultTop;
- mRoundedDefaultBottom = newRoundedDefaultBottom;
- onTuningChanged(SIZE, null);
+ // If config_roundedCornerMultipleRadius set as true, ScreenDecorations respect the
+ // max(width, height) size of drawable/rounded.xml instead of rounded_corner_radius
+ if (mIsRoundedCornerMultipleRadius) {
+ final VectorDrawable d = (VectorDrawable) mContext.getDrawable(R.drawable.rounded);
+ mRoundedDefault = Math.max(d.getIntrinsicWidth(), d.getIntrinsicHeight());
+ mRoundedDefaultTop = mRoundedDefaultBottom = mRoundedDefault;
+ } else {
+ mRoundedDefault = newRoundedDefault;
+ mRoundedDefaultTop = newRoundedDefaultTop;
+ mRoundedDefaultBottom = newRoundedDefaultBottom;
+ }
}
+ onTuningChanged(SIZE, null);
}
private void updateViews() {
@@ -637,7 +648,8 @@ public class ScreenDecorations extends SystemUI implements Tunable,
}
private boolean hasRoundedCorners() {
- return mRoundedDefault > 0 || mRoundedDefaultBottom > 0 || mRoundedDefaultTop > 0;
+ return mRoundedDefault > 0 || mRoundedDefaultBottom > 0 || mRoundedDefaultTop > 0
+ || mIsRoundedCornerMultipleRadius;
}
private boolean shouldDrawCutout() {