Loading core/java/android/view/WindowManagerPolicy.java +7 −0 Original line number Diff line number Diff line Loading @@ -1362,4 +1362,11 @@ public interface WindowManagerPolicy { */ public void getNonDecorInsetsLw(int displayRotation, int displayWidth, int displayHeight, Rect outInsets); /** * @return True if a specified {@param dockSide} is allowed on the current device, or false * otherwise. It is guaranteed that at least one dock side for a particular orientation * is allowed, so for example, if DOCKED_RIGHT is not allowed, DOCKED_LEFT is allowed. */ public boolean isDockSideAllowed(int dockSide); } services/core/java/com/android/server/policy/PhoneWindowManager.java +14 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,9 @@ import static android.content.pm.PackageManager.FEATURE_TELEVISION; import static android.content.pm.PackageManager.FEATURE_WATCH; import static android.content.res.Configuration.UI_MODE_TYPE_CAR; import static android.content.res.Configuration.UI_MODE_TYPE_MASK; import static android.view.WindowManager.DOCKED_TOP; import static android.view.WindowManager.DOCKED_LEFT; import static android.view.WindowManager.DOCKED_RIGHT; import static android.view.WindowManager.LayoutParams.*; import static android.view.WindowManagerPolicy.WindowManagerFuncs.CAMERA_LENS_COVERED; import static android.view.WindowManagerPolicy.WindowManagerFuncs.CAMERA_LENS_COVER_ABSENT; Loading Loading @@ -6099,6 +6102,17 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } @Override public boolean isDockSideAllowed(int dockSide) { // We do not allow all dock sides at which the navigation bar touches the docked stack. if (!mNavigationBarCanMove) { return dockSide == DOCKED_TOP || dockSide == DOCKED_LEFT || dockSide == DOCKED_RIGHT; } else { return dockSide == DOCKED_TOP || dockSide == DOCKED_LEFT; } } void sendCloseSystemWindows() { PhoneWindow.sendCloseSystemWindows(mContext, null); } Loading services/core/java/com/android/server/wm/TaskStack.java +38 −0 Original line number Diff line number Diff line Loading @@ -352,6 +352,7 @@ public class TaskStack implements DimLayer.DimLayerUser, mDisplayContent.rotateBounds(mRotation, newRotation, mTmpRect2); if (mStackId == DOCKED_STACK_ID) { repositionDockedStackAfterRotation(mTmpRect2); snapDockedStackAfterRotation(mTmpRect2); } Loading @@ -362,6 +363,43 @@ public class TaskStack implements DimLayer.DimLayerUser, RESIZE_STACK, mStackId, 0 /*allowResizeInDockedMode*/, mTmpRect2).sendToTarget(); } /** * Some dock sides are not allowed by the policy. This method queries the policy and moves * the docked stack around if needed. * * @param inOutBounds the bounds of the docked stack to adjust */ private void repositionDockedStackAfterRotation(Rect inOutBounds) { int dockSide = getDockSide(inOutBounds); if (mService.mPolicy.isDockSideAllowed(dockSide)) { return; } mDisplayContent.getLogicalDisplayRect(mTmpRect); dockSide = DockedDividerUtils.invertDockSide(dockSide); switch (dockSide) { case DOCKED_LEFT: int movement = inOutBounds.left; inOutBounds.left -= movement; inOutBounds.right -= movement; break; case DOCKED_RIGHT: movement = mTmpRect.right - inOutBounds.right; inOutBounds.left += movement; inOutBounds.right += movement; break; case DOCKED_TOP: movement = inOutBounds.top; inOutBounds.top -= movement; inOutBounds.bottom -= movement; break; case DOCKED_BOTTOM: movement = mTmpRect.bottom - inOutBounds.bottom; inOutBounds.top += movement; inOutBounds.bottom += movement; break; } } /** * Snaps the bounds after rotation to the closest snap target for the docked stack. */ Loading Loading
core/java/android/view/WindowManagerPolicy.java +7 −0 Original line number Diff line number Diff line Loading @@ -1362,4 +1362,11 @@ public interface WindowManagerPolicy { */ public void getNonDecorInsetsLw(int displayRotation, int displayWidth, int displayHeight, Rect outInsets); /** * @return True if a specified {@param dockSide} is allowed on the current device, or false * otherwise. It is guaranteed that at least one dock side for a particular orientation * is allowed, so for example, if DOCKED_RIGHT is not allowed, DOCKED_LEFT is allowed. */ public boolean isDockSideAllowed(int dockSide); }
services/core/java/com/android/server/policy/PhoneWindowManager.java +14 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,9 @@ import static android.content.pm.PackageManager.FEATURE_TELEVISION; import static android.content.pm.PackageManager.FEATURE_WATCH; import static android.content.res.Configuration.UI_MODE_TYPE_CAR; import static android.content.res.Configuration.UI_MODE_TYPE_MASK; import static android.view.WindowManager.DOCKED_TOP; import static android.view.WindowManager.DOCKED_LEFT; import static android.view.WindowManager.DOCKED_RIGHT; import static android.view.WindowManager.LayoutParams.*; import static android.view.WindowManagerPolicy.WindowManagerFuncs.CAMERA_LENS_COVERED; import static android.view.WindowManagerPolicy.WindowManagerFuncs.CAMERA_LENS_COVER_ABSENT; Loading Loading @@ -6099,6 +6102,17 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } @Override public boolean isDockSideAllowed(int dockSide) { // We do not allow all dock sides at which the navigation bar touches the docked stack. if (!mNavigationBarCanMove) { return dockSide == DOCKED_TOP || dockSide == DOCKED_LEFT || dockSide == DOCKED_RIGHT; } else { return dockSide == DOCKED_TOP || dockSide == DOCKED_LEFT; } } void sendCloseSystemWindows() { PhoneWindow.sendCloseSystemWindows(mContext, null); } Loading
services/core/java/com/android/server/wm/TaskStack.java +38 −0 Original line number Diff line number Diff line Loading @@ -352,6 +352,7 @@ public class TaskStack implements DimLayer.DimLayerUser, mDisplayContent.rotateBounds(mRotation, newRotation, mTmpRect2); if (mStackId == DOCKED_STACK_ID) { repositionDockedStackAfterRotation(mTmpRect2); snapDockedStackAfterRotation(mTmpRect2); } Loading @@ -362,6 +363,43 @@ public class TaskStack implements DimLayer.DimLayerUser, RESIZE_STACK, mStackId, 0 /*allowResizeInDockedMode*/, mTmpRect2).sendToTarget(); } /** * Some dock sides are not allowed by the policy. This method queries the policy and moves * the docked stack around if needed. * * @param inOutBounds the bounds of the docked stack to adjust */ private void repositionDockedStackAfterRotation(Rect inOutBounds) { int dockSide = getDockSide(inOutBounds); if (mService.mPolicy.isDockSideAllowed(dockSide)) { return; } mDisplayContent.getLogicalDisplayRect(mTmpRect); dockSide = DockedDividerUtils.invertDockSide(dockSide); switch (dockSide) { case DOCKED_LEFT: int movement = inOutBounds.left; inOutBounds.left -= movement; inOutBounds.right -= movement; break; case DOCKED_RIGHT: movement = mTmpRect.right - inOutBounds.right; inOutBounds.left += movement; inOutBounds.right += movement; break; case DOCKED_TOP: movement = inOutBounds.top; inOutBounds.top -= movement; inOutBounds.bottom -= movement; break; case DOCKED_BOTTOM: movement = mTmpRect.bottom - inOutBounds.bottom; inOutBounds.top += movement; inOutBounds.bottom += movement; break; } } /** * Snaps the bounds after rotation to the closest snap target for the docked stack. */ Loading