Remove outdated display bounds calculation
Since the display info computed by updateDisplayAndOrientation will be sent to setDisplayInfoOverrideFromWindowManager, the logicalWidth and logicalHeight are already the same as the configuration bounds. So the removed code (mainly from commit 338374) are almost no-op or just produce a wrong intermediate state and will be replaced with correct value immediately. Bug: 163976519 Test: CtsActivityManagerDeviceTestCases Change-Id: I3a4e9d9e0f86a4ba8e075ea3ea3dcfb7c59b5605
This commit is contained in:
@@ -457,8 +457,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
*/
|
||||
private boolean mLastWallpaperVisible = false;
|
||||
|
||||
private Rect mBaseDisplayRect = new Rect();
|
||||
|
||||
// Accessed directly by all users.
|
||||
private boolean mLayoutNeeded;
|
||||
int pendingLayoutChanges;
|
||||
@@ -488,9 +486,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
private final Rect mTmpRect2 = new Rect();
|
||||
private final Region mTmpRegion = new Region();
|
||||
|
||||
/** Used for handing back size of display */
|
||||
private final Rect mTmpBounds = new Rect();
|
||||
|
||||
private final Configuration mTmpConfiguration = new Configuration();
|
||||
|
||||
/** Remove this display when animation on it has completed. */
|
||||
@@ -2080,8 +2075,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
mWmService.mDisplayManagerInternal.setDisplayInfoOverrideFromWindowManager(mDisplayId,
|
||||
mDisplayInfo);
|
||||
|
||||
mBaseDisplayRect.set(0, 0, dw, dh);
|
||||
|
||||
if (isDefaultDisplay) {
|
||||
mCompatibleScreenScale = CompatibilityInfo.computeCompatibleScaling(mDisplayMetrics,
|
||||
mCompatDisplayMetrics);
|
||||
@@ -2213,14 +2206,14 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
*/
|
||||
void computeScreenConfiguration(Configuration config) {
|
||||
final DisplayInfo displayInfo = updateDisplayAndOrientation(config.uiMode, config);
|
||||
calculateBounds(displayInfo, mTmpBounds);
|
||||
config.windowConfiguration.setBounds(mTmpBounds);
|
||||
config.windowConfiguration.setMaxBounds(mTmpBounds);
|
||||
final int dw = displayInfo.logicalWidth;
|
||||
final int dh = displayInfo.logicalHeight;
|
||||
mTmpRect.set(0, 0, dw, dh);
|
||||
config.windowConfiguration.setBounds(mTmpRect);
|
||||
config.windowConfiguration.setMaxBounds(mTmpRect);
|
||||
config.windowConfiguration.setWindowingMode(getWindowingMode());
|
||||
config.windowConfiguration.setDisplayWindowingMode(getWindowingMode());
|
||||
|
||||
final int dw = displayInfo.logicalWidth;
|
||||
final int dh = displayInfo.logicalHeight;
|
||||
computeScreenAppConfiguration(config, dw, dh, displayInfo.rotation, config.uiMode,
|
||||
displayInfo.displayCutout);
|
||||
|
||||
@@ -2844,10 +2837,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
|
||||
/** Update base (override) display metrics. */
|
||||
void updateBaseDisplayMetrics(int baseWidth, int baseHeight, int baseDensity) {
|
||||
final int originalWidth = mBaseDisplayWidth;
|
||||
final int originalHeight = mBaseDisplayHeight;
|
||||
final int originalDensity = mBaseDisplayDensity;
|
||||
|
||||
mBaseDisplayWidth = baseWidth;
|
||||
mBaseDisplayHeight = baseHeight;
|
||||
mBaseDisplayDensity = baseDensity;
|
||||
@@ -2867,12 +2856,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
+ mBaseDisplayHeight + " on display:" + getDisplayId());
|
||||
}
|
||||
}
|
||||
|
||||
if (mBaseDisplayWidth != originalWidth || mBaseDisplayHeight != originalHeight
|
||||
|| mBaseDisplayDensity != originalDensity) {
|
||||
mBaseDisplayRect.set(0, 0, mBaseDisplayWidth, mBaseDisplayHeight);
|
||||
updateBounds();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3021,7 +3004,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
if (focusedTask == null) {
|
||||
mTouchExcludeRegion.setEmpty();
|
||||
} else {
|
||||
mTouchExcludeRegion.set(mBaseDisplayRect);
|
||||
mTouchExcludeRegion.set(0, 0, mDisplayInfo.logicalWidth, mDisplayInfo.logicalHeight);
|
||||
final int delta = dipToPixel(RESIZE_HANDLE_WIDTH_IN_DP, mDisplayMetrics);
|
||||
mTmpRect.setEmpty();
|
||||
mTmpRect2.setEmpty();
|
||||
@@ -4587,25 +4570,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
}
|
||||
}
|
||||
|
||||
private void updateBounds() {
|
||||
calculateBounds(mDisplayInfo, mTmpBounds);
|
||||
setBounds(mTmpBounds);
|
||||
}
|
||||
|
||||
// Determines the current display bounds based on the current state
|
||||
private void calculateBounds(DisplayInfo displayInfo, Rect out) {
|
||||
// Uses same calculation as in LogicalDisplay#configureDisplayInTransactionLocked.
|
||||
final int rotation = displayInfo.rotation;
|
||||
boolean rotated = (rotation == ROTATION_90 || rotation == ROTATION_270);
|
||||
final int physWidth = rotated ? mBaseDisplayHeight : mBaseDisplayWidth;
|
||||
final int physHeight = rotated ? mBaseDisplayWidth : mBaseDisplayHeight;
|
||||
int width = displayInfo.logicalWidth;
|
||||
int left = (physWidth - width) / 2;
|
||||
int height = displayInfo.logicalHeight;
|
||||
int top = (physHeight - height) / 2;
|
||||
out.set(left, top, left + width, top + height);
|
||||
}
|
||||
|
||||
private void getBounds(Rect out, @Rotation int rotation) {
|
||||
getBounds(out);
|
||||
|
||||
@@ -5561,8 +5525,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
}
|
||||
|
||||
void onDisplayChanged() {
|
||||
mDisplay.getRealSize(mTmpDisplaySize);
|
||||
setBounds(0, 0, mTmpDisplaySize.x, mTmpDisplaySize.y);
|
||||
final int lastDisplayState = mDisplayInfo.state;
|
||||
updateDisplayInfo();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user