Merge "Fixed RoundedCorner bugs" into sc-dev
This commit is contained in:
@@ -163,7 +163,7 @@ public final class RoundedCorner implements Parcelable {
|
||||
* @hide
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
return mRadius == 0 || mCenter.x == 0 || mCenter.y == 0;
|
||||
return mRadius == 0 || mCenter.x <= 0 || mCenter.y <= 0;
|
||||
}
|
||||
|
||||
private String getPositionString(@Position int position) {
|
||||
|
||||
@@ -181,16 +181,16 @@ public class RoundedCorners implements Parcelable {
|
||||
boolean hasRoundedCorner;
|
||||
switch (position) {
|
||||
case POSITION_TOP_LEFT:
|
||||
hasRoundedCorner = radius > insetTop || radius > insetLeft;
|
||||
hasRoundedCorner = radius > insetTop && radius > insetLeft;
|
||||
break;
|
||||
case POSITION_TOP_RIGHT:
|
||||
hasRoundedCorner = radius > insetTop || radius > insetRight;
|
||||
hasRoundedCorner = radius > insetTop && radius > insetRight;
|
||||
break;
|
||||
case POSITION_BOTTOM_RIGHT:
|
||||
hasRoundedCorner = radius > insetBottom || radius > insetRight;
|
||||
hasRoundedCorner = radius > insetBottom && radius > insetRight;
|
||||
break;
|
||||
case POSITION_BOTTOM_LEFT:
|
||||
hasRoundedCorner = radius > insetBottom || radius > insetLeft;
|
||||
hasRoundedCorner = radius > insetBottom && radius > insetLeft;
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException(
|
||||
|
||||
@@ -61,6 +61,13 @@ public class RoundedCornerTest {
|
||||
assertThat(roundedCorner.isEmpty(), is(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsEmpty_negativeCenter() {
|
||||
RoundedCorner roundedCorner =
|
||||
new RoundedCorner(RoundedCorner.POSITION_BOTTOM_LEFT, 1, -2, -3);
|
||||
assertThat(roundedCorner.isEmpty(), is(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEquals() {
|
||||
RoundedCorner roundedCorner = new RoundedCorner(
|
||||
|
||||
@@ -1862,6 +1862,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
// Update application display metrics.
|
||||
final WmDisplayCutout wmDisplayCutout = calculateDisplayCutoutForRotation(rotation);
|
||||
final DisplayCutout displayCutout = wmDisplayCutout.getDisplayCutout();
|
||||
final RoundedCorners roundedCorners = calculateRoundedCornersForRotation(rotation);
|
||||
|
||||
final int appWidth = mDisplayPolicy.getNonDecorDisplayWidth(dw, dh, rotation, uiMode,
|
||||
displayCutout);
|
||||
@@ -1878,6 +1879,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO, null);
|
||||
}
|
||||
mDisplayInfo.displayCutout = displayCutout.isEmpty() ? null : displayCutout;
|
||||
mDisplayInfo.roundedCorners = roundedCorners;
|
||||
mDisplayInfo.getAppMetrics(mDisplayMetrics);
|
||||
if (mDisplayScalingDisabled) {
|
||||
mDisplayInfo.flags |= Display.FLAG_SCALING_DISABLED;
|
||||
|
||||
Reference in New Issue
Block a user