diff options
Diffstat (limited to 'com/android/server/wm/TaskStack.java')
-rw-r--r-- | com/android/server/wm/TaskStack.java | 93 |
1 files changed, 47 insertions, 46 deletions
diff --git a/com/android/server/wm/TaskStack.java b/com/android/server/wm/TaskStack.java index 65278837..d170b6f2 100644 --- a/com/android/server/wm/TaskStack.java +++ b/com/android/server/wm/TaskStack.java @@ -18,8 +18,6 @@ package com.android.server.wm; import static android.app.ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT; import static android.app.ActivityManager.DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT; -import static android.app.ActivityManager.StackId.DOCKED_STACK_ID; -import static android.app.ActivityManager.StackId.PINNED_STACK_ID; import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT; import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS; @@ -296,7 +294,7 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye if (mFillsParent || !inSplitScreenSecondaryWindowingMode() || mDisplayContent == null - || mDisplayContent.getDockedStackLocked() != null) { + || mDisplayContent.getSplitScreenPrimaryStackStack() != null) { return true; } return false; @@ -409,7 +407,7 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye return false; } - if (mStackId == PINNED_STACK_ID) { + if (inPinnedWindowingMode()) { getAnimationOrCurrentBounds(mTmpRect2); boolean updated = mDisplayContent.mPinnedStackControllerLocked.onTaskStackBoundsChanged( mTmpRect2, mTmpRect3); @@ -443,21 +441,19 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye mTmpRect2.set(mBounds); mDisplayContent.rotateBounds(mRotation, newRotation, mTmpRect2); - switch (mStackId) { - case DOCKED_STACK_ID: - repositionDockedStackAfterRotation(mTmpRect2); - snapDockedStackAfterRotation(mTmpRect2); - final int newDockSide = getDockSide(mTmpRect2); - - // Update the dock create mode and clear the dock create bounds, these - // might change after a rotation and the original values will be invalid. - mService.setDockedStackCreateStateLocked( - (newDockSide == DOCKED_LEFT || newDockSide == DOCKED_TOP) - ? DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT - : DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT, - null); - mDisplayContent.getDockedDividerController().notifyDockSideChanged(newDockSide); - break; + if (inSplitScreenPrimaryWindowingMode()) { + repositionDockedStackAfterRotation(mTmpRect2); + snapDockedStackAfterRotation(mTmpRect2); + final int newDockSide = getDockSide(mTmpRect2); + + // Update the dock create mode and clear the dock create bounds, these + // might change after a rotation and the original values will be invalid. + mService.setDockedStackCreateStateLocked( + (newDockSide == DOCKED_LEFT || newDockSide == DOCKED_TOP) + ? DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT + : DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT, + null); + mDisplayContent.getDockedDividerController().notifyDockSideChanged(newDockSide); } mBoundsAfterRotation.set(mTmpRect2); @@ -677,6 +673,16 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye } } + @Override + public void onConfigurationChanged(Configuration newParentConfig) { + final int prevWindowingMode = getWindowingMode(); + super.onConfigurationChanged(newParentConfig); + if (mDisplayContent != null && prevWindowingMode != getWindowingMode()) { + mDisplayContent.onStackWindowingModeChanged(this); + } + } + + @Override void onDisplayChanged(DisplayContent dc) { if (mDisplayContent != null) { throw new IllegalStateException("onDisplayChanged: Already attached"); @@ -687,8 +693,8 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye "animation background stackId=" + mStackId); Rect bounds = null; - final TaskStack dockedStack = dc.getDockedStackIgnoringVisibility(); - if (mStackId == DOCKED_STACK_ID + final TaskStack dockedStack = dc.getSplitScreenPrimaryStackStackIgnoringVisibility(); + if (inSplitScreenPrimaryWindowingMode() || (dockedStack != null && inSplitScreenSecondaryWindowingMode() && !dockedStack.fillsParent())) { // The existence of a docked stack affects the size of other static stack created since @@ -703,10 +709,10 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye } final boolean dockedOnTopOrLeft = mService.mDockedStackCreateMode == DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT; - getStackDockedModeBounds(mTmpRect, bounds, mStackId, mTmpRect2, + getStackDockedModeBounds(mTmpRect, bounds, mTmpRect2, mDisplayContent.mDividerControllerLocked.getContentWidth(), dockedOnTopOrLeft); - } else if (mStackId == PINNED_STACK_ID) { + } else if (inPinnedWindowingMode()) { // Update the bounds based on any changes to the display info getAnimationOrCurrentBounds(mTmpRect2); boolean updated = mDisplayContent.mPinnedStackControllerLocked.onTaskStackBoundsChanged( @@ -766,7 +772,8 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye return; } - final TaskStack dockedStack = mDisplayContent.getDockedStackIgnoringVisibility(); + final TaskStack dockedStack = + mDisplayContent.getSplitScreenPrimaryStackStackIgnoringVisibility(); if (dockedStack == null) { // Not sure why you are calling this method when there is no docked stack... throw new IllegalStateException( @@ -791,7 +798,7 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye mDisplayContent.getLogicalDisplayRect(mTmpRect); dockedStack.getRawBounds(mTmpRect2); final boolean dockedOnTopOrLeft = dockedSide == DOCKED_TOP || dockedSide == DOCKED_LEFT; - getStackDockedModeBounds(mTmpRect, outStackBounds, mStackId, mTmpRect2, + getStackDockedModeBounds(mTmpRect, outStackBounds, mTmpRect2, mDisplayContent.mDividerControllerLocked.getContentWidth(), dockedOnTopOrLeft); } @@ -800,16 +807,15 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye * Outputs the bounds a stack should be given the presence of a docked stack on the display. * @param displayRect The bounds of the display the docked stack is on. * @param outBounds Output bounds that should be used for the stack. - * @param stackId Id of stack we are calculating the bounds for. * @param dockedBounds Bounds of the docked stack. * @param dockDividerWidth We need to know the width of the divider make to the output bounds * close to the side of the dock. * @param dockOnTopOrLeft If the docked stack is on the top or left side of the screen. */ private void getStackDockedModeBounds( - Rect displayRect, Rect outBounds, int stackId, Rect dockedBounds, int dockDividerWidth, + Rect displayRect, Rect outBounds, Rect dockedBounds, int dockDividerWidth, boolean dockOnTopOrLeft) { - final boolean dockedStack = stackId == DOCKED_STACK_ID; + final boolean dockedStack = inSplitScreenPrimaryWindowingMode(); final boolean splitHorizontally = displayRect.width() > displayRect.height(); outBounds.set(displayRect); @@ -866,7 +872,7 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye } void resetDockedStackToMiddle() { - if (mStackId != DOCKED_STACK_ID) { + if (inSplitScreenPrimaryWindowingMode()) { throw new IllegalStateException("Not a docked stack=" + this); } @@ -894,17 +900,12 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye } @Override - void removeImmediately() { - super.removeImmediately(); - - onRemovedFromDisplay(); - } + void onParentSet() { + if (getParent() != null || mDisplayContent == null) { + return; + } - /** - * Removes the stack it from its current parent, so it can be either destroyed completely or - * re-parented. - */ - void onRemovedFromDisplay() { + // Looks like the stack was removed from the display. Go ahead and clean things up. mDisplayContent.mDimLayerController.removeDimLayerUser(this); EventLog.writeEvent(EventLogTags.WM_STACK_REMOVED, mStackId); @@ -913,7 +914,7 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye mAnimationBackgroundSurface = null; } - if (mStackId == DOCKED_STACK_ID) { + if (inSplitScreenPrimaryWindowingMode()) { mDisplayContent.mDividerControllerLocked.notifyDockedStackExistsChanged(false); } @@ -1035,8 +1036,8 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye } boolean shouldIgnoreInput() { - return isAdjustedForMinimizedDockedStack() || mStackId == DOCKED_STACK_ID && - isMinimizedDockAndHomeStackResizable(); + return isAdjustedForMinimizedDockedStack() || + (inSplitScreenPrimaryWindowingMode() && isMinimizedDockAndHomeStackResizable()); } /** @@ -1471,7 +1472,7 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye postExclude.set(mTmpRect); } - final boolean isFreeformed = task.inFreeformWorkspace(); + final boolean isFreeformed = task.inFreeformWindowingMode(); if (task != focusedTask || isFreeformed) { if (isFreeformed) { // If the task is freeformed, enlarge the area to account for outside @@ -1529,7 +1530,7 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye } } - if (mStackId == PINNED_STACK_ID) { + if (inPinnedWindowingMode()) { try { mService.mActivityManager.notifyPinnedStackAnimationStarted(); } catch (RemoteException e) { @@ -1561,7 +1562,7 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye mService.requestTraversal(); } - if (mStackId == PINNED_STACK_ID) { + if (inPinnedWindowingMode()) { // Update to the final bounds if requested. This is done here instead of in the bounds // animator to allow us to coordinate this after we notify the PiP mode changed @@ -1595,7 +1596,7 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye * bounds and we have a deferred PiP mode changed callback set with the animation. */ public boolean deferScheduleMultiWindowModeChanged() { - if (mStackId == PINNED_STACK_ID) { + if (inPinnedWindowingMode()) { return (mBoundsAnimatingRequested || mBoundsAnimating); } return false; |