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

Commit f175e8a6 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Report re-sized stacks/task as fullscreen when docked stack isn't visible

When a docked stack exist we resize all other stacks and crop their
window content to the stack size. This was also been done when the
docked stack exist, but not visible. E.g the primary user has a docked
stack, but the secondary user doesn't, so the windows of the secondary
user get cropped.
We now report stacks/task sizes as fullscreen whenever the docked stack
isn't visible.

Bug: 24366804
Change-Id: Ia3f24e6f7d33fc175348e27db24a15ce3027e6f7
parent 40233739
Loading
Loading
Loading
Loading
+32 −6
Original line number Diff line number Diff line
@@ -245,8 +245,32 @@ class Task implements DimLayer.DimLayerUser {
        return true;
    }

    /** Return true if the current bound can get outputted to the rest of the system as-is. */
    private boolean useCurrentBounds() {
        final DisplayContent displayContent = mStack.getDisplayContent();
        if (mFullscreen
                || mStack.mStackId == FREEFORM_WORKSPACE_STACK_ID
                || mStack.mStackId == DOCKED_STACK_ID
                || displayContent == null
                || displayContent.getDockedStackLocked() != null) {
            return true;
        }
        return false;
    }

    /** Bounds of the task with other system factors taken into consideration. */
    void getBounds(Rect out) {
        if (useCurrentBounds()) {
            // No need to adjust the output bounds if fullscreen or the docked stack is visible
            // since it is already what we want to represent to the rest of the system.
            out.set(mBounds);
            return;
        }

        // The bounds has been adjusted to accommodate for a docked stack, but the docked stack
        // is not currently visible. Go ahead a represent it as fullscreen to the rest of the
        // system.
        mStack.getDisplayContent().getLogicalDisplayRect(out);
    }

    void setDragResizing(boolean dragResizing) {
@@ -433,10 +457,6 @@ class Task implements DimLayer.DimLayerUser {
        return mStack != null && mStack.mStackId == FREEFORM_WORKSPACE_STACK_ID;
    }

    boolean inDockedWorkspace() {
        return mStack != null && mStack.mStackId == DOCKED_STACK_ID;
    }

    WindowState getTopAppMainWindow() {
        final int tokensCount = mAppTokens.size();
        return tokensCount > 0 ? mAppTokens.get(tokensCount - 1).findMainWindow() : null;
@@ -444,8 +464,14 @@ class Task implements DimLayer.DimLayerUser {

    @Override
    public boolean isFullscreen() {
        if (useCurrentBounds()) {
            return mFullscreen;
        }
        // The bounds has been adjusted to accommodate for a docked stack, but the docked stack
        // is not currently visible. Go ahead a represent it as fullscreen to the rest of the
        // system.
        return true;
    }

    @Override
    public DisplayInfo getDisplayInfo() {
+46 −2
Original line number Diff line number Diff line
@@ -181,8 +181,38 @@ public class TaskStack implements DimLayer.DimLayerUser {
        return true;
    }

    /** Bounds of the stack without adjusting for other factors in the system like visibility
     * of docked stack.
     * Most callers should be using {@link #getBounds} as it take into consideration other system
     * factors. */
    void getRawBounds(Rect out) {
        out.set(mBounds);
    }

    /** Return true if the current bound can get outputted to the rest of the system as-is. */
    private boolean useCurrentBounds() {
        if (mFullscreen
                || mStackId == DOCKED_STACK_ID
                || mDisplayContent == null
                || mDisplayContent.getDockedStackLocked() != null) {
            return true;
        }
        return false;
    }

    /** Bounds of the stack with other system factors taken into consideration. */
    void getBounds(Rect out) {
        if (useCurrentBounds()) {
            // No need to adjust the output bounds if fullscreen or the docked stack is visible
            // since it is already what we want to represent to the rest of the system.
            out.set(mBounds);
            return;
        }

        // The bounds has been adjusted to accommodate for a docked stack, but the docked stack
        // is not currently visible. Go ahead a represent it as fullscreen to the rest of the
        // system.
        mDisplayContent.getLogicalDisplayRect(out);
    }

    void updateDisplayInfo(Rect bounds) {
@@ -520,10 +550,24 @@ public class TaskStack implements DimLayer.DimLayerUser {
        }
    }

    /** Fullscreen status of the stack without adjusting for other factors in the system like
     * visibility of docked stack.
     * Most callers should be using {@link #isFullscreen} as it take into consideration other
     * system factors. */
    boolean getRawFullscreen() {
        return mFullscreen;
    }

    @Override
    public boolean isFullscreen() {
        if (useCurrentBounds()) {
            return mFullscreen;
        }
        // The bounds has been adjusted to accommodate for a docked stack, but the docked stack
        // is not currently visible. Go ahead a represent it as fullscreen to the rest of the
        // system.
        return true;
    }

    @Override
    public DisplayInfo getDisplayInfo() {
+3 −3
Original line number Diff line number Diff line
@@ -4517,11 +4517,11 @@ public class WindowManagerService extends IWindowManager.Stub
                    for (int winNdx = windows.size() - 1; winNdx >= 0; --winNdx) {
                        windows.get(winNdx).reportResized();
                    }
                    if (stack.isFullscreen()) {
                    if (stack.getRawFullscreen()) {
                        return null;
                    }
                    Rect bounds = new Rect();
                    stack.getBounds(bounds);
                    stack.getRawBounds(bounds);
                    return bounds;
                }
            }
@@ -4644,7 +4644,7 @@ public class WindowManagerService extends IWindowManager.Stub
                stack.getDisplayContent().layoutNeeded = true;
                mWindowPlacerLocked.performSurfacePlacement();
            }
            return stack.isFullscreen();
            return stack.getRawFullscreen();
        }
    }