Loading services/core/java/com/android/server/am/ActivityDisplay.java +21 −1 Original line number Diff line number Diff line Loading @@ -657,6 +657,26 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> return false; } void remove() { final boolean destroyContentOnRemoval = shouldDestroyContentOnRemove(); while (getChildCount() > 0) { final ActivityStack stack = getChildAt(0); if (destroyContentOnRemoval) { mSupervisor.moveStackToDisplayLocked(stack.mStackId, DEFAULT_DISPLAY, false /* onTop */); stack.finishAllActivitiesLocked(true /* immediately */); } else { // Moving all tasks to fullscreen stack, because it's guaranteed to be // a valid launch stack for all activities. This way the task history from // external display will be preserved on primary after move. mSupervisor.moveTasksToFullscreenStackLocked(stack, true /* onTop */); } } mWindowContainerController.removeContainer(); mWindowContainerController = null; } /** Update and get all UIDs that are present on the display and have access to it. */ IntArray getPresentUIDs() { mDisplayAccessUIDs.clear(); Loading @@ -666,7 +686,7 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> return mDisplayAccessUIDs; } boolean shouldDestroyContentOnRemove() { private boolean shouldDestroyContentOnRemove() { return mDisplay.getRemoveMode() == REMOVE_MODE_DESTROY_CONTENT; } Loading services/core/java/com/android/server/am/ActivityStackSupervisor.java +2 −15 Original line number Diff line number Diff line Loading @@ -4092,25 +4092,12 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D if (activityDisplay == null) { return; } final boolean destroyContentOnRemoval = activityDisplay.shouldDestroyContentOnRemove(); while (activityDisplay.getChildCount() > 0) { final ActivityStack stack = activityDisplay.getChildAt(0); if (destroyContentOnRemoval) { moveStackToDisplayLocked(stack.mStackId, DEFAULT_DISPLAY, false /* onTop */); stack.finishAllActivitiesLocked(true /* immediately */); } else { // Moving all tasks to fullscreen stack, because it's guaranteed to be // a valid launch stack for all activities. This way the task history from // external display will be preserved on primary after move. moveTasksToFullscreenStackLocked(stack, true /* onTop */); } } activityDisplay.remove(); releaseSleepTokens(activityDisplay); mActivityDisplays.remove(displayId); mWindowManager.onDisplayRemoved(displayId); } } Loading services/core/java/com/android/server/wm/DisplayContent.java +4 −2 Original line number Diff line number Diff line Loading @@ -725,8 +725,9 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo * wallpaper windows in the window list. */ DisplayContent(Display display, WindowManagerService service, WallpaperController wallpaperController) { WallpaperController wallpaperController, DisplayWindowController controller) { super(service); setController(controller); if (service.mRoot.getDisplayContent(display.getDisplayId()) != null) { throw new IllegalArgumentException("Display with ID=" + display.getDisplayId() + " already exists=" + service.mRoot.getDisplayContent(display.getDisplayId()) Loading Loading @@ -1941,6 +1942,8 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo } finally { mRemovingDisplay = false; } mService.onDisplayRemoved(mDisplayId); } /** Returns true if a removal action is still being deferred. */ Loading @@ -1950,7 +1953,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo if (!stillDeferringRemoval && mDeferredRemoval) { removeImmediately(); mService.onDisplayRemoved(mDisplayId); return false; } return true; Loading services/core/java/com/android/server/wm/DisplayWindowController.java +25 −7 Original line number Diff line number Diff line Loading @@ -16,11 +16,14 @@ package com.android.server.wm; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_DISPLAY; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_STACK; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; import android.content.res.Configuration; import android.os.Binder; import android.util.Slog; import android.view.Display; /** * Controller for the display container. This is created by activity manager to link activity Loading @@ -36,9 +39,16 @@ public class DisplayWindowController mDisplayId = displayId; synchronized (mWindowMap) { // TODO: Convert to setContainer() from DisplayContent once everything is hooked up. // Currently we are not setup to register for config changes. mContainer = mRoot.getDisplayContentOrCreate(displayId); final Display display = mService.mDisplayManager.getDisplay(displayId); if (display != null) { final long callingIdentity = Binder.clearCallingIdentity(); try { mRoot.createDisplayContent(display, this /* controller */); } finally { Binder.restoreCallingIdentity(callingIdentity); } } if (mContainer == null) { throw new IllegalArgumentException("Trying to add displayId=" + displayId); } Loading @@ -47,14 +57,22 @@ public class DisplayWindowController @Override public void removeContainer() { // TODO: Pipe through from ActivityDisplay to remove the display throw new UnsupportedOperationException("To be implemented"); synchronized (mWindowMap) { if(mContainer == null) { if (DEBUG_DISPLAY) Slog.i(TAG_WM, "removeDisplay: could not find displayId=" + mDisplayId); return; } mContainer.removeIfPossible(); super.removeContainer(); } } @Override public void onOverrideConfigurationChanged(Configuration overrideConfiguration) { // TODO: Pipe through from ActivityDisplay to update the configuration for the display throw new UnsupportedOperationException("To be implemented"); // TODO: The container receives override configuration changes through other means. enabling // callbacks through the controller causes layout issues. Investigate consolidating // override configuration propagation to just here. } /** Loading services/core/java/com/android/server/wm/RootWindowContainer.java +3 −27 Original line number Diff line number Diff line Loading @@ -193,30 +193,6 @@ class RootWindowContainer extends WindowContainer<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. */ DisplayContent getDisplayContentOrCreate(int displayId) { DisplayContent dc = getDisplayContent(displayId); if (dc == null) { final Display display = mService.mDisplayManager.getDisplay(displayId); if (display != null) { final long callingIdentity = Binder.clearCallingIdentity(); try { dc = createDisplayContent(display); } finally { Binder.restoreCallingIdentity(callingIdentity); } } } return dc; } DisplayContent getDisplayContent(int displayId) { for (int i = mChildren.size() - 1; i >= 0; --i) { final DisplayContent current = mChildren.get(i); Loading @@ -227,9 +203,9 @@ class RootWindowContainer extends WindowContainer<DisplayContent> { return null; } private DisplayContent createDisplayContent(final Display display) { final DisplayContent dc = new DisplayContent(display, mService, mWallpaperController); DisplayContent createDisplayContent(final Display display, DisplayWindowController controller) { final DisplayContent dc = new DisplayContent(display, mService, mWallpaperController, controller); final int displayId = display.getDisplayId(); if (DEBUG_DISPLAY) Slog.v(TAG_WM, "Adding display=" + display); Loading Loading
services/core/java/com/android/server/am/ActivityDisplay.java +21 −1 Original line number Diff line number Diff line Loading @@ -657,6 +657,26 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> return false; } void remove() { final boolean destroyContentOnRemoval = shouldDestroyContentOnRemove(); while (getChildCount() > 0) { final ActivityStack stack = getChildAt(0); if (destroyContentOnRemoval) { mSupervisor.moveStackToDisplayLocked(stack.mStackId, DEFAULT_DISPLAY, false /* onTop */); stack.finishAllActivitiesLocked(true /* immediately */); } else { // Moving all tasks to fullscreen stack, because it's guaranteed to be // a valid launch stack for all activities. This way the task history from // external display will be preserved on primary after move. mSupervisor.moveTasksToFullscreenStackLocked(stack, true /* onTop */); } } mWindowContainerController.removeContainer(); mWindowContainerController = null; } /** Update and get all UIDs that are present on the display and have access to it. */ IntArray getPresentUIDs() { mDisplayAccessUIDs.clear(); Loading @@ -666,7 +686,7 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> return mDisplayAccessUIDs; } boolean shouldDestroyContentOnRemove() { private boolean shouldDestroyContentOnRemove() { return mDisplay.getRemoveMode() == REMOVE_MODE_DESTROY_CONTENT; } Loading
services/core/java/com/android/server/am/ActivityStackSupervisor.java +2 −15 Original line number Diff line number Diff line Loading @@ -4092,25 +4092,12 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D if (activityDisplay == null) { return; } final boolean destroyContentOnRemoval = activityDisplay.shouldDestroyContentOnRemove(); while (activityDisplay.getChildCount() > 0) { final ActivityStack stack = activityDisplay.getChildAt(0); if (destroyContentOnRemoval) { moveStackToDisplayLocked(stack.mStackId, DEFAULT_DISPLAY, false /* onTop */); stack.finishAllActivitiesLocked(true /* immediately */); } else { // Moving all tasks to fullscreen stack, because it's guaranteed to be // a valid launch stack for all activities. This way the task history from // external display will be preserved on primary after move. moveTasksToFullscreenStackLocked(stack, true /* onTop */); } } activityDisplay.remove(); releaseSleepTokens(activityDisplay); mActivityDisplays.remove(displayId); mWindowManager.onDisplayRemoved(displayId); } } Loading
services/core/java/com/android/server/wm/DisplayContent.java +4 −2 Original line number Diff line number Diff line Loading @@ -725,8 +725,9 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo * wallpaper windows in the window list. */ DisplayContent(Display display, WindowManagerService service, WallpaperController wallpaperController) { WallpaperController wallpaperController, DisplayWindowController controller) { super(service); setController(controller); if (service.mRoot.getDisplayContent(display.getDisplayId()) != null) { throw new IllegalArgumentException("Display with ID=" + display.getDisplayId() + " already exists=" + service.mRoot.getDisplayContent(display.getDisplayId()) Loading Loading @@ -1941,6 +1942,8 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo } finally { mRemovingDisplay = false; } mService.onDisplayRemoved(mDisplayId); } /** Returns true if a removal action is still being deferred. */ Loading @@ -1950,7 +1953,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo if (!stillDeferringRemoval && mDeferredRemoval) { removeImmediately(); mService.onDisplayRemoved(mDisplayId); return false; } return true; Loading
services/core/java/com/android/server/wm/DisplayWindowController.java +25 −7 Original line number Diff line number Diff line Loading @@ -16,11 +16,14 @@ package com.android.server.wm; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_DISPLAY; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_STACK; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; import android.content.res.Configuration; import android.os.Binder; import android.util.Slog; import android.view.Display; /** * Controller for the display container. This is created by activity manager to link activity Loading @@ -36,9 +39,16 @@ public class DisplayWindowController mDisplayId = displayId; synchronized (mWindowMap) { // TODO: Convert to setContainer() from DisplayContent once everything is hooked up. // Currently we are not setup to register for config changes. mContainer = mRoot.getDisplayContentOrCreate(displayId); final Display display = mService.mDisplayManager.getDisplay(displayId); if (display != null) { final long callingIdentity = Binder.clearCallingIdentity(); try { mRoot.createDisplayContent(display, this /* controller */); } finally { Binder.restoreCallingIdentity(callingIdentity); } } if (mContainer == null) { throw new IllegalArgumentException("Trying to add displayId=" + displayId); } Loading @@ -47,14 +57,22 @@ public class DisplayWindowController @Override public void removeContainer() { // TODO: Pipe through from ActivityDisplay to remove the display throw new UnsupportedOperationException("To be implemented"); synchronized (mWindowMap) { if(mContainer == null) { if (DEBUG_DISPLAY) Slog.i(TAG_WM, "removeDisplay: could not find displayId=" + mDisplayId); return; } mContainer.removeIfPossible(); super.removeContainer(); } } @Override public void onOverrideConfigurationChanged(Configuration overrideConfiguration) { // TODO: Pipe through from ActivityDisplay to update the configuration for the display throw new UnsupportedOperationException("To be implemented"); // TODO: The container receives override configuration changes through other means. enabling // callbacks through the controller causes layout issues. Investigate consolidating // override configuration propagation to just here. } /** Loading
services/core/java/com/android/server/wm/RootWindowContainer.java +3 −27 Original line number Diff line number Diff line Loading @@ -193,30 +193,6 @@ class RootWindowContainer extends WindowContainer<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. */ DisplayContent getDisplayContentOrCreate(int displayId) { DisplayContent dc = getDisplayContent(displayId); if (dc == null) { final Display display = mService.mDisplayManager.getDisplay(displayId); if (display != null) { final long callingIdentity = Binder.clearCallingIdentity(); try { dc = createDisplayContent(display); } finally { Binder.restoreCallingIdentity(callingIdentity); } } } return dc; } DisplayContent getDisplayContent(int displayId) { for (int i = mChildren.size() - 1; i >= 0; --i) { final DisplayContent current = mChildren.get(i); Loading @@ -227,9 +203,9 @@ class RootWindowContainer extends WindowContainer<DisplayContent> { return null; } private DisplayContent createDisplayContent(final Display display) { final DisplayContent dc = new DisplayContent(display, mService, mWallpaperController); DisplayContent createDisplayContent(final Display display, DisplayWindowController controller) { final DisplayContent dc = new DisplayContent(display, mService, mWallpaperController, controller); final int displayId = display.getDisplayId(); if (DEBUG_DISPLAY) Slog.v(TAG_WM, "Adding display=" + display); Loading