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

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

Fix split-screen visible apps issue when screen is rotated on lockscreen

When the keyguard is showing we say the docked stack is invisible so that
any activity that displays on top of the keyguard isn't cropped by the
docked stack. However this causes issues when the docked stack is resized
due to orientation change while the keyguard is showing.
We now ignore the visibility state of the docked stack when trying to get
bounds information for resizing while the keyguard is showing.

Bug: 25970565
Change-Id: I7479a1d0afed3b2edfb17848c56c5c3902b3709e
parent cbc5bd57
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1940,7 +1940,8 @@ public final class ActivityStackSupervisor implements DisplayListener {
                // static stacks need to be adjusted so they don't overlap with the docked stack.
                // 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);
                mWindowManager.getStackDockedModeBounds(
                        HOME_STACK_ID, tempRect, true /* ignoreVisibilityOnKeyguardShowing */);
                for (int i = FIRST_STATIC_STACK_ID; i <= LAST_STATIC_STACK_ID; i++) {
                    if (StackId.isResizeableByDockedStack(i)) {
                        ActivityStack otherStack = getStack(i);
+3 −4
Original line number Diff line number Diff line
@@ -425,7 +425,7 @@ class Task implements DimLayer.DimLayerUser {
    }

    /** Original bounds of the task if applicable, otherwise fullscreen rect. */
    public void getBounds(Rect out) {
    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.
@@ -433,9 +433,8 @@ class Task implements DimLayer.DimLayerUser {
            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.
        // 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);
    }

+13 −4
Original line number Diff line number Diff line
@@ -491,7 +491,7 @@ public class TaskStack implements DimLayer.DimLayerUser {
        }
    }

    void getStackDockedModeBoundsLocked(Rect outBounds) {
    void getStackDockedModeBoundsLocked(Rect outBounds, boolean ignoreVisibilityOnKeyguardShowing) {
        if (!StackId.isResizeableByDockedStack(mStackId) || mDisplayContent == null) {
            outBounds.set(mBounds);
            return;
@@ -503,11 +503,11 @@ public class TaskStack implements DimLayer.DimLayerUser {
            throw new IllegalStateException(
                    "Calling getStackDockedModeBoundsLocked() when there is no docked stack.");
        }
        if (!dockedStack.isVisibleLocked()) {
        if (!dockedStack.isVisibleLocked(ignoreVisibilityOnKeyguardShowing)) {
            // 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.
            mDisplayContent.getLogicalDisplayRect(mTmpRect);
            mDisplayContent.getLogicalDisplayRect(outBounds);
            return;
        }

@@ -788,10 +788,19 @@ 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)) {
            return false;
            // 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;
        }

        for (int i = mTasks.size() - 1; i >= 0; i--) {
            Task task = mTasks.get(i);
            for (int j = task.mAppTokens.size() - 1; j >= 0; j--) {
+3 −2
Original line number Diff line number Diff line
@@ -4795,11 +4795,12 @@ public class WindowManagerService extends IWindowManager.Stub
        }
    }

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