Merge "Initialize DisplayContent base info when object is constructed" into cw-e-dev

This commit is contained in:
Filip Gruszczynski
2015-11-13 17:15:14 +00:00
committed by Android (Google) Code Review
2 changed files with 17 additions and 16 deletions

View File

@@ -116,6 +116,7 @@ class DisplayContent {
display.getDisplayInfo(mDisplayInfo);
isDefaultDisplay = mDisplayId == Display.DEFAULT_DISPLAY;
mService = service;
initializeDisplayBaseInfo();
}
int getDisplayId() {
@@ -176,6 +177,21 @@ class DisplayContent {
}
}
void initializeDisplayBaseInfo() {
synchronized(mDisplaySizeLock) {
// Bootstrap the default logical display from the display manager.
final DisplayInfo newDisplayInfo =
mService.mDisplayManagerInternal.getDisplayInfo(mDisplayId);
if (newDisplayInfo != null) {
mDisplayInfo.copyFrom(newDisplayInfo);
}
mBaseDisplayWidth = mInitialDisplayWidth = mDisplayInfo.logicalWidth;
mBaseDisplayHeight = mInitialDisplayHeight = mDisplayInfo.logicalHeight;
mBaseDisplayDensity = mInitialDisplayDensity = mDisplayInfo.logicalDensityDpi;
mBaseDisplayRect.set(0, 0, mBaseDisplayWidth, mBaseDisplayHeight);
}
}
void getLogicalDisplayRect(Rect out) {
// Uses same calculation as in LogicalDisplay#configureDisplayInTransactionLocked.
final int orientation = mDisplayInfo.rotation;

View File

@@ -7670,22 +7670,7 @@ public class WindowManagerService extends IWindowManager.Stub
final DisplayContent displayContent = getDisplayContentLocked(displayId);
if (displayContent != null) {
mAnimator.addDisplayLocked(displayId);
synchronized(displayContent.mDisplaySizeLock) {
// Bootstrap the default logical display from the display manager.
final DisplayInfo displayInfo = displayContent.getDisplayInfo();
DisplayInfo newDisplayInfo = mDisplayManagerInternal.getDisplayInfo(displayId);
if (newDisplayInfo != null) {
displayInfo.copyFrom(newDisplayInfo);
}
displayContent.mInitialDisplayWidth = displayInfo.logicalWidth;
displayContent.mInitialDisplayHeight = displayInfo.logicalHeight;
displayContent.mInitialDisplayDensity = displayInfo.logicalDensityDpi;
displayContent.mBaseDisplayWidth = displayContent.mInitialDisplayWidth;
displayContent.mBaseDisplayHeight = displayContent.mInitialDisplayHeight;
displayContent.mBaseDisplayDensity = displayContent.mInitialDisplayDensity;
displayContent.mBaseDisplayRect.set(0, 0,
displayContent.mBaseDisplayWidth, displayContent.mBaseDisplayHeight);
}
displayContent.initializeDisplayBaseInfo();
}
}
}