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

Commit 961f4858 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Window resize reporting improvement when docked stack is created

There were a few issues with window resize reporting when a docked
stack is created that caused the client to get frames for fulscreen
even though the task was in split-screen mode.

- Ignore docked stack visibility when get bounds for other stack when
resizing due to docked stack.
- Immediately resize all other stacks in activity manager when the
docked stack is attached to the display.
- Defer surface layouts for the uncheck portion of moving a task to a
stack.
- Don't perform layout of all windows on a display when a stack is
attached to the display since it doesn't have any windows yet.

Bug: 26861802
Change-Id: I2c7f31153da48618e90607c98ec5b29492b6ef38
parent 22e2526b
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -395,6 +395,13 @@ final class ActivityStack {
            mTaskPositioner.setDisplay(activityDisplay.mDisplay);
            mTaskPositioner.configure(mBounds);
        }

        if (mStackId == DOCKED_STACK_ID) {
            // If we created a docked stack we want to resize it so it resizes all other stacks
            // in the system.
            mStackSupervisor.resizeDockedStackLocked(
                    mBounds, null, null, null, null, PRESERVE_WINDOWS);
        }
    }

    void detachDisplay() {
+25 −20
Original line number Diff line number Diff line
@@ -1989,7 +1989,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
                // We get the bounds to use from window manager which has been adjusted for any
                // screen controls and is also the same for all stacks.
                mWindowManager.getStackDockedModeBounds(
                        HOME_STACK_ID, tempRect, true /* ignoreVisibilityOnKeyguardShowing */);
                        HOME_STACK_ID, tempRect, true /* ignoreVisibility */);
                for (int i = FIRST_STATIC_STACK_ID; i <= LAST_STATIC_STACK_ID; i++) {
                    if (StackId.isResizeableByDockedStack(i)) {
                        ActivityStack otherStack = getStack(i);
@@ -2256,7 +2256,11 @@ public final class ActivityStackSupervisor implements DisplayListener {
            // during the relaunch. If we end up not doing any relaunch, we clear the flags later.
            mWindowManager.setReplacingWindow(topActivity.appToken, animate);
        }

        mWindowManager.deferSurfaceLayout();
        final int preferredLaunchStackId = stackId;
        boolean kept = true;
        try {
            final ActivityStack stack = moveTaskToStackUncheckedLocked(
                    task, stackId, toTop, forceFocus, "moveTaskToStack:" + reason);
            stackId = stack.mStackId;
@@ -2265,8 +2269,6 @@ public final class ActivityStackSupervisor implements DisplayListener {
                stack.mNoAnimActivities.add(topActivity);
            }

        boolean kept = true;

            // We might trigger a configuration change. Save the current task bounds for freezing.
            mWindowManager.prepareFreezingTaskBounds(stack.mStackId);

@@ -2280,6 +2282,9 @@ public final class ActivityStackSupervisor implements DisplayListener {
            } else if (stackId == DOCKED_STACK_ID || stackId == PINNED_STACK_ID) {
                kept = resizeTaskLocked(task, stack.mBounds, RESIZE_MODE_SYSTEM, !mightReplaceWindow);
            }
        } finally {
            mWindowManager.continueSurfaceLayout();
        }

        if (mightReplaceWindow) {
            // If we didn't actual do a relaunch (indicated by kept==true meaning we kept the old
+3 −10
Original line number Diff line number Diff line
@@ -586,7 +586,7 @@ public class TaskStack implements DimLayer.DimLayerUser,
        }
    }

    void getStackDockedModeBoundsLocked(Rect outBounds, boolean ignoreVisibilityOnKeyguardShowing) {
    void getStackDockedModeBoundsLocked(Rect outBounds, boolean ignoreVisibility) {
        if (!StackId.isResizeableByDockedStack(mStackId) || mDisplayContent == null) {
            outBounds.set(mBounds);
            return;
@@ -598,7 +598,7 @@ public class TaskStack implements DimLayer.DimLayerUser,
            throw new IllegalStateException(
                    "Calling getStackDockedModeBoundsLocked() when there is no docked stack.");
        }
        if (!dockedStack.isVisibleLocked(ignoreVisibilityOnKeyguardShowing)) {
        if (!ignoreVisibility && !dockedStack.isVisibleLocked()) {
            // The docked stack is being dismissed, but we caught before it finished being
            // dismissed. In that case we want to treat it as if it is not occupying any space and
            // let others occupy the whole display.
@@ -883,17 +883,10 @@ public class TaskStack implements DimLayer.DimLayerUser,
    }

    boolean isVisibleLocked() {
        return isVisibleLocked(false);
    }

    boolean isVisibleLocked(boolean ignoreVisibilityOnKeyguardShowing) {
        final boolean keyguardOn = mService.mPolicy.isKeyguardShowingOrOccluded();
        if (keyguardOn && !StackId.isAllowedOverLockscreen(mStackId)) {
            // The keyguard is showing and the stack shouldn't show on top of the keyguard.
            // We return false for visibility except in cases where the caller wants us to return
            // true for visibility when the keyguard is showing. One example, is if the docked
            // is being resized due to orientation while the keyguard is on.
            return ignoreVisibilityOnKeyguardShowing;
            return false;
        }

        for (int i = mTasks.size() - 1; i >= 0; i--) {
+2 −8
Original line number Diff line number Diff line
@@ -4695,11 +4695,6 @@ public class WindowManagerService extends IWindowManager.Stub
                    }
                    stack.attachDisplayContent(displayContent);
                    displayContent.attachStack(stack, onTop);
                    moveStackWindowsLocked(displayContent);
                    final WindowList windows = displayContent.getWindowList();
                    for (int winNdx = windows.size() - 1; winNdx >= 0; --winNdx) {
                        windows.get(winNdx).reportResized();
                    }
                    if (stack.getRawFullscreen()) {
                        return null;
                    }
@@ -4814,12 +4809,11 @@ public class WindowManagerService extends IWindowManager.Stub
        }
    }

    public void getStackDockedModeBounds(
            int stackId, Rect bounds, boolean ignoreVisibilityOnKeyguardShowing) {
    public void getStackDockedModeBounds(int stackId, Rect bounds, boolean ignoreVisibility) {
        synchronized (mWindowMap) {
            final TaskStack stack = mStackIdToStack.get(stackId);
            if (stack != null) {
                stack.getStackDockedModeBoundsLocked(bounds, ignoreVisibilityOnKeyguardShowing);
                stack.getStackDockedModeBoundsLocked(bounds, ignoreVisibility);
                return;
            }
            bounds.setEmpty();