[DO NOT MERGE] Revert "PossibleMaximumWindowMetrics reports physical display insets for each"
This reverts commit a77d7425a4.
Reason for revert: remove from sc-v2
Test: manual
Bug: 206649452
Change-Id: I461e6cec8ff2a14a57cf019861da2babd82d0a2a
This commit is contained in:
@@ -352,11 +352,25 @@ public final class WindowManagerImpl implements WindowManager {
|
|||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<WindowMetrics> maxMetrics = new HashSet<>();
|
int size = possibleDisplayInfos.size();
|
||||||
WindowInsets windowInsets;
|
|
||||||
DisplayInfo currentDisplayInfo;
|
DisplayInfo currentDisplayInfo;
|
||||||
|
WindowInsets windowInsets = null;
|
||||||
|
if (size > 0) {
|
||||||
|
currentDisplayInfo = possibleDisplayInfos.get(0);
|
||||||
|
|
||||||
final WindowManager.LayoutParams params = new WindowManager.LayoutParams();
|
final WindowManager.LayoutParams params = new WindowManager.LayoutParams();
|
||||||
for (int i = 0; i < possibleDisplayInfos.size(); i++) {
|
final boolean isScreenRound = (currentDisplayInfo.flags & Display.FLAG_ROUND) != 0;
|
||||||
|
// TODO(181127261) not computing insets correctly - need to have underlying
|
||||||
|
// frame reflect the faked orientation.
|
||||||
|
windowInsets = getWindowInsetsFromServerForDisplay(
|
||||||
|
currentDisplayInfo.displayId, params,
|
||||||
|
new Rect(0, 0, currentDisplayInfo.getNaturalWidth(),
|
||||||
|
currentDisplayInfo.getNaturalHeight()), isScreenRound,
|
||||||
|
WINDOWING_MODE_FULLSCREEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
Set<WindowMetrics> maxMetrics = new HashSet<>();
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
currentDisplayInfo = possibleDisplayInfos.get(i);
|
currentDisplayInfo = possibleDisplayInfos.get(i);
|
||||||
|
|
||||||
// Calculate max bounds for this rotation and state.
|
// Calculate max bounds for this rotation and state.
|
||||||
@@ -364,18 +378,7 @@ public final class WindowManagerImpl implements WindowManager {
|
|||||||
currentDisplayInfo.logicalHeight);
|
currentDisplayInfo.logicalHeight);
|
||||||
|
|
||||||
// Calculate insets for the rotated max bounds.
|
// Calculate insets for the rotated max bounds.
|
||||||
final boolean isScreenRound = (currentDisplayInfo.flags & Display.FLAG_ROUND) != 0;
|
// TODO(181127261) calculate insets for each display rotation and state.
|
||||||
// Initialize insets based upon display rotation. Note any window-provided insets
|
|
||||||
// will not be set.
|
|
||||||
windowInsets = getWindowInsetsFromServerForDisplay(
|
|
||||||
currentDisplayInfo.displayId, params,
|
|
||||||
new Rect(0, 0, currentDisplayInfo.getNaturalWidth(),
|
|
||||||
currentDisplayInfo.getNaturalHeight()), isScreenRound,
|
|
||||||
WINDOWING_MODE_FULLSCREEN);
|
|
||||||
// Set the hardware-provided insets.
|
|
||||||
windowInsets = new WindowInsets.Builder(windowInsets).setRoundedCorners(
|
|
||||||
currentDisplayInfo.roundedCorners)
|
|
||||||
.setDisplayCutout(currentDisplayInfo.displayCutout).build();
|
|
||||||
|
|
||||||
maxMetrics.add(new WindowMetrics(maxBounds, windowInsets));
|
maxMetrics.add(new WindowMetrics(maxBounds, windowInsets));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -591,7 +591,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
|||||||
/** Caches the value whether told display manager that we have content. */
|
/** Caches the value whether told display manager that we have content. */
|
||||||
private boolean mLastHasContent;
|
private boolean mLastHasContent;
|
||||||
|
|
||||||
private static DisplayRotationUtil sRotationUtil = new DisplayRotationUtil();
|
private DisplayRotationUtil mRotationUtil = new DisplayRotationUtil();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The input method window for this display.
|
* The input method window for this display.
|
||||||
@@ -2090,35 +2090,29 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
|||||||
return mDisplayCutoutCache.getOrCompute(mInitialDisplayCutout, rotation);
|
return mDisplayCutoutCache.getOrCompute(mInitialDisplayCutout, rotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
static WmDisplayCutout calculateDisplayCutoutForRotationAndDisplaySizeUncached(
|
private WmDisplayCutout calculateDisplayCutoutForRotationUncached(
|
||||||
DisplayCutout cutout, int rotation, int displayWidth, int displayHeight) {
|
DisplayCutout cutout, int rotation) {
|
||||||
if (cutout == null || cutout == DisplayCutout.NO_CUTOUT) {
|
if (cutout == null || cutout == DisplayCutout.NO_CUTOUT) {
|
||||||
return WmDisplayCutout.NO_CUTOUT;
|
return WmDisplayCutout.NO_CUTOUT;
|
||||||
}
|
}
|
||||||
if (rotation == ROTATION_0) {
|
if (rotation == ROTATION_0) {
|
||||||
return WmDisplayCutout.computeSafeInsets(
|
return WmDisplayCutout.computeSafeInsets(
|
||||||
cutout, displayWidth, displayHeight);
|
cutout, mInitialDisplayWidth, mInitialDisplayHeight);
|
||||||
}
|
}
|
||||||
final Insets waterfallInsets =
|
final Insets waterfallInsets =
|
||||||
RotationUtils.rotateInsets(cutout.getWaterfallInsets(), rotation);
|
RotationUtils.rotateInsets(cutout.getWaterfallInsets(), rotation);
|
||||||
final boolean rotated = (rotation == ROTATION_90 || rotation == ROTATION_270);
|
final boolean rotated = (rotation == ROTATION_90 || rotation == ROTATION_270);
|
||||||
final Rect[] newBounds = sRotationUtil.getRotatedBounds(
|
final Rect[] newBounds = mRotationUtil.getRotatedBounds(
|
||||||
cutout.getBoundingRectsAll(),
|
cutout.getBoundingRectsAll(),
|
||||||
rotation, displayWidth, displayHeight);
|
rotation, mInitialDisplayWidth, mInitialDisplayHeight);
|
||||||
final CutoutPathParserInfo info = cutout.getCutoutPathParserInfo();
|
final CutoutPathParserInfo info = cutout.getCutoutPathParserInfo();
|
||||||
final CutoutPathParserInfo newInfo = new CutoutPathParserInfo(
|
final CutoutPathParserInfo newInfo = new CutoutPathParserInfo(
|
||||||
info.getDisplayWidth(), info.getDisplayHeight(), info.getDensity(),
|
info.getDisplayWidth(), info.getDisplayHeight(), info.getDensity(),
|
||||||
info.getCutoutSpec(), rotation, info.getScale());
|
info.getCutoutSpec(), rotation, info.getScale());
|
||||||
return WmDisplayCutout.computeSafeInsets(
|
return WmDisplayCutout.computeSafeInsets(
|
||||||
DisplayCutout.constructDisplayCutout(newBounds, waterfallInsets, newInfo),
|
DisplayCutout.constructDisplayCutout(newBounds, waterfallInsets, newInfo),
|
||||||
rotated ? displayHeight : displayWidth,
|
rotated ? mInitialDisplayHeight : mInitialDisplayWidth,
|
||||||
rotated ? displayWidth : displayHeight);
|
rotated ? mInitialDisplayWidth : mInitialDisplayHeight);
|
||||||
}
|
|
||||||
|
|
||||||
private WmDisplayCutout calculateDisplayCutoutForRotationUncached(
|
|
||||||
DisplayCutout cutout, int rotation) {
|
|
||||||
return calculateDisplayCutoutForRotationAndDisplaySizeUncached(cutout, rotation,
|
|
||||||
mInitialDisplayWidth, mInitialDisplayHeight);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RoundedCorners calculateRoundedCornersForRotation(int rotation) {
|
RoundedCorners calculateRoundedCornersForRotation(int rotation) {
|
||||||
|
|||||||
@@ -120,15 +120,8 @@ public class PossibleDisplayInfoMapper {
|
|||||||
@Surface.Rotation int rotation) {
|
@Surface.Rotation int rotation) {
|
||||||
DisplayInfo updatedDisplayInfo = new DisplayInfo();
|
DisplayInfo updatedDisplayInfo = new DisplayInfo();
|
||||||
updatedDisplayInfo.copyFrom(displayInfo);
|
updatedDisplayInfo.copyFrom(displayInfo);
|
||||||
// Apply rotations before updating width and height
|
|
||||||
updatedDisplayInfo.roundedCorners = updatedDisplayInfo.roundedCorners.rotate(rotation,
|
|
||||||
updatedDisplayInfo.logicalWidth, updatedDisplayInfo.logicalHeight);
|
|
||||||
updatedDisplayInfo.displayCutout =
|
|
||||||
DisplayContent.calculateDisplayCutoutForRotationAndDisplaySizeUncached(
|
|
||||||
updatedDisplayInfo.displayCutout, rotation, updatedDisplayInfo.logicalWidth,
|
|
||||||
updatedDisplayInfo.logicalHeight).getDisplayCutout();
|
|
||||||
|
|
||||||
updatedDisplayInfo.rotation = rotation;
|
updatedDisplayInfo.rotation = rotation;
|
||||||
|
|
||||||
final int naturalWidth = updatedDisplayInfo.getNaturalWidth();
|
final int naturalWidth = updatedDisplayInfo.getNaturalWidth();
|
||||||
final int naturalHeight = updatedDisplayInfo.getNaturalHeight();
|
final int naturalHeight = updatedDisplayInfo.getNaturalHeight();
|
||||||
updatedDisplayInfo.logicalWidth = naturalWidth;
|
updatedDisplayInfo.logicalWidth = naturalWidth;
|
||||||
|
|||||||
Reference in New Issue
Block a user