Fix issue with split thumbnails overflowing during rotation

Fixes a set of issues in Overview where you could cause split thumbnails to overflow their contents into each other by rotating the phone in certain ways.

The issue occurred because StagedSplitBounds objects have their height and width assigned differently depending on if they were created while the phone was in portrait or landscape.

Fixed by adding a conditional check in PortraitPagedViewHandler#setSplitTaskSwipeRect and LandscapePagedViewHandler#setSplitTaskSwipeRect.

Fixes: 218784856
Fixes: 218779313

Test: Manual on local devices
Change-Id: I04b4f4344250da34616ab1744af22fa41b9aba9b
(cherry picked from commit 1d6b7f2abf)
This commit is contained in:
Jeremy Sim
2022-03-14 18:25:47 -07:00
parent f1543cb520
commit bf6f171f84
2 changed files with 20 additions and 12 deletions

View File

@@ -414,14 +414,17 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
@Override
public void setSplitTaskSwipeRect(DeviceProfile dp, Rect outRect,
StagedSplitBounds splitInfo, int desiredStagePosition) {
float diff;
float horizontalDividerDiff = splitInfo.visualDividerBounds.width() / 2f;
float topLeftTaskPercent = splitInfo.appsStackedVertically
? splitInfo.topTaskPercent
: splitInfo.leftTaskPercent;
float dividerBarPercent = splitInfo.appsStackedVertically
? splitInfo.dividerHeightPercent
: splitInfo.dividerWidthPercent;
if (desiredStagePosition == SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT) {
diff = outRect.height() * (1f - splitInfo.leftTaskPercent) + horizontalDividerDiff;
outRect.bottom -= diff;
outRect.bottom = outRect.top + (int) (outRect.height() * topLeftTaskPercent);
} else {
diff = outRect.height() * splitInfo.leftTaskPercent + horizontalDividerDiff;
outRect.top += diff;
outRect.top += (int) (outRect.height() * (topLeftTaskPercent + dividerBarPercent));
}
}