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
This commit is contained in:
Chong Zhang
2016-05-25 14:30:36 -07:00
parent b143e3de34
commit 73d4b44ce3
2 changed files with 14 additions and 2 deletions

View File

@@ -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);
}
}

View File

@@ -4960,11 +4960,15 @@ public class WindowManagerService extends IWindowManager.Stub
public void setDockedStackCreateState(int mode, Rect bounds) {
synchronized (mWindowMap) {
mDockedStackCreateMode = mode;
mDockedStackCreateBounds = bounds;
setDockedStackCreateStateLocked(mode, bounds);
}
}
void setDockedStackCreateStateLocked(int mode, Rect bounds) {
mDockedStackCreateMode = mode;
mDockedStackCreateBounds = bounds;
}
/**
* Create a new TaskStack and place it on a DisplayContent.
* @param stackId The unique identifier of the new stack.