Merge "ScreenDecor: Fix cutout overlay regression" into qt-dev
This commit is contained in:
@@ -911,6 +911,7 @@ public class ScreenDecorations extends SystemUI implements Tunable,
|
|||||||
if (shouldDrawCutout(getContext()) && hasCutout()) {
|
if (shouldDrawCutout(getContext()) && hasCutout()) {
|
||||||
mBounds.addAll(mInfo.displayCutout.getBoundingRects());
|
mBounds.addAll(mInfo.displayCutout.getBoundingRects());
|
||||||
localBounds(mBoundingRect);
|
localBounds(mBoundingRect);
|
||||||
|
updateGravity();
|
||||||
updateBoundingPath();
|
updateBoundingPath();
|
||||||
invalidate();
|
invalidate();
|
||||||
newVisible = VISIBLE;
|
newVisible = VISIBLE;
|
||||||
@@ -961,6 +962,18 @@ public class ScreenDecorations extends SystemUI implements Tunable,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateGravity() {
|
||||||
|
LayoutParams lp = getLayoutParams();
|
||||||
|
if (lp instanceof FrameLayout.LayoutParams) {
|
||||||
|
FrameLayout.LayoutParams flp = (FrameLayout.LayoutParams) lp;
|
||||||
|
int newGravity = getGravity(mInfo.displayCutout);
|
||||||
|
if (flp.gravity != newGravity) {
|
||||||
|
flp.gravity = newGravity;
|
||||||
|
setLayoutParams(flp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean hasCutout() {
|
private boolean hasCutout() {
|
||||||
final DisplayCutout displayCutout = mInfo.displayCutout;
|
final DisplayCutout displayCutout = mInfo.displayCutout;
|
||||||
if (displayCutout == null) {
|
if (displayCutout == null) {
|
||||||
@@ -1007,21 +1020,25 @@ public class ScreenDecorations extends SystemUI implements Tunable,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void localBounds(Rect out) {
|
private void localBounds(Rect out) {
|
||||||
final DisplayCutout displayCutout = mInfo.displayCutout;
|
DisplayCutout displayCutout = mInfo.displayCutout;
|
||||||
|
boundsFromDirection(displayCutout, getGravity(displayCutout), out);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getGravity(DisplayCutout displayCutout) {
|
||||||
if (mStart) {
|
if (mStart) {
|
||||||
if (displayCutout.getSafeInsetLeft() > 0) {
|
if (displayCutout.getSafeInsetLeft() > 0) {
|
||||||
boundsFromDirection(displayCutout, Gravity.LEFT, out);
|
return Gravity.LEFT;
|
||||||
} else if (displayCutout.getSafeInsetTop() > 0) {
|
} else if (displayCutout.getSafeInsetTop() > 0) {
|
||||||
boundsFromDirection(displayCutout, Gravity.TOP, out);
|
return Gravity.TOP;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (displayCutout.getSafeInsetRight() > 0) {
|
if (displayCutout.getSafeInsetRight() > 0) {
|
||||||
boundsFromDirection(displayCutout, Gravity.RIGHT, out);
|
return Gravity.RIGHT;
|
||||||
} else if (displayCutout.getSafeInsetBottom() > 0) {
|
} else if (displayCutout.getSafeInsetBottom() > 0) {
|
||||||
boundsFromDirection(displayCutout, Gravity.BOTTOM, out);
|
return Gravity.BOTTOM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return Gravity.NO_GRAVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user