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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user