Merge "Count letterbox into non-magnified bounds"

This commit is contained in:
TreeHugger Robot
2019-03-12 04:39:34 +00:00
committed by Android (Google) Code Review

View File

@@ -607,6 +607,13 @@ final class AccessibilityController {
availableBounds.op(windowBounds, Region.Op.DIFFERENCE);
}
// Count letterbox into nonMagnifiedBounds
if (windowState.isLetterboxedForDisplayCutoutLw()) {
Region letterboxBounds = getLetterboxBounds(windowState);
nonMagnifiedBounds.op(letterboxBounds, Region.Op.UNION);
availableBounds.op(letterboxBounds, Region.Op.DIFFERENCE);
}
// Update accounted bounds
Region accountedBounds = mTempRegion2;
accountedBounds.set(mMagnificationRegion);
@@ -658,6 +665,25 @@ final class AccessibilityController {
}
}
private Region getLetterboxBounds(WindowState windowState) {
final AppWindowToken appToken = windowState.mAppToken;
if (appToken == null) {
return new Region();
}
mDisplay.getRealSize(mTempPoint);
final Rect letterboxInsets = appToken.getLetterboxInsets();
final int screenWidth = mTempPoint.x;
final int screenHeight = mTempPoint.y;
final Rect nonLetterboxRect = mTempRect1;
final Region letterboxBounds = mTempRegion3;
nonLetterboxRect.set(0, 0, screenWidth, screenHeight);
nonLetterboxRect.inset(letterboxInsets);
letterboxBounds.set(0, 0, screenWidth, screenHeight);
letterboxBounds.op(nonLetterboxRect, Region.Op.DIFFERENCE);
return letterboxBounds;
}
public void onRotationChangedLocked() {
// If we are showing the magnification border, hide it immediately so
// the user does not see strange artifacts during rotation. The screenshot