/** * Overrides the display information of a particular logical display. This is used by the window * manager to control the size and characteristics of the default display. It is expected to apply * the requested change to the display information synchronously so that applications will * immediately observe the new state. * * @param displayId The logical display id. * @param info The new data to be stored. */ public void setDisplayInfoOverrideFromWindowManager(int displayId, DisplayInfo info) { synchronized (mSyncRoot) { LogicalDisplay display = mLogicalDisplays.get(displayId); if (display != null) { mTempDisplayInfo.copyFrom(display.getDisplayInfoLocked()); display.setDisplayInfoOverrideFromWindowManagerLocked(info); if (!mTempDisplayInfo.equals(display.getDisplayInfoLocked())) { sendDisplayEventLocked(displayId, DisplayManagerGlobal.EVENT_DISPLAY_CHANGED); scheduleTraversalLocked(false); } } } }
// Updates all existing logical displays given the current set of display devices. // Removes invalid logical displays. // Sends notifications if needed. private boolean updateLogicalDisplaysLocked() { boolean changed = false; for (int i = mLogicalDisplays.size(); i-- > 0; ) { final int displayId = mLogicalDisplays.keyAt(i); LogicalDisplay display = mLogicalDisplays.valueAt(i); mTempDisplayInfo.copyFrom(display.getDisplayInfoLocked()); display.updateLocked(mDisplayDevices); if (!display.isValidLocked()) { mLogicalDisplays.removeAt(i); sendDisplayEventLocked(displayId, DisplayManagerGlobal.EVENT_DISPLAY_REMOVED); changed = true; } else if (!mTempDisplayInfo.equals(display.getDisplayInfoLocked())) { sendDisplayEventLocked(displayId, DisplayManagerGlobal.EVENT_DISPLAY_CHANGED); changed = true; } } return changed; }