Fix issue with camera overlapping split staging UI

Fixes an issue on some devices where initiating a split in Overview would cause an icon to be placed partly under the camera cutout.

Fixed by adding some padding to FloatingTaskView#mSplitPlaceHolderView, so that it always respects the device's insets.

Fixes: 220997064
Test: Manual
Change-Id: I7270bde3320f562519ea8e36a38e49609e0d6cd7
This commit is contained in:
Jeremy Sim
2022-03-21 19:55:07 -07:00
parent da297fb0f1
commit b8eeb41ee0
5 changed files with 90 additions and 17 deletions
@@ -440,7 +440,14 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
DeviceProfile dp, @StagePosition int stagePosition, Rect out) {
int screenWidth = dp.widthPx;
int screenHeight = dp.heightPx;
out.set(0, 0, screenWidth, placeholderHeight);
boolean pinToRight = stagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT;
int insetThickness;
if (!dp.isLandscape) {
insetThickness = dp.getInsets().top;
} else {
insetThickness = pinToRight ? dp.getInsets().right : dp.getInsets().left;
}
out.set(0, 0, screenWidth, placeholderHeight + insetThickness);
if (!dp.isLandscape) {
// portrait, phone or tablet - spans width of screen, nothing else to do
out.inset(placeholderInset, 0);
@@ -454,7 +461,6 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
}
// Now we rotate the portrait rect depending on what side we want pinned
boolean pinToRight = stagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT;
float postRotateScale = (float) screenHeight / screenWidth;
mTmpMatrix.reset();
@@ -480,6 +486,33 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
}
}
@Override
public void updateStagedSplitIconParams(FrameLayout.LayoutParams out, float onScreenRectCenterX,
float onScreenRectCenterY, float fullscreenScaleX, float fullscreenScaleY,
int drawableWidth, int drawableHeight, DeviceProfile dp,
@StagePosition int stagePosition) {
boolean pinToRight = stagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT;
if (!dp.isLandscape) {
float inset = dp.getInsets().top;
out.leftMargin = Math.round(onScreenRectCenterX / fullscreenScaleX
- 1.0f * drawableWidth / 2);
out.topMargin = Math.round((onScreenRectCenterY + (inset / 2f)) / fullscreenScaleY
- 1.0f * drawableHeight / 2);
} else {
if (pinToRight) {
float inset = dp.getInsets().right;
out.leftMargin = Math.round((onScreenRectCenterX - (inset / 2f)) / fullscreenScaleX
- 1.0f * drawableWidth / 2);
} else {
float inset = dp.getInsets().left;
out.leftMargin = Math.round((onScreenRectCenterX + (inset / 2f)) / fullscreenScaleX
- 1.0f * drawableWidth / 2);
}
out.topMargin = Math.round(onScreenRectCenterY / fullscreenScaleY
- 1.0f * drawableHeight / 2);
}
}
@Override
public void getFinalSplitPlaceholderBounds(int splitDividerSize, DeviceProfile dp,
@StagePosition int stagePosition, Rect out1, Rect out2) {