Loading core/java/android/view/WindowManagerGlobal.java +1 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ public final class WindowManagerGlobal { public static final int ADD_STARTING_NOT_NEEDED = -6; public static final int ADD_MULTIPLE_SINGLETON = -7; public static final int ADD_PERMISSION_DENIED = -8; public static final int ADD_INVALID_DISPLAY = -9; private static WindowManagerGlobal sDefaultWindowManager; private static IWindowManager sWindowManagerService; Loading services/java/com/android/server/wm/DisplayContent.java +5 −2 Original line number Diff line number Diff line Loading @@ -66,14 +66,17 @@ class DisplayContent { int mBaseDisplayWidth = 0; int mBaseDisplayHeight = 0; int mBaseDisplayDensity = 0; final DisplayInfo mDisplayInfo = new DisplayInfo(); final Display mDisplay; private final DisplayInfo mDisplayInfo = new DisplayInfo(); private final Display mDisplay; // Accessed directly by all users. boolean layoutNeeded; int pendingLayoutChanges; final boolean isDefaultDisplay; /** * @param display May not be null. */ DisplayContent(Display display) { mDisplay = display; mDisplayId = display.getDisplayId(); Loading services/java/com/android/server/wm/DragState.java +8 −3 Original line number Diff line number Diff line Loading @@ -190,11 +190,13 @@ class DragState { } final WindowList windows = mService.getWindowListLocked(mDisplay); if (windows != null) { final int N = windows.size(); for (int i = 0; i < N; i++) { sendDragStartedLw(windows.get(i), touchX, touchY, mDataDescription); } } } /* helper - send a caller-provided event, presumed to be DRAG_STARTED, if the * designated window is potentially a drop recipient. There are race situations Loading Loading @@ -393,6 +395,9 @@ class DragState { final int y = (int) yf; final WindowList windows = mService.getWindowListLocked(mDisplay); if (windows == null) { return null; } final int N = windows.size(); for (int i = N - 1; i >= 0; i--) { WindowState child = windows.get(i); Loading services/java/com/android/server/wm/WindowManagerService.java +111 −58 Original line number Diff line number Diff line Loading @@ -2092,6 +2092,11 @@ public class WindowManagerService extends IWindowManager.Stub throw new IllegalStateException("Display has not been initialialized"); } final DisplayContent displayContent = getDisplayContentLocked(displayId); if (displayContent == null) { return WindowManagerGlobal.ADD_INVALID_DISPLAY; } if (mWindowMap.containsKey(client.asBinder())) { Slog.w(TAG, "Window " + client + " is already added"); return WindowManagerGlobal.ADD_DUPLICATE_ADD; Loading Loading @@ -2174,7 +2179,6 @@ public class WindowManagerService extends IWindowManager.Stub } } final DisplayContent displayContent = getDisplayContentLocked(displayId); win = new WindowState(this, session, client, token, attachedWindow, seq, attrs, viewVisibility, displayContent); if (win.mDeathRecipient == null) { Loading Loading @@ -5712,6 +5716,7 @@ public class WindowManagerService extends IWindowManager.Stub * @param width the width of the target bitmap * @param height the height of the target bitmap */ @Override public Bitmap screenshotApplications(IBinder appToken, int displayId, int width, int height) { if (!checkCallingPermission(android.Manifest.permission.READ_FRAME_BUFFER, "screenshotApplications()")) { Loading @@ -5731,6 +5736,9 @@ public class WindowManagerService extends IWindowManager.Stub long ident = Binder.clearCallingIdentity(); final DisplayContent displayContent = getDisplayContentLocked(displayId); if (displayContent == null) { return null; } final DisplayInfo displayInfo = displayContent.getDisplayInfo(); dw = displayInfo.logicalWidth; dh = displayInfo.logicalHeight; Loading Loading @@ -6473,6 +6481,7 @@ public class WindowManagerService extends IWindowManager.Stub return success; } @Override public void addDisplayContentChangeListener(int displayId, IDisplayContentChangeListener listener) { if (!checkCallingPermission(android.Manifest.permission.RETRIEVE_WINDOW_INFO, Loading @@ -6481,6 +6490,7 @@ public class WindowManagerService extends IWindowManager.Stub } synchronized(mWindowMap) { DisplayContent displayContent = getDisplayContentLocked(displayId); if (displayContent != null) { if (displayContent.mDisplayContentChangeListeners == null) { displayContent.mDisplayContentChangeListeners = new RemoteCallbackList<IDisplayContentChangeListener>(); Loading @@ -6488,7 +6498,9 @@ public class WindowManagerService extends IWindowManager.Stub } } } } @Override public void removeDisplayContentChangeListener(int displayId, IDisplayContentChangeListener listener) { if (!checkCallingPermission(android.Manifest.permission.RETRIEVE_WINDOW_INFO, Loading @@ -6497,6 +6509,7 @@ public class WindowManagerService extends IWindowManager.Stub } synchronized(mWindowMap) { DisplayContent displayContent = getDisplayContentLocked(displayId); if (displayContent != null) { if (displayContent.mDisplayContentChangeListeners != null) { displayContent.mDisplayContentChangeListeners.unregister(listener); if (displayContent.mDisplayContentChangeListeners Loading @@ -6506,6 +6519,7 @@ public class WindowManagerService extends IWindowManager.Stub } } } } void scheduleNotifyWindowTranstionIfNeededLocked(WindowState window, int transition) { DisplayContent displayContent = window.mDisplayContent; Loading Loading @@ -7157,7 +7171,6 @@ public class WindowManagerService extends IWindowManager.Stub synchronized(mWindowMap) { final DisplayContent displayContent = getDefaultDisplayContentLocked(); final Display display = displayContent.getDisplay(); readForcedDisplaySizeAndDensityLocked(displayContent); mDisplayReady = true; Loading @@ -7181,14 +7194,14 @@ public class WindowManagerService extends IWindowManager.Stub } } public void displayReady(int displayId) { private void displayReady(int displayId) { synchronized(mWindowMap) { final DisplayContent displayContent = getDisplayContentLocked(displayId); final DisplayInfo displayInfo; if (displayContent != null) { mAnimator.addDisplayLocked(displayId); synchronized(displayContent.mDisplaySizeLock) { // Bootstrap the default logical display from the display manager. displayInfo = displayContent.getDisplayInfo(); final DisplayInfo displayInfo = displayContent.getDisplayInfo(); DisplayInfo newDisplayInfo = mDisplayManagerService.getDisplayInfo(displayId); if (newDisplayInfo != null) { displayInfo.copyFrom(newDisplayInfo); Loading @@ -7202,6 +7215,7 @@ public class WindowManagerService extends IWindowManager.Stub } } } } public void systemReady() { mPolicy.systemReady(); Loading Loading @@ -7839,12 +7853,15 @@ public class WindowManagerService extends IWindowManager.Stub // TODO(cmautner): Access to DisplayContent should be locked on mWindowMap. Doing that // could lead to deadlock since this is called from ActivityManager. final DisplayContent displayContent = getDisplayContentLocked(displayId); if (displayContent != null) { synchronized(displayContent.mDisplaySizeLock) { size.x = displayContent.mInitialDisplayWidth; size.y = displayContent.mInitialDisplayHeight; } } } @Override public void setForcedDisplaySize(int displayId, int width, int height) { synchronized(mWindowMap) { // Set some sort of reasonable bounds on the size of the display that we Loading @@ -7853,7 +7870,7 @@ public class WindowManagerService extends IWindowManager.Stub final int MIN_HEIGHT = 200; final int MAX_SCALE = 2; final DisplayContent displayContent = getDisplayContentLocked(displayId); if (displayContent != null) { width = Math.min(Math.max(width, MIN_WIDTH), displayContent.mInitialDisplayWidth * MAX_SCALE); height = Math.min(Math.max(height, MIN_HEIGHT), Loading @@ -7863,6 +7880,7 @@ public class WindowManagerService extends IWindowManager.Stub Settings.Global.DISPLAY_SIZE_FORCED, width + "," + height); } } } private void readForcedDisplaySizeAndDensityLocked(final DisplayContent displayContent) { final String sizeStr = Settings.Global.getString(mContext.getContentResolver(), Loading Loading @@ -7903,6 +7921,7 @@ public class WindowManagerService extends IWindowManager.Stub } } // displayContent must not be null private void setForcedDisplaySizeLocked(DisplayContent displayContent, int width, int height) { Slog.i(TAG, "Using new display size: " + width + "x" + height); Loading @@ -7913,25 +7932,32 @@ public class WindowManagerService extends IWindowManager.Stub reconfigureDisplayLocked(displayContent); } @Override public void clearForcedDisplaySize(int displayId) { synchronized(mWindowMap) { final DisplayContent displayContent = getDisplayContentLocked(displayId); if (displayContent != null) { setForcedDisplaySizeLocked(displayContent, displayContent.mInitialDisplayWidth, displayContent.mInitialDisplayHeight); Settings.Global.putString(mContext.getContentResolver(), Settings.Global.DISPLAY_SIZE_FORCED, ""); } } } @Override public void setForcedDisplayDensity(int displayId, int density) { synchronized(mWindowMap) { final DisplayContent displayContent = getDisplayContentLocked(displayId); if (displayContent != null) { setForcedDisplayDensityLocked(displayContent, density); Settings.Global.putString(mContext.getContentResolver(), Settings.Global.DISPLAY_DENSITY_FORCED, Integer.toString(density)); } } } // displayContent must not be null private void setForcedDisplayDensityLocked(DisplayContent displayContent, int density) { Slog.i(TAG, "Using new display density: " + density); Loading @@ -7941,15 +7967,19 @@ public class WindowManagerService extends IWindowManager.Stub reconfigureDisplayLocked(displayContent); } @Override public void clearForcedDisplayDensity(int displayId) { synchronized(mWindowMap) { final DisplayContent displayContent = getDisplayContentLocked(displayId); if (displayContent != null) { setForcedDisplayDensityLocked(displayContent, displayContent.mInitialDisplayDensity); Settings.Global.putString(mContext.getContentResolver(), Settings.Global.DISPLAY_DENSITY_FORCED, ""); } } } // displayContent must not be null private void reconfigureDisplayLocked(DisplayContent displayContent) { // TODO: Multidisplay: for now only use with default display. mPolicy.setInitialDisplaySize(displayContent.getDisplay(), Loading Loading @@ -9719,8 +9749,10 @@ public class WindowManagerService extends IWindowManager.Stub for (int i = 0; i < count; ++i) { final DisplayContent displayContent = getDisplayContentLocked(pendingLayouts.keyAt(i)); if (displayContent != null) { displayContent.pendingLayoutChanges |= pendingLayouts.valueAt(i); } } mWindowDetachedWallpaper = animToLayout.mWindowDetachedWallpaper; } Loading Loading @@ -10845,12 +10877,21 @@ public class WindowManagerService extends IWindowManager.Stub mDisplayContents.put(display.getDisplayId(), displayContent); } /** * Retrieve the DisplayContent for the specified displayId. Will create a new DisplayContent if * there is a Display for the displayId. * @param displayId The display the caller is interested in. * @return The DisplayContent associated with displayId or null if there is no Display for it. */ public DisplayContent getDisplayContentLocked(final int displayId) { DisplayContent displayContent = mDisplayContents.get(displayId); if (displayContent == null) { displayContent = new DisplayContent(mDisplayManager.getDisplay(displayId)); final Display display = mDisplayManager.getDisplay(displayId); if (display != null) { displayContent = new DisplayContent(display); mDisplayContents.put(displayId, displayContent); } } return displayContent; } Loading Loading @@ -10935,6 +10976,7 @@ public class WindowManagerService extends IWindowManager.Stub } } // There is an inherent assumption that this will never return null. public DisplayContent getDefaultDisplayContentLocked() { return getDisplayContentLocked(Display.DEFAULT_DISPLAY); } Loading @@ -10947,8 +10989,14 @@ public class WindowManagerService extends IWindowManager.Stub return getDefaultDisplayContentLocked().getDisplayInfo(); } /** * Return the list of WindowStates associated on the passed display. * @param display The screen to return windows from. * @return The list of WindowStates on the screen, or null if the there is no screen. */ public WindowList getWindowListLocked(final Display display) { return getDisplayContentLocked(display.getDisplayId()).getWindowList(); final DisplayContent displayContent = getDisplayContentLocked(display.getDisplayId()); return displayContent != null ? displayContent.getWindowList() : null; } @Override Loading @@ -10957,9 +11005,12 @@ public class WindowManagerService extends IWindowManager.Stub } private void handleDisplayAddedLocked(int displayId) { createDisplayContentLocked(mDisplayManager.getDisplay(displayId)); final Display display = mDisplayManager.getDisplay(displayId); if (display != null) { createDisplayContentLocked(display); displayReady(displayId); } } @Override public void onDisplayRemoved(int displayId) { Loading @@ -10968,12 +11019,14 @@ public class WindowManagerService extends IWindowManager.Stub private void handleDisplayRemovedLocked(int displayId) { final DisplayContent displayContent = getDisplayContentLocked(displayId); if (displayContent != null) { mDisplayContents.delete(displayId); WindowList windows = displayContent.getWindowList(); while (!windows.isEmpty()) { final WindowState win = windows.get(windows.size() - 1); removeWindowLocked(win.mSession, win); } } mAnimator.removeDisplayLocked(displayId); } Loading Loading
core/java/android/view/WindowManagerGlobal.java +1 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ public final class WindowManagerGlobal { public static final int ADD_STARTING_NOT_NEEDED = -6; public static final int ADD_MULTIPLE_SINGLETON = -7; public static final int ADD_PERMISSION_DENIED = -8; public static final int ADD_INVALID_DISPLAY = -9; private static WindowManagerGlobal sDefaultWindowManager; private static IWindowManager sWindowManagerService; Loading
services/java/com/android/server/wm/DisplayContent.java +5 −2 Original line number Diff line number Diff line Loading @@ -66,14 +66,17 @@ class DisplayContent { int mBaseDisplayWidth = 0; int mBaseDisplayHeight = 0; int mBaseDisplayDensity = 0; final DisplayInfo mDisplayInfo = new DisplayInfo(); final Display mDisplay; private final DisplayInfo mDisplayInfo = new DisplayInfo(); private final Display mDisplay; // Accessed directly by all users. boolean layoutNeeded; int pendingLayoutChanges; final boolean isDefaultDisplay; /** * @param display May not be null. */ DisplayContent(Display display) { mDisplay = display; mDisplayId = display.getDisplayId(); Loading
services/java/com/android/server/wm/DragState.java +8 −3 Original line number Diff line number Diff line Loading @@ -190,11 +190,13 @@ class DragState { } final WindowList windows = mService.getWindowListLocked(mDisplay); if (windows != null) { final int N = windows.size(); for (int i = 0; i < N; i++) { sendDragStartedLw(windows.get(i), touchX, touchY, mDataDescription); } } } /* helper - send a caller-provided event, presumed to be DRAG_STARTED, if the * designated window is potentially a drop recipient. There are race situations Loading Loading @@ -393,6 +395,9 @@ class DragState { final int y = (int) yf; final WindowList windows = mService.getWindowListLocked(mDisplay); if (windows == null) { return null; } final int N = windows.size(); for (int i = N - 1; i >= 0; i--) { WindowState child = windows.get(i); Loading
services/java/com/android/server/wm/WindowManagerService.java +111 −58 Original line number Diff line number Diff line Loading @@ -2092,6 +2092,11 @@ public class WindowManagerService extends IWindowManager.Stub throw new IllegalStateException("Display has not been initialialized"); } final DisplayContent displayContent = getDisplayContentLocked(displayId); if (displayContent == null) { return WindowManagerGlobal.ADD_INVALID_DISPLAY; } if (mWindowMap.containsKey(client.asBinder())) { Slog.w(TAG, "Window " + client + " is already added"); return WindowManagerGlobal.ADD_DUPLICATE_ADD; Loading Loading @@ -2174,7 +2179,6 @@ public class WindowManagerService extends IWindowManager.Stub } } final DisplayContent displayContent = getDisplayContentLocked(displayId); win = new WindowState(this, session, client, token, attachedWindow, seq, attrs, viewVisibility, displayContent); if (win.mDeathRecipient == null) { Loading Loading @@ -5712,6 +5716,7 @@ public class WindowManagerService extends IWindowManager.Stub * @param width the width of the target bitmap * @param height the height of the target bitmap */ @Override public Bitmap screenshotApplications(IBinder appToken, int displayId, int width, int height) { if (!checkCallingPermission(android.Manifest.permission.READ_FRAME_BUFFER, "screenshotApplications()")) { Loading @@ -5731,6 +5736,9 @@ public class WindowManagerService extends IWindowManager.Stub long ident = Binder.clearCallingIdentity(); final DisplayContent displayContent = getDisplayContentLocked(displayId); if (displayContent == null) { return null; } final DisplayInfo displayInfo = displayContent.getDisplayInfo(); dw = displayInfo.logicalWidth; dh = displayInfo.logicalHeight; Loading Loading @@ -6473,6 +6481,7 @@ public class WindowManagerService extends IWindowManager.Stub return success; } @Override public void addDisplayContentChangeListener(int displayId, IDisplayContentChangeListener listener) { if (!checkCallingPermission(android.Manifest.permission.RETRIEVE_WINDOW_INFO, Loading @@ -6481,6 +6490,7 @@ public class WindowManagerService extends IWindowManager.Stub } synchronized(mWindowMap) { DisplayContent displayContent = getDisplayContentLocked(displayId); if (displayContent != null) { if (displayContent.mDisplayContentChangeListeners == null) { displayContent.mDisplayContentChangeListeners = new RemoteCallbackList<IDisplayContentChangeListener>(); Loading @@ -6488,7 +6498,9 @@ public class WindowManagerService extends IWindowManager.Stub } } } } @Override public void removeDisplayContentChangeListener(int displayId, IDisplayContentChangeListener listener) { if (!checkCallingPermission(android.Manifest.permission.RETRIEVE_WINDOW_INFO, Loading @@ -6497,6 +6509,7 @@ public class WindowManagerService extends IWindowManager.Stub } synchronized(mWindowMap) { DisplayContent displayContent = getDisplayContentLocked(displayId); if (displayContent != null) { if (displayContent.mDisplayContentChangeListeners != null) { displayContent.mDisplayContentChangeListeners.unregister(listener); if (displayContent.mDisplayContentChangeListeners Loading @@ -6506,6 +6519,7 @@ public class WindowManagerService extends IWindowManager.Stub } } } } void scheduleNotifyWindowTranstionIfNeededLocked(WindowState window, int transition) { DisplayContent displayContent = window.mDisplayContent; Loading Loading @@ -7157,7 +7171,6 @@ public class WindowManagerService extends IWindowManager.Stub synchronized(mWindowMap) { final DisplayContent displayContent = getDefaultDisplayContentLocked(); final Display display = displayContent.getDisplay(); readForcedDisplaySizeAndDensityLocked(displayContent); mDisplayReady = true; Loading @@ -7181,14 +7194,14 @@ public class WindowManagerService extends IWindowManager.Stub } } public void displayReady(int displayId) { private void displayReady(int displayId) { synchronized(mWindowMap) { final DisplayContent displayContent = getDisplayContentLocked(displayId); final DisplayInfo displayInfo; if (displayContent != null) { mAnimator.addDisplayLocked(displayId); synchronized(displayContent.mDisplaySizeLock) { // Bootstrap the default logical display from the display manager. displayInfo = displayContent.getDisplayInfo(); final DisplayInfo displayInfo = displayContent.getDisplayInfo(); DisplayInfo newDisplayInfo = mDisplayManagerService.getDisplayInfo(displayId); if (newDisplayInfo != null) { displayInfo.copyFrom(newDisplayInfo); Loading @@ -7202,6 +7215,7 @@ public class WindowManagerService extends IWindowManager.Stub } } } } public void systemReady() { mPolicy.systemReady(); Loading Loading @@ -7839,12 +7853,15 @@ public class WindowManagerService extends IWindowManager.Stub // TODO(cmautner): Access to DisplayContent should be locked on mWindowMap. Doing that // could lead to deadlock since this is called from ActivityManager. final DisplayContent displayContent = getDisplayContentLocked(displayId); if (displayContent != null) { synchronized(displayContent.mDisplaySizeLock) { size.x = displayContent.mInitialDisplayWidth; size.y = displayContent.mInitialDisplayHeight; } } } @Override public void setForcedDisplaySize(int displayId, int width, int height) { synchronized(mWindowMap) { // Set some sort of reasonable bounds on the size of the display that we Loading @@ -7853,7 +7870,7 @@ public class WindowManagerService extends IWindowManager.Stub final int MIN_HEIGHT = 200; final int MAX_SCALE = 2; final DisplayContent displayContent = getDisplayContentLocked(displayId); if (displayContent != null) { width = Math.min(Math.max(width, MIN_WIDTH), displayContent.mInitialDisplayWidth * MAX_SCALE); height = Math.min(Math.max(height, MIN_HEIGHT), Loading @@ -7863,6 +7880,7 @@ public class WindowManagerService extends IWindowManager.Stub Settings.Global.DISPLAY_SIZE_FORCED, width + "," + height); } } } private void readForcedDisplaySizeAndDensityLocked(final DisplayContent displayContent) { final String sizeStr = Settings.Global.getString(mContext.getContentResolver(), Loading Loading @@ -7903,6 +7921,7 @@ public class WindowManagerService extends IWindowManager.Stub } } // displayContent must not be null private void setForcedDisplaySizeLocked(DisplayContent displayContent, int width, int height) { Slog.i(TAG, "Using new display size: " + width + "x" + height); Loading @@ -7913,25 +7932,32 @@ public class WindowManagerService extends IWindowManager.Stub reconfigureDisplayLocked(displayContent); } @Override public void clearForcedDisplaySize(int displayId) { synchronized(mWindowMap) { final DisplayContent displayContent = getDisplayContentLocked(displayId); if (displayContent != null) { setForcedDisplaySizeLocked(displayContent, displayContent.mInitialDisplayWidth, displayContent.mInitialDisplayHeight); Settings.Global.putString(mContext.getContentResolver(), Settings.Global.DISPLAY_SIZE_FORCED, ""); } } } @Override public void setForcedDisplayDensity(int displayId, int density) { synchronized(mWindowMap) { final DisplayContent displayContent = getDisplayContentLocked(displayId); if (displayContent != null) { setForcedDisplayDensityLocked(displayContent, density); Settings.Global.putString(mContext.getContentResolver(), Settings.Global.DISPLAY_DENSITY_FORCED, Integer.toString(density)); } } } // displayContent must not be null private void setForcedDisplayDensityLocked(DisplayContent displayContent, int density) { Slog.i(TAG, "Using new display density: " + density); Loading @@ -7941,15 +7967,19 @@ public class WindowManagerService extends IWindowManager.Stub reconfigureDisplayLocked(displayContent); } @Override public void clearForcedDisplayDensity(int displayId) { synchronized(mWindowMap) { final DisplayContent displayContent = getDisplayContentLocked(displayId); if (displayContent != null) { setForcedDisplayDensityLocked(displayContent, displayContent.mInitialDisplayDensity); Settings.Global.putString(mContext.getContentResolver(), Settings.Global.DISPLAY_DENSITY_FORCED, ""); } } } // displayContent must not be null private void reconfigureDisplayLocked(DisplayContent displayContent) { // TODO: Multidisplay: for now only use with default display. mPolicy.setInitialDisplaySize(displayContent.getDisplay(), Loading Loading @@ -9719,8 +9749,10 @@ public class WindowManagerService extends IWindowManager.Stub for (int i = 0; i < count; ++i) { final DisplayContent displayContent = getDisplayContentLocked(pendingLayouts.keyAt(i)); if (displayContent != null) { displayContent.pendingLayoutChanges |= pendingLayouts.valueAt(i); } } mWindowDetachedWallpaper = animToLayout.mWindowDetachedWallpaper; } Loading Loading @@ -10845,12 +10877,21 @@ public class WindowManagerService extends IWindowManager.Stub mDisplayContents.put(display.getDisplayId(), displayContent); } /** * Retrieve the DisplayContent for the specified displayId. Will create a new DisplayContent if * there is a Display for the displayId. * @param displayId The display the caller is interested in. * @return The DisplayContent associated with displayId or null if there is no Display for it. */ public DisplayContent getDisplayContentLocked(final int displayId) { DisplayContent displayContent = mDisplayContents.get(displayId); if (displayContent == null) { displayContent = new DisplayContent(mDisplayManager.getDisplay(displayId)); final Display display = mDisplayManager.getDisplay(displayId); if (display != null) { displayContent = new DisplayContent(display); mDisplayContents.put(displayId, displayContent); } } return displayContent; } Loading Loading @@ -10935,6 +10976,7 @@ public class WindowManagerService extends IWindowManager.Stub } } // There is an inherent assumption that this will never return null. public DisplayContent getDefaultDisplayContentLocked() { return getDisplayContentLocked(Display.DEFAULT_DISPLAY); } Loading @@ -10947,8 +10989,14 @@ public class WindowManagerService extends IWindowManager.Stub return getDefaultDisplayContentLocked().getDisplayInfo(); } /** * Return the list of WindowStates associated on the passed display. * @param display The screen to return windows from. * @return The list of WindowStates on the screen, or null if the there is no screen. */ public WindowList getWindowListLocked(final Display display) { return getDisplayContentLocked(display.getDisplayId()).getWindowList(); final DisplayContent displayContent = getDisplayContentLocked(display.getDisplayId()); return displayContent != null ? displayContent.getWindowList() : null; } @Override Loading @@ -10957,9 +11005,12 @@ public class WindowManagerService extends IWindowManager.Stub } private void handleDisplayAddedLocked(int displayId) { createDisplayContentLocked(mDisplayManager.getDisplay(displayId)); final Display display = mDisplayManager.getDisplay(displayId); if (display != null) { createDisplayContentLocked(display); displayReady(displayId); } } @Override public void onDisplayRemoved(int displayId) { Loading @@ -10968,12 +11019,14 @@ public class WindowManagerService extends IWindowManager.Stub private void handleDisplayRemovedLocked(int displayId) { final DisplayContent displayContent = getDisplayContentLocked(displayId); if (displayContent != null) { mDisplayContents.delete(displayId); WindowList windows = displayContent.getWindowList(); while (!windows.isEmpty()) { final WindowState win = windows.get(windows.size() - 1); removeWindowLocked(win.mSession, win); } } mAnimator.removeDisplayLocked(displayId); } Loading