Merge "DisplayCutout: make dock divider cutout aware" into pi-dev

This commit is contained in:
Adrian Roos
2018-03-21 12:52:15 +00:00
committed by Android (Google) Code Review
2 changed files with 12 additions and 4 deletions

View File

@@ -28,6 +28,7 @@ import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
import static android.view.WindowManager.LayoutParams.FLAG_SLIPPERY;
import static android.view.WindowManager.LayoutParams.FLAG_SPLIT_TOUCH;
import static android.view.WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION;
import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;
@@ -55,6 +56,7 @@ public class DividerWindowManager {
mLp.token = new Binder();
mLp.setTitle(WINDOW_TITLE);
mLp.privateFlags |= PRIVATE_FLAG_NO_MOVE_ANIMATION;
mLp.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);

View File

@@ -1032,15 +1032,21 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
if (mAttrs.type == TYPE_DOCK_DIVIDER) {
// For the docked divider, we calculate the stable insets like a full-screen window
// so it can use it to calculate the snap positions.
mStableInsets.set(Math.max(mStableFrame.left - mDisplayFrame.left, 0),
Math.max(mStableFrame.top - mDisplayFrame.top, 0),
Math.max(mDisplayFrame.right - mStableFrame.right, 0),
Math.max(mDisplayFrame.bottom - mStableFrame.bottom, 0));
final WmDisplayCutout c = displayCutout.calculateRelativeTo(mDisplayFrame);
mTmpRect.set(mDisplayFrame);
mTmpRect.inset(c.getDisplayCutout().getSafeInsets());
mTmpRect.intersectUnchecked(mStableFrame);
mStableInsets.set(Math.max(mTmpRect.left - mDisplayFrame.left, 0),
Math.max(mTmpRect.top - mDisplayFrame.top, 0),
Math.max(mDisplayFrame.right - mTmpRect.right, 0),
Math.max(mDisplayFrame.bottom - mTmpRect.bottom, 0));
// The divider doesn't care about insets in any case, so set it to empty so we don't
// trigger a relayout when moving it.
mContentInsets.setEmpty();
mVisibleInsets.setEmpty();
displayCutout = WmDisplayCutout.NO_CUTOUT;
} else {
getDisplayContent().getBounds(mTmpRect);
// Override right and/or bottom insets in case if the frame doesn't fit the screen in