Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 08900edb authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix issue with split screen launch bounds" into pi-dev

parents 9e04425f 985f54da
Loading
Loading
Loading
Loading
+31 −15
Original line number Diff line number Diff line
@@ -800,7 +800,21 @@ public class TaskStack extends WindowContainer<Task> implements
    }

    private void updateBoundsForWindowModeChange() {
        Rect bounds = null;
        final Rect bounds = calculateBoundsForWindowModeChange();

        if (inSplitScreenSecondaryWindowingMode()) {
            // When the stack is resized due to entering split screen secondary, offset the
            // windows to compensate for the new stack position.
            forAllWindows(w -> {
                w.mWinAnimator.setOffsetPositionForStackResize(true);
            }, true);
        }

        updateDisplayInfo(bounds);
        updateSurfaceBounds();
    }

    private Rect calculateBoundsForWindowModeChange() {
        final boolean inSplitScreenPrimary = inSplitScreenPrimaryWindowingMode();
        final TaskStack splitScreenStack =
                mDisplayContent.getSplitScreenPrimaryStackIgnoringVisibility();
@@ -810,35 +824,37 @@ public class TaskStack extends WindowContainer<Task> implements
            // the docked stack occupies a dedicated region on screen, but only if the dock stack is
            // not fullscreen. If it's fullscreen, it means that we are in the transition of
            // dismissing it, so we must not resize this stack.
            bounds = new Rect();
            final Rect bounds = new Rect();
            mDisplayContent.getBounds(mTmpRect);
            mTmpRect2.setEmpty();
            if (splitScreenStack != null) {
                if (inSplitScreenSecondaryWindowingMode()
                        && mDisplayContent.mDividerControllerLocked.isMinimizedDock()
                        && splitScreenStack.getTopChild() != null) {
                    // If the primary split screen stack is currently minimized, then don't use the
                    // stack bounds of the minimized stack, instead, use the temporary task bounds
                    // to calculate the appropriate uniminized size of any secondary split stack
                    // TODO: Find a cleaner way for computing new stack bounds while minimized that
                    //       doesn't assume the primary stack's task bounds as the temp task bounds
                    splitScreenStack.getTopChild().getBounds(mTmpRect2);
                } else {
                    splitScreenStack.getRawBounds(mTmpRect2);
                }
            }
            final boolean dockedOnTopOrLeft = mService.mDockedStackCreateMode
                    == SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT;
            getStackDockedModeBounds(mTmpRect, bounds, mTmpRect2,
                    mDisplayContent.mDividerControllerLocked.getContentWidth(), dockedOnTopOrLeft);
            return bounds;
        } else if (inPinnedWindowingMode()) {
            // Update the bounds based on any changes to the display info
            getAnimationOrCurrentBounds(mTmpRect2);
            if (mDisplayContent.mPinnedStackControllerLocked.onTaskStackBoundsChanged(
                    mTmpRect2, mTmpRect3)) {
                bounds = new Rect(mTmpRect3);
                return new Rect(mTmpRect3);
            }
        }

        if (inSplitScreenSecondaryWindowingMode()) {
            // When the stack is resized due to entering split screen secondary, offset the
            // windows to compensate for the new stack position.
            forAllWindows(w -> {
                w.mWinAnimator.setOffsetPositionForStackResize(true);
            }, true);
        }

        updateDisplayInfo(bounds);
        updateSurfaceBounds();
        return null;
    }

    /**