Loading core/proto/android/server/windowmanagerservice.proto +3 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } services/core/java/com/android/server/policy/PhoneWindowManager.java +10 −10 Original line number Diff line number Diff line Loading @@ -4636,6 +4636,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. Loading Loading @@ -4719,8 +4722,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) { Loading Loading @@ -4782,8 +4784,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 Loading Loading @@ -4938,8 +4939,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); Loading Loading @@ -5079,6 +5079,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()); Loading Loading @@ -5398,7 +5400,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } boolean parentFrameWasClippedByDisplayCutout = false; final int cutoutMode = attrs.layoutInDisplayCutoutMode; final boolean attachedInParent = attached != null && !layoutInScreen; final boolean requestedHideNavigation = Loading Loading @@ -5449,7 +5450,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. Loading Loading @@ -5507,8 +5508,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() Loading services/core/java/com/android/server/policy/WindowManagerPolicy.java +1 −5 Original line number Diff line number Diff line Loading @@ -202,12 +202,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 Loading services/core/java/com/android/server/wm/WindowFrames.java +50 −1 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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. Loading Loading @@ -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() { } Loading @@ -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); Loading @@ -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); } Loading @@ -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(); } } services/core/java/com/android/server/wm/WindowManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -2173,7 +2173,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( Loading Loading
core/proto/android/server/windowmanagerservice.proto +3 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; }
services/core/java/com/android/server/policy/PhoneWindowManager.java +10 −10 Original line number Diff line number Diff line Loading @@ -4636,6 +4636,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. Loading Loading @@ -4719,8 +4722,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) { Loading Loading @@ -4782,8 +4784,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 Loading Loading @@ -4938,8 +4939,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); Loading Loading @@ -5079,6 +5079,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()); Loading Loading @@ -5398,7 +5400,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } boolean parentFrameWasClippedByDisplayCutout = false; final int cutoutMode = attrs.layoutInDisplayCutoutMode; final boolean attachedInParent = attached != null && !layoutInScreen; final boolean requestedHideNavigation = Loading Loading @@ -5449,7 +5450,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. Loading Loading @@ -5507,8 +5508,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() Loading
services/core/java/com/android/server/policy/WindowManagerPolicy.java +1 −5 Original line number Diff line number Diff line Loading @@ -202,12 +202,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 Loading
services/core/java/com/android/server/wm/WindowFrames.java +50 −1 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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. Loading Loading @@ -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() { } Loading @@ -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); Loading @@ -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); } Loading @@ -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(); } }
services/core/java/com/android/server/wm/WindowManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -2173,7 +2173,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( Loading