Loading services/core/java/com/android/server/wm/ActivityStack.java +2 −3 Original line number Original line Diff line number Diff line Loading @@ -3553,9 +3553,8 @@ class ActivityStack extends Task { } } } } void reparent(DisplayContent newParent, boolean onTop) { void reparent(TaskDisplayArea newParent, boolean onTop) { // Real parent of stack is within display object, so we have to delegate re-parenting there. reparent(newParent, onTop ? POSITION_TOP : POSITION_BOTTOM); newParent.moveStackToDisplay(this, onTop); } } private void updateSurfaceBounds() { private void updateSurfaceBounds() { Loading services/core/java/com/android/server/wm/ActivityStackSupervisor.java +4 −4 Original line number Original line Diff line number Diff line Loading @@ -412,7 +412,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { final ActivityStack stack = (ActivityStack) task; final ActivityStack stack = (ActivityStack) task; stack.setWindowingMode(WINDOWING_MODE_FULLSCREEN); stack.setWindowingMode(WINDOWING_MODE_FULLSCREEN); if (mToDisplay.getDisplayId() != stack.getDisplayId()) { if (mToDisplay.getDisplayId() != stack.getDisplayId()) { mToDisplay.moveStackToDisplay(stack, mOnTop); stack.reparent(mToDisplay.getDefaultTaskDisplayArea(), mOnTop); } else if (mOnTop) { } else if (mOnTop) { mToDisplay.mTaskContainers.positionStackAtTop(stack, mToDisplay.mTaskContainers.positionStackAtTop(stack, false /* includingParents */); false /* includingParents */); Loading Loading @@ -566,8 +566,8 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { } } void moveRecentsStackToFront(String reason) { void moveRecentsStackToFront(String reason) { final ActivityStack recentsStack = mRootWindowContainer.getDefaultDisplay().getStack( final ActivityStack recentsStack = mRootWindowContainer.getDefaultTaskDisplayArea() WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_RECENTS); .getStack(WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_RECENTS); if (recentsStack != null) { if (recentsStack != null) { recentsStack.moveToFront(reason); recentsStack.moveToFront(reason); } } Loading Loading @@ -2613,7 +2613,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { // from whatever is started from the recents activity, so move the home stack // from whatever is started from the recents activity, so move the home stack // forward. // forward. // TODO (b/115289124): Multi-display supports for recents. // TODO (b/115289124): Multi-display supports for recents. mRootWindowContainer.getDefaultDisplay().mTaskContainers.moveHomeStackToFront( mRootWindowContainer.getDefaultTaskDisplayArea().moveHomeStackToFront( "startActivityFromRecents"); "startActivityFromRecents"); } } Loading services/core/java/com/android/server/wm/ActivityTaskManagerService.java +4 −4 Original line number Original line Diff line number Diff line Loading @@ -4283,9 +4283,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { long ident = Binder.clearCallingIdentity(); long ident = Binder.clearCallingIdentity(); try { try { synchronized (mGlobalLock) { synchronized (mGlobalLock) { final DisplayContent dc = mRootWindowContainer.getDefaultDisplay(); final TaskDisplayArea tc = mRootWindowContainer.getDefaultTaskDisplayArea(); final Task primary = dc.getRootSplitScreenPrimaryTask(); final Task primary = tc.getRootSplitScreenPrimaryTask(); final Task secondary = dc.getTask(t -> t.mCreatedByOrganizer && t.isRootTask() final Task secondary = tc.getTask(t -> t.mCreatedByOrganizer && t.isRootTask() && t.inSplitScreenSecondaryWindowingMode()); && t.inSplitScreenSecondaryWindowingMode()); if (primary == null || secondary == null) { if (primary == null || secondary == null) { return; return; Loading @@ -4301,7 +4301,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { if (otherRect == null) { if (otherRect == null) { // Temporary estimation... again this is just for tests. // Temporary estimation... again this is just for tests. otherRect = new Rect(secondary.getBounds()); otherRect = new Rect(secondary.getBounds()); if (dc.getBounds().width() > dc.getBounds().height()) { if (tc.getBounds().width() > tc.getBounds().height()) { otherRect.left = primaryRect.right + 6; otherRect.left = primaryRect.right + 6; } else { } else { otherRect.top = primaryRect.bottom + 6; otherRect.top = primaryRect.bottom + 6; Loading services/core/java/com/android/server/wm/DisplayAreaPolicyBuilder.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -54,7 +54,7 @@ import java.util.Map; * - DisplayArea.Root * - DisplayArea.Root * - Magnification * - Magnification * - DisplayArea.Tokens (Wallpapers are attached here) * - DisplayArea.Tokens (Wallpapers are attached here) * - TaskContainers * - TaskDisplayArea * - DisplayArea.Tokens (windows above Tasks up to IME are attached here) * - DisplayArea.Tokens (windows above Tasks up to IME are attached here) * - ImeContainers * - ImeContainers * - DisplayArea.Tokens (windows above IME up to TYPE_ACCESSIBILITY_OVERLAY attached here) * - DisplayArea.Tokens (windows above IME up to TYPE_ACCESSIBILITY_OVERLAY attached here) Loading services/core/java/com/android/server/wm/DisplayContent.java +22 −109 Original line number Original line Diff line number Diff line Loading @@ -575,13 +575,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo private RootWindowContainer mRootWindowContainer; private RootWindowContainer mRootWindowContainer; /** * All of the stacks on this display. Order matters, topmost stack is in front of all other * stacks, bottommost behind. Accessed directly by ActivityManager package classes. Any calls * changing the list should also call {@link #onStackOrderChanged()}. */ private ArrayList<OnStackOrderChangedListener> mStackOrderChangedCallbacks = new ArrayList<>(); /** Array of all UIDs that are present on the display. */ /** Array of all UIDs that are present on the display. */ private IntArray mDisplayAccessUIDs = new IntArray(); private IntArray mDisplayAccessUIDs = new IntArray(); Loading Loading @@ -2062,23 +2055,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo return (mDisplay.getFlags() & FLAG_PRIVATE) != 0; return (mDisplay.getFlags() & FLAG_PRIVATE) != 0; } } ActivityStack getRootHomeTask() { return mTaskContainers.getRootHomeTask(); } /** @return The primary split-screen task, and {@code null} otherwise. */ @Nullable ActivityStack getRootSplitScreenPrimaryTask() { return mTaskContainers.getRootSplitScreenPrimaryTask(); } ActivityStack getRootPinnedTask() { return mTaskContainers.getRootPinnedTask(); } boolean hasPinnedTask() { return mTaskContainers.getRootPinnedTask() != null; } /** /** * Returns the topmost stack on the display that is compatible with the input windowing mode and * Returns the topmost stack on the display that is compatible with the input windowing mode and * activity type. Null is no compatible stack on the display. * activity type. Null is no compatible stack on the display. Loading @@ -2095,32 +2071,11 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo return mTaskContainers.mChildren.get(index); return mTaskContainers.mChildren.get(index); } } int getIndexOf(ActivityStack stack) { return mTaskContainers.getIndexOf(stack); } void removeStack(ActivityStack stack) { mTaskContainers.removeChild(stack); } @VisibleForTesting WindowList<ActivityStack> getStacks() { return mTaskContainers.mChildren; } @VisibleForTesting @VisibleForTesting ActivityStack getTopStack() { ActivityStack getTopStack() { return mTaskContainers.getTopStack(); return mTaskContainers.getTopStack(); } } ArrayList<Task> getVisibleTasks() { return mTaskContainers.getVisibleTasks(); } SurfaceControl getSplitScreenDividerAnchor() { return mTaskContainers.getSplitScreenDividerAnchor(); } /** /** * The value is only valid in the scope {@link #onRequestedOverrideConfigurationChanged} of the * The value is only valid in the scope {@link #onRequestedOverrideConfigurationChanged} of the * changing hierarchy and the {@link #onConfigurationChanged} of its children. * changing hierarchy and the {@link #onConfigurationChanged} of its children. Loading Loading @@ -2409,8 +2364,13 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo out.set(mDisplayFrames.mStable); out.set(mDisplayFrames.mStable); } } void moveStackToDisplay(ActivityStack stack, boolean onTop) { /** stack.reparent(mTaskContainers, onTop ? POSITION_TOP: POSITION_BOTTOM); * Get the default display area on the display dedicated to app windows. This one should be used * only as a fallback location for activity launches when no target display area is specified, * or for cases when multi-instance is not supported yet (like Split-screen, PiP or Recents). */ TaskDisplayArea getDefaultTaskDisplayArea() { return mTaskContainers; } } @Override @Override Loading Loading @@ -2473,7 +2433,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo */ */ Task findTaskForResizePoint(int x, int y) { Task findTaskForResizePoint(int x, int y) { final int delta = dipToPixel(RESIZE_HANDLE_WIDTH_IN_DP, mDisplayMetrics); final int delta = dipToPixel(RESIZE_HANDLE_WIDTH_IN_DP, mDisplayMetrics); return mTmpTaskForResizePointSearchResult.process(mTaskContainers, x, y, delta); return mTmpTaskForResizePointSearchResult.process(getDefaultTaskDisplayArea(), x, y, delta); } } void updateTouchExcludeRegion() { void updateTouchExcludeRegion() { Loading Loading @@ -2512,8 +2472,9 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo mTouchExcludeRegion.op(mTmpRegion, Region.Op.UNION); mTouchExcludeRegion.op(mTmpRegion, Region.Op.UNION); } } amendWindowTapExcludeRegion(mTouchExcludeRegion); amendWindowTapExcludeRegion(mTouchExcludeRegion); // TODO(multi-display): Support docked stacks on secondary displays. // TODO(multi-display): Support docked stacks on secondary displays & task containers. if (mDisplayId == DEFAULT_DISPLAY && mTaskContainers.isSplitScreenModeActivated()) { if (mDisplayId == DEFAULT_DISPLAY && getDefaultTaskDisplayArea().isSplitScreenModeActivated()) { mDividerControllerLocked.getTouchRegion(mTmpRect); mDividerControllerLocked.getTouchRegion(mTmpRect); mTmpRegion.set(mTmpRect); mTmpRegion.set(mTmpRect); mTouchExcludeRegion.op(mTmpRegion, Op.UNION); mTouchExcludeRegion.op(mTmpRegion, Op.UNION); Loading Loading @@ -2908,20 +2869,22 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo pw.println(); pw.println(); // Dump stack references // Dump stack references final ActivityStack homeStack = getRootHomeTask(); final ActivityStack homeStack = getDefaultTaskDisplayArea().getRootHomeTask(); if (homeStack != null) { if (homeStack != null) { pw.println(prefix + "homeStack=" + homeStack.getName()); pw.println(prefix + "homeStack=" + homeStack.getName()); } } final ActivityStack pinnedStack = getRootPinnedTask(); final ActivityStack pinnedStack = getDefaultTaskDisplayArea().getRootPinnedTask(); if (pinnedStack != null) { if (pinnedStack != null) { pw.println(prefix + "pinnedStack=" + pinnedStack.getName()); pw.println(prefix + "pinnedStack=" + pinnedStack.getName()); } } final ActivityStack splitScreenPrimaryStack = getRootSplitScreenPrimaryTask(); final ActivityStack splitScreenPrimaryStack = getDefaultTaskDisplayArea() .getRootSplitScreenPrimaryTask(); if (splitScreenPrimaryStack != null) { if (splitScreenPrimaryStack != null) { pw.println(prefix + "splitScreenPrimaryStack=" + splitScreenPrimaryStack.getName()); pw.println(prefix + "splitScreenPrimaryStack=" + splitScreenPrimaryStack.getName()); } } final ActivityStack recentsStack = // TODO: Support recents on non-default task containers getStack(WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_RECENTS); final ActivityStack recentsStack = getDefaultTaskDisplayArea().getStack( WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_RECENTS); if (recentsStack != null) { if (recentsStack != null) { pw.println(prefix + "recentsStack=" + recentsStack.getName()); pw.println(prefix + "recentsStack=" + recentsStack.getName()); } } Loading Loading @@ -2955,12 +2918,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo return "Display " + mDisplayId + " name=\"" + mDisplayInfo.name + "\""; return "Display " + mDisplayId + " name=\"" + mDisplayInfo.name + "\""; } } /** Returns true if the stack in the windowing mode is visible. */ boolean isStackVisible(int windowingMode) { final ActivityStack stack = mTaskContainers.getTopStackInWindowingMode(windowingMode); return stack != null && stack.isVisible(); } /** Find the visible, touch-deliverable window under the given point */ /** Find the visible, touch-deliverable window under the given point */ WindowState getTouchableWinAtPointLocked(float xf, float yf) { WindowState getTouchableWinAtPointLocked(float xf, float yf) { final int x = (int) xf; final int x = (int) xf; Loading Loading @@ -4367,7 +4324,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo // We skip IME windows so they're processed just above their target, except // We skip IME windows so they're processed just above their target, except // in split-screen mode where we process the IME containers above the docked divider. // in split-screen mode where we process the IME containers above the docked divider. return dc.mInputMethodTarget != null return dc.mInputMethodTarget != null && !dc.mTaskContainers.isSplitScreenModeActivated(); && !dc.getDefaultTaskDisplayArea().isSplitScreenModeActivated(); } } /** Like {@link #forAllWindows}, but ignores {@link #skipImeWindowsDuringTraversal} */ /** Like {@link #forAllWindows}, but ignores {@link #skipImeWindowsDuringTraversal} */ Loading Loading @@ -5262,7 +5219,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo // released (no more ActivityStack). But, we cannot release it at that moment or the // released (no more ActivityStack). But, we cannot release it at that moment or the // related WindowContainer will also be removed. So, we set display as removed after // related WindowContainer will also be removed. So, we set display as removed after // reparenting stack finished. // reparenting stack finished. final DisplayContent toDisplay = mRootWindowContainer.getDefaultDisplay(); final TaskDisplayArea toTaskDisplayArea = mRootWindowContainer.getDefaultTaskDisplayArea(); mRootWindowContainer.mStackSupervisor.beginDeferResume(); mRootWindowContainer.mStackSupervisor.beginDeferResume(); try { try { int numStacks = getStackCount(); int numStacks = getStackCount(); Loading @@ -5276,10 +5233,10 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo // If default display is in split-window mode, set windowing mode of the stack // If default display is in split-window mode, set windowing mode of the stack // to split-screen secondary. Otherwise, set the windowing mode to undefined by // to split-screen secondary. Otherwise, set the windowing mode to undefined by // default to let stack inherited the windowing mode from the new display. // default to let stack inherited the windowing mode from the new display. final int windowingMode = toDisplay.mTaskContainers.isSplitScreenModeActivated() final int windowingMode = toTaskDisplayArea.isSplitScreenModeActivated() ? WINDOWING_MODE_SPLIT_SCREEN_SECONDARY ? WINDOWING_MODE_SPLIT_SCREEN_SECONDARY : WINDOWING_MODE_UNDEFINED; : WINDOWING_MODE_UNDEFINED; stack.reparent(toDisplay, true /* onTop */); stack.reparent(toTaskDisplayArea, true /* onTop */); stack.setWindowingMode(windowingMode); stack.setWindowingMode(windowingMode); lastReparentedStack = stack; lastReparentedStack = stack; } } Loading Loading @@ -5392,34 +5349,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo mSleeping = asleep; mSleeping = asleep; } } /** * Adds a listener to be notified whenever the stack order in the display changes. Currently * only used by the {@link RecentsAnimation} to determine whether to interrupt and cancel the * current animation when the system state changes. */ void registerStackOrderChangedListener(OnStackOrderChangedListener listener) { if (!mStackOrderChangedCallbacks.contains(listener)) { mStackOrderChangedCallbacks.add(listener); } } /** * Removes a previously registered stack order change listener. */ void unregisterStackOrderChangedListener(OnStackOrderChangedListener listener) { mStackOrderChangedCallbacks.remove(listener); } /** * Notifies of a stack order change * @param stack The stack which triggered the order change */ void onStackOrderChanged(ActivityStack stack) { for (int i = mStackOrderChangedCallbacks.size() - 1; i >= 0; i--) { mStackOrderChangedCallbacks.get(i).onStackOrderChanged(stack); } } void setDisplayToSingleTaskInstance() { void setDisplayToSingleTaskInstance() { final int childCount = getStackCount(); final int childCount = getStackCount(); if (childCount > 1) { if (childCount > 1) { Loading Loading @@ -5447,22 +5376,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo forAllTasks((t) -> { t.getStack().removeChild(t, "removeAllTasks"); }); forAllTasks((t) -> { t.getStack().removeChild(t, "removeAllTasks"); }); } } /** * Callback for when the order of the stacks in the display changes. */ interface OnStackOrderChangedListener { void onStackOrderChanged(ActivityStack stack); } public void dumpStacks(PrintWriter pw) { for (int i = getStackCount() - 1; i >= 0; --i) { pw.print(getStackAt(i).getRootTaskId()); if (i > 0) { pw.print(","); } } } /** /** * Similar to {@link RootWindowContainer#isAnyNonToastWindowVisibleForUid(int)}, but * Similar to {@link RootWindowContainer#isAnyNonToastWindowVisibleForUid(int)}, but * used for pid. * used for pid. Loading Loading
services/core/java/com/android/server/wm/ActivityStack.java +2 −3 Original line number Original line Diff line number Diff line Loading @@ -3553,9 +3553,8 @@ class ActivityStack extends Task { } } } } void reparent(DisplayContent newParent, boolean onTop) { void reparent(TaskDisplayArea newParent, boolean onTop) { // Real parent of stack is within display object, so we have to delegate re-parenting there. reparent(newParent, onTop ? POSITION_TOP : POSITION_BOTTOM); newParent.moveStackToDisplay(this, onTop); } } private void updateSurfaceBounds() { private void updateSurfaceBounds() { Loading
services/core/java/com/android/server/wm/ActivityStackSupervisor.java +4 −4 Original line number Original line Diff line number Diff line Loading @@ -412,7 +412,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { final ActivityStack stack = (ActivityStack) task; final ActivityStack stack = (ActivityStack) task; stack.setWindowingMode(WINDOWING_MODE_FULLSCREEN); stack.setWindowingMode(WINDOWING_MODE_FULLSCREEN); if (mToDisplay.getDisplayId() != stack.getDisplayId()) { if (mToDisplay.getDisplayId() != stack.getDisplayId()) { mToDisplay.moveStackToDisplay(stack, mOnTop); stack.reparent(mToDisplay.getDefaultTaskDisplayArea(), mOnTop); } else if (mOnTop) { } else if (mOnTop) { mToDisplay.mTaskContainers.positionStackAtTop(stack, mToDisplay.mTaskContainers.positionStackAtTop(stack, false /* includingParents */); false /* includingParents */); Loading Loading @@ -566,8 +566,8 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { } } void moveRecentsStackToFront(String reason) { void moveRecentsStackToFront(String reason) { final ActivityStack recentsStack = mRootWindowContainer.getDefaultDisplay().getStack( final ActivityStack recentsStack = mRootWindowContainer.getDefaultTaskDisplayArea() WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_RECENTS); .getStack(WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_RECENTS); if (recentsStack != null) { if (recentsStack != null) { recentsStack.moveToFront(reason); recentsStack.moveToFront(reason); } } Loading Loading @@ -2613,7 +2613,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { // from whatever is started from the recents activity, so move the home stack // from whatever is started from the recents activity, so move the home stack // forward. // forward. // TODO (b/115289124): Multi-display supports for recents. // TODO (b/115289124): Multi-display supports for recents. mRootWindowContainer.getDefaultDisplay().mTaskContainers.moveHomeStackToFront( mRootWindowContainer.getDefaultTaskDisplayArea().moveHomeStackToFront( "startActivityFromRecents"); "startActivityFromRecents"); } } Loading
services/core/java/com/android/server/wm/ActivityTaskManagerService.java +4 −4 Original line number Original line Diff line number Diff line Loading @@ -4283,9 +4283,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { long ident = Binder.clearCallingIdentity(); long ident = Binder.clearCallingIdentity(); try { try { synchronized (mGlobalLock) { synchronized (mGlobalLock) { final DisplayContent dc = mRootWindowContainer.getDefaultDisplay(); final TaskDisplayArea tc = mRootWindowContainer.getDefaultTaskDisplayArea(); final Task primary = dc.getRootSplitScreenPrimaryTask(); final Task primary = tc.getRootSplitScreenPrimaryTask(); final Task secondary = dc.getTask(t -> t.mCreatedByOrganizer && t.isRootTask() final Task secondary = tc.getTask(t -> t.mCreatedByOrganizer && t.isRootTask() && t.inSplitScreenSecondaryWindowingMode()); && t.inSplitScreenSecondaryWindowingMode()); if (primary == null || secondary == null) { if (primary == null || secondary == null) { return; return; Loading @@ -4301,7 +4301,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { if (otherRect == null) { if (otherRect == null) { // Temporary estimation... again this is just for tests. // Temporary estimation... again this is just for tests. otherRect = new Rect(secondary.getBounds()); otherRect = new Rect(secondary.getBounds()); if (dc.getBounds().width() > dc.getBounds().height()) { if (tc.getBounds().width() > tc.getBounds().height()) { otherRect.left = primaryRect.right + 6; otherRect.left = primaryRect.right + 6; } else { } else { otherRect.top = primaryRect.bottom + 6; otherRect.top = primaryRect.bottom + 6; Loading
services/core/java/com/android/server/wm/DisplayAreaPolicyBuilder.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -54,7 +54,7 @@ import java.util.Map; * - DisplayArea.Root * - DisplayArea.Root * - Magnification * - Magnification * - DisplayArea.Tokens (Wallpapers are attached here) * - DisplayArea.Tokens (Wallpapers are attached here) * - TaskContainers * - TaskDisplayArea * - DisplayArea.Tokens (windows above Tasks up to IME are attached here) * - DisplayArea.Tokens (windows above Tasks up to IME are attached here) * - ImeContainers * - ImeContainers * - DisplayArea.Tokens (windows above IME up to TYPE_ACCESSIBILITY_OVERLAY attached here) * - DisplayArea.Tokens (windows above IME up to TYPE_ACCESSIBILITY_OVERLAY attached here) Loading
services/core/java/com/android/server/wm/DisplayContent.java +22 −109 Original line number Original line Diff line number Diff line Loading @@ -575,13 +575,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo private RootWindowContainer mRootWindowContainer; private RootWindowContainer mRootWindowContainer; /** * All of the stacks on this display. Order matters, topmost stack is in front of all other * stacks, bottommost behind. Accessed directly by ActivityManager package classes. Any calls * changing the list should also call {@link #onStackOrderChanged()}. */ private ArrayList<OnStackOrderChangedListener> mStackOrderChangedCallbacks = new ArrayList<>(); /** Array of all UIDs that are present on the display. */ /** Array of all UIDs that are present on the display. */ private IntArray mDisplayAccessUIDs = new IntArray(); private IntArray mDisplayAccessUIDs = new IntArray(); Loading Loading @@ -2062,23 +2055,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo return (mDisplay.getFlags() & FLAG_PRIVATE) != 0; return (mDisplay.getFlags() & FLAG_PRIVATE) != 0; } } ActivityStack getRootHomeTask() { return mTaskContainers.getRootHomeTask(); } /** @return The primary split-screen task, and {@code null} otherwise. */ @Nullable ActivityStack getRootSplitScreenPrimaryTask() { return mTaskContainers.getRootSplitScreenPrimaryTask(); } ActivityStack getRootPinnedTask() { return mTaskContainers.getRootPinnedTask(); } boolean hasPinnedTask() { return mTaskContainers.getRootPinnedTask() != null; } /** /** * Returns the topmost stack on the display that is compatible with the input windowing mode and * Returns the topmost stack on the display that is compatible with the input windowing mode and * activity type. Null is no compatible stack on the display. * activity type. Null is no compatible stack on the display. Loading @@ -2095,32 +2071,11 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo return mTaskContainers.mChildren.get(index); return mTaskContainers.mChildren.get(index); } } int getIndexOf(ActivityStack stack) { return mTaskContainers.getIndexOf(stack); } void removeStack(ActivityStack stack) { mTaskContainers.removeChild(stack); } @VisibleForTesting WindowList<ActivityStack> getStacks() { return mTaskContainers.mChildren; } @VisibleForTesting @VisibleForTesting ActivityStack getTopStack() { ActivityStack getTopStack() { return mTaskContainers.getTopStack(); return mTaskContainers.getTopStack(); } } ArrayList<Task> getVisibleTasks() { return mTaskContainers.getVisibleTasks(); } SurfaceControl getSplitScreenDividerAnchor() { return mTaskContainers.getSplitScreenDividerAnchor(); } /** /** * The value is only valid in the scope {@link #onRequestedOverrideConfigurationChanged} of the * The value is only valid in the scope {@link #onRequestedOverrideConfigurationChanged} of the * changing hierarchy and the {@link #onConfigurationChanged} of its children. * changing hierarchy and the {@link #onConfigurationChanged} of its children. Loading Loading @@ -2409,8 +2364,13 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo out.set(mDisplayFrames.mStable); out.set(mDisplayFrames.mStable); } } void moveStackToDisplay(ActivityStack stack, boolean onTop) { /** stack.reparent(mTaskContainers, onTop ? POSITION_TOP: POSITION_BOTTOM); * Get the default display area on the display dedicated to app windows. This one should be used * only as a fallback location for activity launches when no target display area is specified, * or for cases when multi-instance is not supported yet (like Split-screen, PiP or Recents). */ TaskDisplayArea getDefaultTaskDisplayArea() { return mTaskContainers; } } @Override @Override Loading Loading @@ -2473,7 +2433,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo */ */ Task findTaskForResizePoint(int x, int y) { Task findTaskForResizePoint(int x, int y) { final int delta = dipToPixel(RESIZE_HANDLE_WIDTH_IN_DP, mDisplayMetrics); final int delta = dipToPixel(RESIZE_HANDLE_WIDTH_IN_DP, mDisplayMetrics); return mTmpTaskForResizePointSearchResult.process(mTaskContainers, x, y, delta); return mTmpTaskForResizePointSearchResult.process(getDefaultTaskDisplayArea(), x, y, delta); } } void updateTouchExcludeRegion() { void updateTouchExcludeRegion() { Loading Loading @@ -2512,8 +2472,9 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo mTouchExcludeRegion.op(mTmpRegion, Region.Op.UNION); mTouchExcludeRegion.op(mTmpRegion, Region.Op.UNION); } } amendWindowTapExcludeRegion(mTouchExcludeRegion); amendWindowTapExcludeRegion(mTouchExcludeRegion); // TODO(multi-display): Support docked stacks on secondary displays. // TODO(multi-display): Support docked stacks on secondary displays & task containers. if (mDisplayId == DEFAULT_DISPLAY && mTaskContainers.isSplitScreenModeActivated()) { if (mDisplayId == DEFAULT_DISPLAY && getDefaultTaskDisplayArea().isSplitScreenModeActivated()) { mDividerControllerLocked.getTouchRegion(mTmpRect); mDividerControllerLocked.getTouchRegion(mTmpRect); mTmpRegion.set(mTmpRect); mTmpRegion.set(mTmpRect); mTouchExcludeRegion.op(mTmpRegion, Op.UNION); mTouchExcludeRegion.op(mTmpRegion, Op.UNION); Loading Loading @@ -2908,20 +2869,22 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo pw.println(); pw.println(); // Dump stack references // Dump stack references final ActivityStack homeStack = getRootHomeTask(); final ActivityStack homeStack = getDefaultTaskDisplayArea().getRootHomeTask(); if (homeStack != null) { if (homeStack != null) { pw.println(prefix + "homeStack=" + homeStack.getName()); pw.println(prefix + "homeStack=" + homeStack.getName()); } } final ActivityStack pinnedStack = getRootPinnedTask(); final ActivityStack pinnedStack = getDefaultTaskDisplayArea().getRootPinnedTask(); if (pinnedStack != null) { if (pinnedStack != null) { pw.println(prefix + "pinnedStack=" + pinnedStack.getName()); pw.println(prefix + "pinnedStack=" + pinnedStack.getName()); } } final ActivityStack splitScreenPrimaryStack = getRootSplitScreenPrimaryTask(); final ActivityStack splitScreenPrimaryStack = getDefaultTaskDisplayArea() .getRootSplitScreenPrimaryTask(); if (splitScreenPrimaryStack != null) { if (splitScreenPrimaryStack != null) { pw.println(prefix + "splitScreenPrimaryStack=" + splitScreenPrimaryStack.getName()); pw.println(prefix + "splitScreenPrimaryStack=" + splitScreenPrimaryStack.getName()); } } final ActivityStack recentsStack = // TODO: Support recents on non-default task containers getStack(WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_RECENTS); final ActivityStack recentsStack = getDefaultTaskDisplayArea().getStack( WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_RECENTS); if (recentsStack != null) { if (recentsStack != null) { pw.println(prefix + "recentsStack=" + recentsStack.getName()); pw.println(prefix + "recentsStack=" + recentsStack.getName()); } } Loading Loading @@ -2955,12 +2918,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo return "Display " + mDisplayId + " name=\"" + mDisplayInfo.name + "\""; return "Display " + mDisplayId + " name=\"" + mDisplayInfo.name + "\""; } } /** Returns true if the stack in the windowing mode is visible. */ boolean isStackVisible(int windowingMode) { final ActivityStack stack = mTaskContainers.getTopStackInWindowingMode(windowingMode); return stack != null && stack.isVisible(); } /** Find the visible, touch-deliverable window under the given point */ /** Find the visible, touch-deliverable window under the given point */ WindowState getTouchableWinAtPointLocked(float xf, float yf) { WindowState getTouchableWinAtPointLocked(float xf, float yf) { final int x = (int) xf; final int x = (int) xf; Loading Loading @@ -4367,7 +4324,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo // We skip IME windows so they're processed just above their target, except // We skip IME windows so they're processed just above their target, except // in split-screen mode where we process the IME containers above the docked divider. // in split-screen mode where we process the IME containers above the docked divider. return dc.mInputMethodTarget != null return dc.mInputMethodTarget != null && !dc.mTaskContainers.isSplitScreenModeActivated(); && !dc.getDefaultTaskDisplayArea().isSplitScreenModeActivated(); } } /** Like {@link #forAllWindows}, but ignores {@link #skipImeWindowsDuringTraversal} */ /** Like {@link #forAllWindows}, but ignores {@link #skipImeWindowsDuringTraversal} */ Loading Loading @@ -5262,7 +5219,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo // released (no more ActivityStack). But, we cannot release it at that moment or the // released (no more ActivityStack). But, we cannot release it at that moment or the // related WindowContainer will also be removed. So, we set display as removed after // related WindowContainer will also be removed. So, we set display as removed after // reparenting stack finished. // reparenting stack finished. final DisplayContent toDisplay = mRootWindowContainer.getDefaultDisplay(); final TaskDisplayArea toTaskDisplayArea = mRootWindowContainer.getDefaultTaskDisplayArea(); mRootWindowContainer.mStackSupervisor.beginDeferResume(); mRootWindowContainer.mStackSupervisor.beginDeferResume(); try { try { int numStacks = getStackCount(); int numStacks = getStackCount(); Loading @@ -5276,10 +5233,10 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo // If default display is in split-window mode, set windowing mode of the stack // If default display is in split-window mode, set windowing mode of the stack // to split-screen secondary. Otherwise, set the windowing mode to undefined by // to split-screen secondary. Otherwise, set the windowing mode to undefined by // default to let stack inherited the windowing mode from the new display. // default to let stack inherited the windowing mode from the new display. final int windowingMode = toDisplay.mTaskContainers.isSplitScreenModeActivated() final int windowingMode = toTaskDisplayArea.isSplitScreenModeActivated() ? WINDOWING_MODE_SPLIT_SCREEN_SECONDARY ? WINDOWING_MODE_SPLIT_SCREEN_SECONDARY : WINDOWING_MODE_UNDEFINED; : WINDOWING_MODE_UNDEFINED; stack.reparent(toDisplay, true /* onTop */); stack.reparent(toTaskDisplayArea, true /* onTop */); stack.setWindowingMode(windowingMode); stack.setWindowingMode(windowingMode); lastReparentedStack = stack; lastReparentedStack = stack; } } Loading Loading @@ -5392,34 +5349,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo mSleeping = asleep; mSleeping = asleep; } } /** * Adds a listener to be notified whenever the stack order in the display changes. Currently * only used by the {@link RecentsAnimation} to determine whether to interrupt and cancel the * current animation when the system state changes. */ void registerStackOrderChangedListener(OnStackOrderChangedListener listener) { if (!mStackOrderChangedCallbacks.contains(listener)) { mStackOrderChangedCallbacks.add(listener); } } /** * Removes a previously registered stack order change listener. */ void unregisterStackOrderChangedListener(OnStackOrderChangedListener listener) { mStackOrderChangedCallbacks.remove(listener); } /** * Notifies of a stack order change * @param stack The stack which triggered the order change */ void onStackOrderChanged(ActivityStack stack) { for (int i = mStackOrderChangedCallbacks.size() - 1; i >= 0; i--) { mStackOrderChangedCallbacks.get(i).onStackOrderChanged(stack); } } void setDisplayToSingleTaskInstance() { void setDisplayToSingleTaskInstance() { final int childCount = getStackCount(); final int childCount = getStackCount(); if (childCount > 1) { if (childCount > 1) { Loading Loading @@ -5447,22 +5376,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo forAllTasks((t) -> { t.getStack().removeChild(t, "removeAllTasks"); }); forAllTasks((t) -> { t.getStack().removeChild(t, "removeAllTasks"); }); } } /** * Callback for when the order of the stacks in the display changes. */ interface OnStackOrderChangedListener { void onStackOrderChanged(ActivityStack stack); } public void dumpStacks(PrintWriter pw) { for (int i = getStackCount() - 1; i >= 0; --i) { pw.print(getStackAt(i).getRootTaskId()); if (i > 0) { pw.print(","); } } } /** /** * Similar to {@link RootWindowContainer#isAnyNonToastWindowVisibleForUid(int)}, but * Similar to {@link RootWindowContainer#isAnyNonToastWindowVisibleForUid(int)}, but * used for pid. * used for pid. Loading