diff options
8 files changed, 115 insertions, 75 deletions
diff --git a/core/proto/android/server/windowmanagerservice.proto b/core/proto/android/server/windowmanagerservice.proto index 710fe3d6e3e9..b0ea5e09a232 100644 --- a/core/proto/android/server/windowmanagerservice.proto +++ b/core/proto/android/server/windowmanagerservice.proto @@ -315,7 +315,8 @@ message WindowStateProto { optional .android.graphics.RectProto visible_insets = 30; optional .android.graphics.RectProto stable_insets = 31; optional .android.graphics.RectProto outsets = 32; - optional .android.view.DisplayCutoutProto cutout = 33; + reserved 33; +// optional .android.view.DisplayCutoutProto cutout = 33; optional bool remove_on_exit = 34; optional bool destroying = 35; optional bool removed = 36; @@ -399,4 +400,5 @@ message WindowFramesProto { optional .android.graphics.RectProto overscan_frame = 7; optional .android.graphics.RectProto parent_frame = 8; optional .android.graphics.RectProto visible_frame = 9; + optional .android.view.DisplayCutoutProto cutout = 10; } diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index 66bd16e21720..b1dd36af434d 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -4652,6 +4652,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { mDockLayer = 0x10000000; mStatusBarLayer = -1; + mWindowFrames.setDisplayCutout(displayFrames.mDisplayCutout); + mWindowFrames.setParentFrameWasClippedByDisplayCutout(false); + if (displayFrames.mDisplayId == DEFAULT_DISPLAY) { // For purposes of putting out fake window up to steal focus, we will // drive nav being hidden only by whether it is requested. @@ -4735,8 +4738,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { continue; } - w.computeFrameLw(mWindowFrames, displayFrames.mDisplayCutout, - false /* parentFrameWasClippedByDisplayCutout */); + w.computeFrameLw(mWindowFrames); final Rect frame = w.getFrameLw(); if (frame.left <= 0 && frame.top <= 0) { @@ -4798,8 +4800,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { mStatusBarLayer = mStatusBar.getSurfaceLayer(); // Let the status bar determine its size. - mStatusBar.computeFrameLw(mWindowFrames, displayFrames.mDisplayCutout, - false /* parentFrameWasClippedByDisplayCutout */); + mStatusBar.computeFrameLw(mWindowFrames); // For layout, the status bar is always at the top with our fixed height. displayFrames.mStable.top = displayFrames.mUnrestricted.top @@ -4954,8 +4955,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { navigationFrame /* stableFrame */, displayFrames.mDisplayCutoutSafe /* outsetFrame */); - mNavigationBar.computeFrameLw(mWindowFrames, displayFrames.mDisplayCutout, - false /* parentFrameWasClippedByDisplayCutout */); + mNavigationBar.computeFrameLw(mWindowFrames); mNavigationBarController.setContentFrame(mNavigationBar.getContentFrameLw()); if (DEBUG_LAYOUT) Slog.i(TAG, "mNavigationBar frame: " + navigationFrame); @@ -5095,6 +5095,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { final Rect sf = mWindowFrames.mStableFrame; dcf.setEmpty(); mWindowFrames.mOutsetFrame.setEmpty(); + mWindowFrames.setParentFrameWasClippedByDisplayCutout(false); + mWindowFrames.setDisplayCutout(displayFrames.mDisplayCutout); final boolean hasNavBar = (isDefaultDisplay && mHasNavigationBar && mNavigationBar != null && mNavigationBar.isVisibleLw()); @@ -5414,7 +5416,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } - boolean parentFrameWasClippedByDisplayCutout = false; final int cutoutMode = attrs.layoutInDisplayCutoutMode; final boolean attachedInParent = attached != null && !layoutInScreen; final boolean requestedHideNavigation = @@ -5465,7 +5466,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (!attachedInParent && !floatingInScreenWindow) { mTmpRect.set(pf); pf.intersectUnchecked(displayCutoutSafeExceptMaybeBars); - parentFrameWasClippedByDisplayCutout |= !mTmpRect.equals(pf); + mWindowFrames.setParentFrameWasClippedByDisplayCutout(!mTmpRect.equals(pf)); } // Make sure that NO_LIMITS windows clipped to the display don't extend under the // cutout. @@ -5523,8 +5524,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { + " sf=" + sf.toShortString() + " osf=" + mWindowFrames.mOutsetFrame.toShortString()); - win.computeFrameLw(mWindowFrames, displayFrames.mDisplayCutout, - parentFrameWasClippedByDisplayCutout); + win.computeFrameLw(mWindowFrames); // Dock windows carve out the bottom of the screen, so normal windows // can't appear underneath them. if (type == TYPE_INPUT_METHOD && win.isVisibleLw() diff --git a/services/core/java/com/android/server/policy/WindowManagerPolicy.java b/services/core/java/com/android/server/policy/WindowManagerPolicy.java index cc5f730116e6..bf53daffce8f 100644 --- a/services/core/java/com/android/server/policy/WindowManagerPolicy.java +++ b/services/core/java/com/android/server/policy/WindowManagerPolicy.java @@ -201,12 +201,8 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants { * * @param windowFrames Container for all the window frames that affect how the window is * laid out. - * @param displayCutout the display cutout - * @param parentFrameWasClippedByDisplayCutout true if the parent frame would have been - * different if there was no display cutout. */ - public void computeFrameLw(WindowFrames windowFrames, WmDisplayCutout displayCutout, - boolean parentFrameWasClippedByDisplayCutout); + public void computeFrameLw(WindowFrames windowFrames); /** * Retrieve the current frame of the window that has been assigned by diff --git a/services/core/java/com/android/server/wm/WindowFrames.java b/services/core/java/com/android/server/wm/WindowFrames.java index 25317bb69768..5f41df72394a 100644 --- a/services/core/java/com/android/server/wm/WindowFrames.java +++ b/services/core/java/com/android/server/wm/WindowFrames.java @@ -18,6 +18,7 @@ package com.android.server.wm; import static com.android.server.wm.WindowFramesProto.CONTAINING_FRAME; import static com.android.server.wm.WindowFramesProto.CONTENT_FRAME; +import static com.android.server.wm.WindowFramesProto.CUTOUT; import static com.android.server.wm.WindowFramesProto.DECOR_FRAME; import static com.android.server.wm.WindowFramesProto.DISPLAY_FRAME; import static com.android.server.wm.WindowFramesProto.FRAME; @@ -31,6 +32,9 @@ import android.graphics.Rect; import android.util.proto.ProtoOutputStream; import java.io.PrintWriter; +import android.view.DisplayCutout; + +import com.android.server.wm.utils.WmDisplayCutout; /** * Container class for all the window frames that affect how windows are laid out. @@ -113,6 +117,21 @@ public class WindowFrames { */ final Rect mLastFrame = new Rect(); + /** + * Whether the parent frame would have been different if there was no display cutout. + */ + private boolean mParentFrameWasClippedByDisplayCutout; + + /** + * Part of the display that has been cut away. See {@link DisplayCutout}. + */ + WmDisplayCutout mDisplayCutout = WmDisplayCutout.NO_CUTOUT; + + /** + * The last cutout that has been reported to the client. + */ + WmDisplayCutout mLastDisplayCutout = WmDisplayCutout.NO_CUTOUT; + public WindowFrames() { } @@ -135,6 +154,33 @@ public class WindowFrames { mOutsetFrame.set(outsetFrame); } + public void setParentFrameWasClippedByDisplayCutout( + boolean parentFrameWasClippedByDisplayCutout) { + mParentFrameWasClippedByDisplayCutout = parentFrameWasClippedByDisplayCutout; + } + + boolean parentFrameWasClippedByDisplayCutout() { + return mParentFrameWasClippedByDisplayCutout; + } + + public void setDisplayCutout(WmDisplayCutout displayCutout) { + mDisplayCutout = displayCutout; + } + + /** + * @return true if the width or height has changed since last reported to the client. + */ + boolean didFrameSizeChange() { + return (mLastFrame.width() != mFrame.width()) || (mLastFrame.height() != mFrame.height()); + } + + /** + * @return true if the display cutout has changed since last reported to the client. + */ + boolean didDisplayCutoutChange() { + return !mLastDisplayCutout.equals(mDisplayCutout); + } + public void writeToProto(@NonNull ProtoOutputStream proto, long fieldId) { final long token = proto.start(fieldId); mParentFrame.writeToProto(proto, PARENT_FRAME); @@ -146,6 +192,7 @@ public class WindowFrames { mOutsetFrame.writeToProto(proto, OUTSET_FRAME); mContainingFrame.writeToProto(proto, CONTAINING_FRAME); mFrame.writeToProto(proto, FRAME); + mDisplayCutout.getDisplayCutout().writeToProto(proto, CUTOUT); proto.end(token); } @@ -171,6 +218,8 @@ public class WindowFrames { pw.print(prefix); pw.print("mFrame="); mFrame.printShortString(pw); pw.print(" last="); mLastFrame.printShortString(pw); pw.println(); + pw.print(prefix); pw.print(" cutout=" + mDisplayCutout.getDisplayCutout()); + pw.print(" last=" + mLastDisplayCutout.getDisplayCutout()); + pw.println(); } - } diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 51238aa038d7..aa3924228179 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -2164,7 +2164,7 @@ public class WindowManagerService extends IWindowManager.Stub win.mLastRelayoutContentInsets.set(win.mContentInsets); outVisibleInsets.set(win.mVisibleInsets); outStableInsets.set(win.mStableInsets); - outCutout.set(win.mDisplayCutout.getDisplayCutout()); + outCutout.set(win.getWmDisplayCutout().getDisplayCutout()); outOutsets.set(win.mOutsets); outBackdropFrame.set(win.getBackdropFrame(win.getFrameLw())); if (localLOGV) Slog.v( diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index d5afaba76285..a09541478672 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -120,7 +120,6 @@ import static com.android.server.wm.WindowStateProto.ANIMATOR; import static com.android.server.wm.WindowStateProto.ATTRIBUTES; import static com.android.server.wm.WindowStateProto.CHILD_WINDOWS; import static com.android.server.wm.WindowStateProto.CONTENT_INSETS; -import static com.android.server.wm.WindowStateProto.CUTOUT; import static com.android.server.wm.WindowStateProto.DESTROYING; import static com.android.server.wm.WindowStateProto.DISPLAY_ID; import static com.android.server.wm.WindowStateProto.GIVEN_CONTENT_INSETS; @@ -350,9 +349,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP private final Rect mLastOutsets = new Rect(); private boolean mOutsetsChanged = false; - /** Part of the display that has been cut away. See {@link DisplayCutout}. */ - WmDisplayCutout mDisplayCutout = WmDisplayCutout.NO_CUTOUT; - private WmDisplayCutout mLastDisplayCutout = WmDisplayCutout.NO_CUTOUT; private boolean mDisplayCutoutChanged; /** @@ -398,9 +394,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // screen size compatibility mode. final Rect mCompatFrame = new Rect(); - /** Whether the parent frame would have been different if there was no display cutout. */ - private boolean mParentFrameWasClippedByDisplayCutout; - private final WindowFrames mWindowFrames = new WindowFrames(); /** @@ -807,8 +800,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP } @Override - public void computeFrameLw(WindowFrames windowFrames, WmDisplayCutout displayCutout, - boolean parentFrameWasClippedByDisplayCutout) { + public void computeFrameLw(WindowFrames windowFrames) { if (mWillReplaceWindow && (mAnimatingExit || !mReplacingRemoveRequested)) { // This window is being replaced and either already got information that it's being // removed or we are still waiting for some information. Because of this we don't @@ -817,7 +809,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP return; } mHaveFrame = true; - mParentFrameWasClippedByDisplayCutout = parentFrameWasClippedByDisplayCutout; + mWindowFrames.setParentFrameWasClippedByDisplayCutout( + windowFrames.parentFrameWasClippedByDisplayCutout()); final Task task = getTask(); final boolean inFullscreenContainer = inFullscreenContainer(); @@ -1033,7 +1026,7 @@ 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. - final WmDisplayCutout c = displayCutout.calculateRelativeTo( + final WmDisplayCutout c = windowFrames.mDisplayCutout.calculateRelativeTo( mWindowFrames.mDisplayFrame); mTmpRect.set(mWindowFrames.mDisplayFrame); mTmpRect.inset(c.getDisplayCutout().getSafeInsets()); @@ -1048,7 +1041,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // trigger a relayout when moving it. mContentInsets.setEmpty(); mVisibleInsets.setEmpty(); - displayCutout = WmDisplayCutout.NO_CUTOUT; + windowFrames.setDisplayCutout(WmDisplayCutout.NO_CUTOUT); } else { getDisplayContent().getBounds(mTmpRect); // Override right and/or bottom insets in case if the frame doesn't fit the screen in @@ -1082,7 +1075,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP mWindowFrames.mFrame.bottom - mWindowFrames.mStableFrame.bottom, 0)); } - mDisplayCutout = displayCutout.calculateRelativeTo(mWindowFrames.mFrame); + + mWindowFrames.setDisplayCutout( + windowFrames.mDisplayCutout.calculateRelativeTo(windowFrames.mFrame)); // Offset the actual frame by the amount layout frame is off. mWindowFrames.mFrame.offset(-layoutXDiff, -layoutYDiff); @@ -1181,6 +1176,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP return mWindowFrames.mContainingFrame; } + WmDisplayCutout getWmDisplayCutout() { + return mWindowFrames.mDisplayCutout; + } + @Override public boolean getGivenInsetsPendingLw() { return mGivenInsetsPending; @@ -1237,9 +1236,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP mVisibleInsetsChanged |= !mLastVisibleInsets.equals(mVisibleInsets); mStableInsetsChanged |= !mLastStableInsets.equals(mStableInsets); mOutsetsChanged |= !mLastOutsets.equals(mOutsets); - mFrameSizeChanged |= (mWindowFrames.mLastFrame.width() != mWindowFrames.mFrame.width()) || - (mWindowFrames.mLastFrame.height() != mWindowFrames.mFrame.height()); - mDisplayCutoutChanged |= !mLastDisplayCutout.equals(mDisplayCutout); + mFrameSizeChanged |= mWindowFrames.didFrameSizeChange(); + mDisplayCutoutChanged |= mWindowFrames.didDisplayCutoutChange(); return mOverscanInsetsChanged || mContentInsetsChanged || mVisibleInsetsChanged || mOutsetsChanged || mFrameSizeChanged || mDisplayCutoutChanged; } @@ -2997,7 +2995,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP final boolean reportDraw = mWinAnimator.mDrawState == DRAW_PENDING; final boolean reportOrientation = mReportOrientationChanged; final int displayId = getDisplayId(); - final DisplayCutout displayCutout = mDisplayCutout.getDisplayCutout(); + final DisplayCutout displayCutout = getWmDisplayCutout().getDisplayCutout(); if (mAttrs.type != WindowManager.LayoutParams.TYPE_APPLICATION_STARTING && mClient instanceof IWindow.Stub) { // To prevent deadlock simulate one-way call if win.mClient is a local object. @@ -3130,7 +3128,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // Only windows with an AppWindowToken are letterboxed. return false; } - if (!mParentFrameWasClippedByDisplayCutout) { + if (!mWindowFrames.parentFrameWasClippedByDisplayCutout()) { // Cutout didn't make a difference, no letterbox return false; } @@ -3274,7 +3272,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP mVisibleInsets.writeToProto(proto, VISIBLE_INSETS); mStableInsets.writeToProto(proto, STABLE_INSETS); mOutsets.writeToProto(proto, OUTSETS); - mDisplayCutout.getDisplayCutout().writeToProto(proto, CUTOUT); proto.write(REMOVE_ON_EXIT, mRemoveOnExit); proto.write(DESTROYING, mDestroying); proto.write(REMOVED, mRemoved); @@ -3404,8 +3401,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP pw.print(" stable="); mStableInsets.printShortString(pw); pw.print(" surface="); mAttrs.surfaceInsets.printShortString(pw); pw.print(" outsets="); mOutsets.printShortString(pw); - pw.print(" cutout=" + mDisplayCutout.getDisplayCutout()); - pw.println(); pw.print(prefix); pw.print("Lst insets: overscan="); mLastOverscanInsets.printShortString(pw); pw.print(" content="); mLastContentInsets.printShortString(pw); @@ -3413,7 +3408,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP pw.print(" stable="); mLastStableInsets.printShortString(pw); pw.print(" physical="); mLastOutsets.printShortString(pw); pw.print(" outset="); mLastOutsets.printShortString(pw); - pw.print(" cutout=" + mLastDisplayCutout); pw.println(); } super.dump(pw, prefix, dumpAll); @@ -4467,7 +4461,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP mLastVisibleInsets.set(mVisibleInsets); mLastStableInsets.set(mStableInsets); mLastOutsets.set(mOutsets); - mLastDisplayCutout = mDisplayCutout; + mWindowFrames.mLastDisplayCutout = mWindowFrames.mDisplayCutout; } void startAnimation(Animation anim) { diff --git a/services/tests/servicestests/src/com/android/server/policy/FakeWindowState.java b/services/tests/servicestests/src/com/android/server/policy/FakeWindowState.java index b4b09c9f5f90..972195d011df 100644 --- a/services/tests/servicestests/src/com/android/server/policy/FakeWindowState.java +++ b/services/tests/servicestests/src/com/android/server/policy/FakeWindowState.java @@ -30,8 +30,7 @@ import com.android.server.wm.utils.WmDisplayCutout; public class FakeWindowState implements WindowManagerPolicy.WindowState { - public WindowFrames windowFrames; - public WmDisplayCutout displayCutout; + private WindowFrames windowFrames; public WindowManager.LayoutParams attrs; public int displayId; @@ -54,10 +53,8 @@ public class FakeWindowState implements WindowManagerPolicy.WindowState { } @Override - public void computeFrameLw(WindowFrames windowFrames, WmDisplayCutout displayCutout, - boolean parentFrameWasClippedByDisplayCutout) { + public void computeFrameLw(WindowFrames windowFrames) { this.windowFrames = windowFrames; - this.displayCutout = displayCutout; } @Override diff --git a/services/tests/servicestests/src/com/android/server/wm/WindowFrameTests.java b/services/tests/servicestests/src/com/android/server/wm/WindowFrameTests.java index 6b410b68c45d..4864332b3714 100644 --- a/services/tests/servicestests/src/com/android/server/wm/WindowFrameTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/WindowFrameTests.java @@ -162,7 +162,7 @@ public class WindowFrameTests extends WindowTestsBase { // the difference between mFrame and ContentFrame. Visible // and stable frames work the same way. final WindowFrames windowFrames = new WindowFrames(pf, df, of, cf, vf, dcf, sf, mEmptyRect); - w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false); + w.computeFrameLw(windowFrames); assertRect(w.getFrameLw(),0, 0, 1000, 1000); assertRect(w.mContentInsets, 0, topContentInset, 0, bottomContentInset); assertRect(w.mVisibleInsets, 0, topVisibleInset, 0, bottomVisibleInset); @@ -177,7 +177,7 @@ public class WindowFrameTests extends WindowTestsBase { w.mAttrs.width = 100; w.mAttrs.height = 100; //have to clear MATCH_PARENT w.mRequestedWidth = 100; w.mRequestedHeight = 100; - w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false); + w.computeFrameLw(windowFrames); assertRect(w.getFrameLw(), 100, 100, 200, 200); assertRect(w.mContentInsets, 0, 0, 0, 0); // In this case the frames are shrunk to the window frame. @@ -199,7 +199,7 @@ public class WindowFrameTests extends WindowTestsBase { // Here the window has FILL_PARENT, FILL_PARENT // so we expect it to fill the entire available frame. final WindowFrames windowFrames = new WindowFrames(pf, pf, pf, pf, pf, pf, pf, pf); - w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false); + w.computeFrameLw(windowFrames); assertRect(w.getFrameLw(), 0, 0, 1000, 1000); // It can select various widths and heights within the bounds. @@ -207,14 +207,14 @@ public class WindowFrameTests extends WindowTestsBase { // and we use mRequestedWidth/mRequestedHeight w.mAttrs.width = 300; w.mAttrs.height = 300; - w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false); + w.computeFrameLw(windowFrames); // Explicit width and height without requested width/height // gets us nothing. assertRect(w.getFrameLw(), 0, 0, 0, 0); w.mRequestedWidth = 300; w.mRequestedHeight = 300; - w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false); + w.computeFrameLw(windowFrames); // With requestedWidth/Height we can freely choose our size within the // parent bounds. assertRect(w.getFrameLw(), 0, 0, 300, 300); @@ -227,14 +227,14 @@ public class WindowFrameTests extends WindowTestsBase { w.mRequestedWidth = -1; w.mAttrs.width = 100; w.mAttrs.height = 100; - w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false); + w.computeFrameLw(windowFrames); assertRect(w.getFrameLw(), 0, 0, 100, 100); w.mAttrs.flags = 0; // But sizes too large will be clipped to the containing frame w.mRequestedWidth = 1200; w.mRequestedHeight = 1200; - w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false); + w.computeFrameLw(windowFrames); assertRect(w.getFrameLw(), 0, 0, 1000, 1000); // Before they are clipped though windows will be shifted @@ -242,7 +242,7 @@ public class WindowFrameTests extends WindowTestsBase { w.mAttrs.y = 300; w.mRequestedWidth = 1000; w.mRequestedHeight = 1000; - w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false); + w.computeFrameLw(windowFrames); assertRect(w.getFrameLw(), 0, 0, 1000, 1000); // If there is room to move around in the parent frame the window will be shifted according @@ -252,16 +252,16 @@ public class WindowFrameTests extends WindowTestsBase { w.mRequestedWidth = 300; w.mRequestedHeight = 300; w.mAttrs.gravity = Gravity.RIGHT | Gravity.TOP; - w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false); + w.computeFrameLw(windowFrames); assertRect(w.getFrameLw(), 700, 0, 1000, 300); w.mAttrs.gravity = Gravity.RIGHT | Gravity.BOTTOM; - w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false); + w.computeFrameLw(windowFrames); assertRect(w.getFrameLw(), 700, 700, 1000, 1000); // Window specified x and y are interpreted as offsets in the opposite // direction of gravity w.mAttrs.x = 100; w.mAttrs.y = 100; - w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false); + w.computeFrameLw(windowFrames); assertRect(w.getFrameLw(), 600, 600, 900, 900); } @@ -283,7 +283,7 @@ public class WindowFrameTests extends WindowTestsBase { final Rect pf = new Rect(0, 0, logicalWidth, logicalHeight); final WindowFrames windowFrames = new WindowFrames(pf, pf, pf, pf, pf, pf, pf, mEmptyRect); - w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false); + w.computeFrameLw(windowFrames); // For non fullscreen tasks the containing frame is based off the // task bounds not the parent frame. assertRect(w.getFrameLw(), taskLeft, taskTop, taskRight, taskBottom); @@ -297,7 +297,7 @@ public class WindowFrameTests extends WindowTestsBase { final Rect cf = new Rect(0, 0, cfRight, cfBottom); windowFrames.setFrames(pf, pf, pf, cf, cf, pf, cf, mEmptyRect); - w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false); + w.computeFrameLw(windowFrames); assertRect(w.getFrameLw(), taskLeft, taskTop, taskRight, taskBottom); int contentInsetRight = taskRight - cfRight; int contentInsetBottom = taskBottom - cfBottom; @@ -316,7 +316,7 @@ public class WindowFrameTests extends WindowTestsBase { task.mInsetBounds.set(insetLeft, insetTop, insetRight, insetBottom); windowFrames.setFrames(pf, pf, pf, cf, cf, pf, cf, mEmptyRect); - w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false); + w.computeFrameLw(windowFrames); assertRect(w.getFrameLw(), taskLeft, taskTop, taskRight, taskBottom); contentInsetRight = insetRight - cfRight; contentInsetBottom = insetBottom - cfBottom; @@ -349,13 +349,13 @@ public class WindowFrameTests extends WindowTestsBase { final Rect policyCrop = new Rect(); final WindowFrames windowFrames = new WindowFrames(pf, df, of, cf, vf, dcf, sf, mEmptyRect); - w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false); + w.computeFrameLw(windowFrames); w.calculatePolicyCrop(policyCrop); assertRect(policyCrop, 0, cf.top, logicalWidth, cf.bottom); windowFrames.mDecorFrame.setEmpty(); // Likewise with no decor frame we would get no crop - w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false); + w.computeFrameLw(windowFrames); w.calculatePolicyCrop(policyCrop); assertRect(policyCrop, 0, 0, logicalWidth, logicalHeight); @@ -370,7 +370,7 @@ public class WindowFrameTests extends WindowTestsBase { w.mAttrs.height = logicalHeight / 2; w.mRequestedWidth = logicalWidth / 2; w.mRequestedHeight = logicalHeight / 2; - w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false); + w.computeFrameLw(windowFrames); w.calculatePolicyCrop(policyCrop); // Normally the crop is shrunk from the decor frame @@ -406,7 +406,7 @@ public class WindowFrameTests extends WindowTestsBase { final Rect pf = new Rect(0, 0, logicalWidth, logicalHeight); final WindowFrames windowFrames = new WindowFrames(pf, pf, pf, pf, pf, pf, pf, mEmptyRect); - w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false); + w.computeFrameLw(windowFrames); // For non fullscreen tasks the containing frame is based off the // task bounds not the parent frame. assertRect(w.getFrameLw(), taskLeft, taskTop, taskRight, taskBottom); @@ -424,7 +424,7 @@ public class WindowFrameTests extends WindowTestsBase { task.mFullscreenForTest = true; windowFrames.setFrames(pf, pf, pf, cf, cf, pf, cf, mEmptyRect); - w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false); + w.computeFrameLw(windowFrames); assertEquals(cf, w.getFrameLw()); assertEquals(cf, w.getContentFrameLw()); assertRect(w.mContentInsets, 0, 0, 0, 0); @@ -443,12 +443,13 @@ public class WindowFrameTests extends WindowTestsBase { fromBoundingRect(500, 0, 550, 50), pf.width(), pf.height()); final WindowFrames windowFrames = new WindowFrames(pf, pf, pf, pf, pf, pf, pf, pf); - w.computeFrameLw(windowFrames, cutout, false); + windowFrames.setDisplayCutout(cutout); + w.computeFrameLw(windowFrames); - assertEquals(w.mDisplayCutout.getDisplayCutout().getSafeInsetTop(), 50); - assertEquals(w.mDisplayCutout.getDisplayCutout().getSafeInsetBottom(), 0); - assertEquals(w.mDisplayCutout.getDisplayCutout().getSafeInsetLeft(), 0); - assertEquals(w.mDisplayCutout.getDisplayCutout().getSafeInsetRight(), 0); + assertEquals(w.getWmDisplayCutout().getDisplayCutout().getSafeInsetTop(), 50); + assertEquals(w.getWmDisplayCutout().getDisplayCutout().getSafeInsetBottom(), 0); + assertEquals(w.getWmDisplayCutout().getDisplayCutout().getSafeInsetLeft(), 0); + assertEquals(w.getWmDisplayCutout().getDisplayCutout().getSafeInsetRight(), 0); } @Test @@ -466,12 +467,13 @@ public class WindowFrameTests extends WindowTestsBase { fromBoundingRect(500, 0, 550, 50), pf.width(), pf.height()); final WindowFrames windowFrames = new WindowFrames(pf, pf, pf, pf, pf, pf, pf, pf); - w.computeFrameLw(windowFrames, cutout, false); + windowFrames.setDisplayCutout(cutout); + w.computeFrameLw(windowFrames); - assertEquals(w.mDisplayCutout.getDisplayCutout().getSafeInsetTop(), 50); - assertEquals(w.mDisplayCutout.getDisplayCutout().getSafeInsetBottom(), 0); - assertEquals(w.mDisplayCutout.getDisplayCutout().getSafeInsetLeft(), 0); - assertEquals(w.mDisplayCutout.getDisplayCutout().getSafeInsetRight(), 0); + assertEquals(w.getWmDisplayCutout().getDisplayCutout().getSafeInsetTop(), 50); + assertEquals(w.getWmDisplayCutout().getDisplayCutout().getSafeInsetBottom(), 0); + assertEquals(w.getWmDisplayCutout().getDisplayCutout().getSafeInsetLeft(), 0); + assertEquals(w.getWmDisplayCutout().getDisplayCutout().getSafeInsetRight(), 0); } private WindowStateWithTask createWindow(Task task, int width, int height) { |