* to the display information synchronously so that applications will immediately
* observe the new state.
*
+ * NOTE: This method must be the only entry point by which the window manager
+ * influences the logical configuration of displays.
+ *
* @param displayId The logical display id.
* @param info The new data to be stored.
*/
synchronized (mSyncRoot) {
LogicalDisplay display = mLogicalDisplays.get(displayId);
if (display != null) {
- mTempDisplayInfo.copyFrom(display.getDisplayInfoLocked());
- display.setDisplayInfoOverrideFromWindowManagerLocked(info);
- if (!mTempDisplayInfo.equals(display.getDisplayInfoLocked())) {
+ if (display.setDisplayInfoOverrideFromWindowManagerLocked(info)) {
sendDisplayEventLocked(displayId, DisplayManagerGlobal.EVENT_DISPLAY_CHANGED);
scheduleTraversalLocked(false);
}
}
/**
- * Sets the overscan insets for a particular display.
- */
- public void setOverscan(int displayId, int left, int top, int right, int bottom) {
- synchronized (mSyncRoot) {
- LogicalDisplay display = mLogicalDisplays.get(displayId);
- if (display != null) {
- display.setOverscan(left, top, right, bottom);
- }
- }
- }
-
- /**
* Called by the window manager to perform traversals while holding a
* surface flinger transaction.
*/
synchronized(mWindowMap) {
mIsTouchDevice = mContext.getPackageManager().hasSystemFeature(
PackageManager.FEATURE_TOUCHSCREEN);
-
- final DisplayContent displayContent = getDefaultDisplayContentLocked();
- mPolicy.setInitialDisplaySize(displayContent.getDisplay(),
- displayContent.mInitialDisplayWidth,
- displayContent.mInitialDisplayHeight,
- displayContent.mInitialDisplayDensity);
+ configureDisplayPolicyLocked(getDefaultDisplayContentLocked());
}
try {
// displayContent must not be null
private void reconfigureDisplayLocked(DisplayContent displayContent) {
// TODO: Multidisplay: for now only use with default display.
- mPolicy.setInitialDisplaySize(displayContent.getDisplay(),
- displayContent.mBaseDisplayWidth,
- displayContent.mBaseDisplayHeight,
- displayContent.mBaseDisplayDensity);
-
+ configureDisplayPolicyLocked(displayContent);
displayContent.layoutNeeded = true;
boolean configChanged = updateOrientationFromAppTokensLocked(false);
performLayoutAndPlaceSurfacesLocked();
}
+ private void configureDisplayPolicyLocked(DisplayContent displayContent) {
+ mPolicy.setInitialDisplaySize(displayContent.getDisplay(),
+ displayContent.mBaseDisplayWidth,
+ displayContent.mBaseDisplayHeight,
+ displayContent.mBaseDisplayDensity);
+
+ DisplayInfo displayInfo = displayContent.getDisplayInfo();
+ mPolicy.setDisplayOverscan(displayContent.getDisplay(),
+ displayInfo.overscanLeft, displayInfo.overscanTop,
+ displayInfo.overscanRight, displayInfo.overscanBottom);
+ }
+
@Override
public void setOverscan(int displayId, int left, int top, int right, int bottom) {
if (mContext.checkCallingOrSelfPermission(
synchronized(mWindowMap) {
DisplayContent displayContent = getDisplayContentLocked(displayId);
if (displayContent != null) {
- mDisplayManagerService.setOverscan(displayId, left, top, right, bottom);
- final DisplayInfo displayInfo = displayContent.getDisplayInfo();
- synchronized(displayContent.mDisplaySizeLock) {
- displayInfo.overscanLeft = left;
- displayInfo.overscanTop = top;
- displayInfo.overscanRight = right;
- displayInfo.overscanBottom = bottom;
- }
- mPolicy.setDisplayOverscan(displayContent.getDisplay(), left, top, right, bottom);
- displayContent.layoutNeeded = true;
- mDisplaySettings.setOverscanLocked(displayInfo.name, left, top, right, bottom);
- mDisplaySettings.writeSettingsLocked();
- performLayoutAndPlaceSurfacesLocked();
+ setOverscanLocked(displayContent, left, top, right, bottom);
}
}
}
+ private void setOverscanLocked(DisplayContent displayContent,
+ int left, int top, int right, int bottom) {
+ final DisplayInfo displayInfo = displayContent.getDisplayInfo();
+ synchronized (displayContent.mDisplaySizeLock) {
+ displayInfo.overscanLeft = left;
+ displayInfo.overscanTop = top;
+ displayInfo.overscanRight = right;
+ displayInfo.overscanBottom = bottom;
+ }
+
+ mDisplaySettings.setOverscanLocked(displayInfo.name, left, top, right, bottom);
+ mDisplaySettings.writeSettingsLocked();
+
+ reconfigureDisplayLocked(displayContent);
+ }
+
// -------------------------------------------------------------
// Internals
// -------------------------------------------------------------
DisplayContent displayContent = new DisplayContent(display, this);
final int displayId = display.getDisplayId();
mDisplayContents.put(displayId, displayContent);
+
+ DisplayInfo displayInfo = displayContent.getDisplayInfo();
final Rect rect = new Rect();
- DisplayInfo info = displayContent.getDisplayInfo();
- mDisplaySettings.getOverscanLocked(info.name, rect);
- info.overscanLeft = rect.left;
- info.overscanTop = rect.top;
- info.overscanRight = rect.right;
- info.overscanBottom = rect.bottom;
- mDisplayManagerService.setOverscan(display.getDisplayId(), rect.left, rect.top,
- rect.right, rect.bottom);
- mPolicy.setDisplayOverscan(displayContent.getDisplay(), rect.left, rect.top,
- rect.right, rect.bottom);
+ mDisplaySettings.getOverscanLocked(displayInfo.name, rect);
+ synchronized (displayContent.mDisplaySizeLock) {
+ displayInfo.overscanLeft = rect.left;
+ displayInfo.overscanTop = rect.top;
+ displayInfo.overscanRight = rect.right;
+ displayInfo.overscanBottom = rect.bottom;
+ mDisplayManagerService.setDisplayInfoOverrideFromWindowManager(
+ displayId, displayInfo);
+ }
+ configureDisplayPolicyLocked(displayContent);
// TODO: Create an input channel for each display with touch capability.
if (displayId == Display.DEFAULT_DISPLAY) {