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

Commit 73d4b44c authored by Chong Zhang's avatar Chong Zhang
Browse files

Update dock stack create mode after rotation if dock side changed

On some devices (such as tablets) dock stack could be created on top,
but put to right after rotation. Dock create mode needs to be updated
in this case, otherwise when a new stack is attached to the display
(for example launch into now-cropped fullscreen stack),
attachDisplayContent() will use wrong dock mode to derive the bounds.

bug: 28942558
Change-Id: I83e66aeac94bd3f96c4b6a0a740acf76234bbe82
parent b143e3de
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
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.HOME_STACK_ID;
import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
@@ -403,6 +404,13 @@ public class TaskStack implements DimLayer.DimLayerUser,
            snapDockedStackAfterRotation(mTmpRect2);
            final int newDockSide = getDockSide(mTmpRect2);
            if (oldDockSide != newDockSide) {
                // 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);
            }
        }
+6 −2
Original line number Diff line number Diff line
@@ -4960,10 +4960,14 @@ public class WindowManagerService extends IWindowManager.Stub

    public void setDockedStackCreateState(int mode, Rect bounds) {
        synchronized (mWindowMap) {
            setDockedStackCreateStateLocked(mode, bounds);
        }
    }

    void setDockedStackCreateStateLocked(int mode, Rect bounds) {
        mDockedStackCreateMode = mode;
        mDockedStackCreateBounds = bounds;
    }
    }

    /**
     * Create a new TaskStack and place it on a DisplayContent.