Merge "Revert "Update display contents when metrics change""
This commit is contained in:
committed by
Android (Google) Code Review
commit
2ce1160ed6
@@ -261,7 +261,6 @@ final class LogicalDisplay {
|
||||
|
||||
mPrimaryDisplayDeviceInfo = deviceInfo;
|
||||
mInfo = null;
|
||||
mOverrideDisplayInfo = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -919,10 +919,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
||||
void updateDisplayInfo() {
|
||||
mDisplay.getDisplayInfo(mDisplayInfo);
|
||||
mDisplay.getMetrics(mDisplayMetrics);
|
||||
|
||||
// Check if display metrics changed and update base values if needed.
|
||||
updateBaseDisplayMetricsIfNeeded();
|
||||
|
||||
for (int i = mTaskStackContainers.size() - 1; i >= 0; --i) {
|
||||
mTaskStackContainers.get(i).updateDisplayInfo(null);
|
||||
}
|
||||
@@ -938,8 +934,10 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
||||
}
|
||||
}
|
||||
|
||||
updateBaseDisplayMetrics(mDisplayInfo.logicalWidth, mDisplayInfo.logicalHeight,
|
||||
mDisplayInfo.logicalDensityDpi);
|
||||
mBaseDisplayWidth = mInitialDisplayWidth = mDisplayInfo.logicalWidth;
|
||||
mBaseDisplayHeight = mInitialDisplayHeight = mDisplayInfo.logicalHeight;
|
||||
mBaseDisplayDensity = mInitialDisplayDensity = mDisplayInfo.logicalDensityDpi;
|
||||
mBaseDisplayRect.set(0, 0, mBaseDisplayWidth, mBaseDisplayHeight);
|
||||
}
|
||||
|
||||
void getLogicalDisplayRect(Rect out) {
|
||||
@@ -969,30 +967,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
||||
}
|
||||
}
|
||||
|
||||
/** If display metrics changed and it's not just a rotation - update base values. */
|
||||
private void updateBaseDisplayMetricsIfNeeded() {
|
||||
final int orientation = mDisplayInfo.rotation;
|
||||
final boolean rotated = (orientation == ROTATION_90 || orientation == ROTATION_270);
|
||||
final int newWidth = rotated ? mDisplayInfo.logicalHeight : mDisplayInfo.logicalWidth;
|
||||
final int newHeight = rotated ? mDisplayInfo.logicalWidth : mDisplayInfo.logicalHeight;
|
||||
|
||||
boolean displayMetricsChanged
|
||||
= mBaseDisplayWidth != newWidth || mBaseDisplayHeight != newHeight;
|
||||
displayMetricsChanged |= mBaseDisplayDensity != mDisplayInfo.logicalDensityDpi;
|
||||
|
||||
if (displayMetricsChanged) {
|
||||
updateBaseDisplayMetrics(newWidth, newHeight, mDisplayInfo.logicalDensityDpi);
|
||||
mService.reconfigureDisplayLocked(this);
|
||||
}
|
||||
}
|
||||
|
||||
void updateBaseDisplayMetrics(int baseWidth, int baseHeight, int baseDensity) {
|
||||
mBaseDisplayWidth = mInitialDisplayWidth = baseWidth;
|
||||
mBaseDisplayHeight = mInitialDisplayHeight = baseHeight;
|
||||
mBaseDisplayDensity = mInitialDisplayDensity = baseDensity;
|
||||
mBaseDisplayRect.set(0, 0, mBaseDisplayWidth, mBaseDisplayHeight);
|
||||
}
|
||||
|
||||
void getContentRect(Rect out) {
|
||||
out.set(mContentRect);
|
||||
}
|
||||
|
||||
@@ -5888,8 +5888,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
if (displayContent.mBaseDisplayWidth != width
|
||||
|| displayContent.mBaseDisplayHeight != height) {
|
||||
Slog.i(TAG_WM, "FORCED DISPLAY SIZE: " + width + "x" + height);
|
||||
displayContent.updateBaseDisplayMetrics(width, height,
|
||||
displayContent.mBaseDisplayDensity);
|
||||
displayContent.mBaseDisplayWidth = width;
|
||||
displayContent.mBaseDisplayHeight = height;
|
||||
}
|
||||
} catch (NumberFormatException ex) {
|
||||
}
|
||||
@@ -5914,7 +5914,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
// displayContent must not be null
|
||||
private void setForcedDisplaySizeLocked(DisplayContent displayContent, int width, int height) {
|
||||
Slog.i(TAG_WM, "Using new display size: " + width + "x" + height);
|
||||
displayContent.updateBaseDisplayMetrics(width, height, displayContent.mBaseDisplayDensity);
|
||||
displayContent.mBaseDisplayWidth = width;
|
||||
displayContent.mBaseDisplayHeight = height;
|
||||
reconfigureDisplayLocked(displayContent);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user