Loading services/core/java/com/android/server/wm/WindowManagerService.java +17 −16 Original line number Diff line number Diff line Loading @@ -1547,7 +1547,23 @@ public class WindowManagerService extends IWindowManager.Stub return WindowManagerGlobal.ADD_APP_EXITING; } final DisplayContent displayContent = getDisplayContentOrCreate(displayId, attrs.token); if (type >= FIRST_SUB_WINDOW && type <= LAST_SUB_WINDOW) { parentWindow = windowForClientLocked(null, attrs.token, false); if (parentWindow == null) { ProtoLog.w(WM_ERROR, "Attempted to add window with token that is not a window: " + "%s. Aborting.", attrs.token); return WindowManagerGlobal.ADD_BAD_SUBWINDOW_TOKEN; } if (parentWindow.mAttrs.type >= FIRST_SUB_WINDOW && parentWindow.mAttrs.type <= LAST_SUB_WINDOW) { ProtoLog.w(WM_ERROR, "Attempted to add window with token that is a sub-window: " + "%s. Aborting.", attrs.token); return WindowManagerGlobal.ADD_BAD_SUBWINDOW_TOKEN; } } final DisplayContent displayContent = parentWindow != null ? parentWindow.mDisplayContent : getDisplayContentOrCreate(displayId, attrs.token); if (displayContent == null) { ProtoLog.w(WM_ERROR, "Attempted to add window to a display that does " Loading @@ -1567,21 +1583,6 @@ public class WindowManagerService extends IWindowManager.Stub return WindowManagerGlobal.ADD_DUPLICATE_ADD; } if (type >= FIRST_SUB_WINDOW && type <= LAST_SUB_WINDOW) { parentWindow = windowForClientLocked(null, attrs.token, false); if (parentWindow == null) { ProtoLog.w(WM_ERROR, "Attempted to add window with token that is not a window: " + "%s. Aborting.", attrs.token); return WindowManagerGlobal.ADD_BAD_SUBWINDOW_TOKEN; } if (parentWindow.mAttrs.type >= FIRST_SUB_WINDOW && parentWindow.mAttrs.type <= LAST_SUB_WINDOW) { ProtoLog.w(WM_ERROR, "Attempted to add window with token that is a sub-window: " + "%s. Aborting.", attrs.token); return WindowManagerGlobal.ADD_BAD_SUBWINDOW_TOKEN; } } if (type == TYPE_PRESENTATION || type == TYPE_PRIVATE_PRESENTATION) { mDisplayManagerInternal.onPresentation(displayContent.getDisplay().getDisplayId(), /*isShown=*/ true); Loading services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceTests.java +8 −0 Original line number Diff line number Diff line Loading @@ -554,6 +554,14 @@ public class WindowManagerServiceTests extends WindowTestsBase { verify(mWm.mWindowContextListenerController, never()).registerWindowContainerListener(any(), any(), any(), anyInt(), any(), anyBoolean()); // Even if the given display id is INVALID_DISPLAY, the specified params.token should be // able to map the corresponding display. final int result = mWm.addWindow( session, new TestIWindow(), params, View.VISIBLE, INVALID_DISPLAY, UserHandle.USER_SYSTEM, WindowInsets.Type.defaultVisible(), null, new InsetsState(), new InsetsSourceControl.Array(), new Rect(), new float[1]); assertThat(result).isAtLeast(WindowManagerGlobal.ADD_OKAY); assertTrue(parentWin.hasChild()); assertTrue(parentWin.isAttached()); session.binderDied(); Loading Loading
services/core/java/com/android/server/wm/WindowManagerService.java +17 −16 Original line number Diff line number Diff line Loading @@ -1547,7 +1547,23 @@ public class WindowManagerService extends IWindowManager.Stub return WindowManagerGlobal.ADD_APP_EXITING; } final DisplayContent displayContent = getDisplayContentOrCreate(displayId, attrs.token); if (type >= FIRST_SUB_WINDOW && type <= LAST_SUB_WINDOW) { parentWindow = windowForClientLocked(null, attrs.token, false); if (parentWindow == null) { ProtoLog.w(WM_ERROR, "Attempted to add window with token that is not a window: " + "%s. Aborting.", attrs.token); return WindowManagerGlobal.ADD_BAD_SUBWINDOW_TOKEN; } if (parentWindow.mAttrs.type >= FIRST_SUB_WINDOW && parentWindow.mAttrs.type <= LAST_SUB_WINDOW) { ProtoLog.w(WM_ERROR, "Attempted to add window with token that is a sub-window: " + "%s. Aborting.", attrs.token); return WindowManagerGlobal.ADD_BAD_SUBWINDOW_TOKEN; } } final DisplayContent displayContent = parentWindow != null ? parentWindow.mDisplayContent : getDisplayContentOrCreate(displayId, attrs.token); if (displayContent == null) { ProtoLog.w(WM_ERROR, "Attempted to add window to a display that does " Loading @@ -1567,21 +1583,6 @@ public class WindowManagerService extends IWindowManager.Stub return WindowManagerGlobal.ADD_DUPLICATE_ADD; } if (type >= FIRST_SUB_WINDOW && type <= LAST_SUB_WINDOW) { parentWindow = windowForClientLocked(null, attrs.token, false); if (parentWindow == null) { ProtoLog.w(WM_ERROR, "Attempted to add window with token that is not a window: " + "%s. Aborting.", attrs.token); return WindowManagerGlobal.ADD_BAD_SUBWINDOW_TOKEN; } if (parentWindow.mAttrs.type >= FIRST_SUB_WINDOW && parentWindow.mAttrs.type <= LAST_SUB_WINDOW) { ProtoLog.w(WM_ERROR, "Attempted to add window with token that is a sub-window: " + "%s. Aborting.", attrs.token); return WindowManagerGlobal.ADD_BAD_SUBWINDOW_TOKEN; } } if (type == TYPE_PRESENTATION || type == TYPE_PRIVATE_PRESENTATION) { mDisplayManagerInternal.onPresentation(displayContent.getDisplay().getDisplayId(), /*isShown=*/ true); Loading
services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceTests.java +8 −0 Original line number Diff line number Diff line Loading @@ -554,6 +554,14 @@ public class WindowManagerServiceTests extends WindowTestsBase { verify(mWm.mWindowContextListenerController, never()).registerWindowContainerListener(any(), any(), any(), anyInt(), any(), anyBoolean()); // Even if the given display id is INVALID_DISPLAY, the specified params.token should be // able to map the corresponding display. final int result = mWm.addWindow( session, new TestIWindow(), params, View.VISIBLE, INVALID_DISPLAY, UserHandle.USER_SYSTEM, WindowInsets.Type.defaultVisible(), null, new InsetsState(), new InsetsSourceControl.Array(), new Rect(), new float[1]); assertThat(result).isAtLeast(WindowManagerGlobal.ADD_OKAY); assertTrue(parentWin.hasChild()); assertTrue(parentWin.isAttached()); session.binderDied(); Loading