diff options
| author | 2022-08-29 11:35:59 -0700 | |
|---|---|---|
| committer | 2022-08-30 17:28:18 +0000 | |
| commit | b17c19e11cfc1f37b49cc7e02cf923b518e58ef8 (patch) | |
| tree | 3d41d86fe9a89a4e217f225ab480e7257d980baf | |
| parent | d184d81f55e85e40b79ce2df9e7dec05bac37a3b (diff) | |
Mark system bars as consumed when using remote insets
When using a remote insets controller, the system bars should be marked
as forced consumed to prevent individual applications from assuming the
bars are hidden via SystemUI flags.
Bug: 242592137
Test: manual
Change-Id: I4b29dfd48b573c68304c46f7ee45dc3be1792612
3 files changed, 16 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index 8e06a810ead1..713c13e7fa10 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -362,6 +362,7 @@ public class DisplayPolicy { private WindowState mTopFullscreenOpaqueWindowState; private boolean mTopIsFullscreen; private int mNavBarOpacityMode = NAV_BAR_OPAQUE_WHEN_FREEFORM_OR_DOCKED; + private boolean mForceConsumeSystemBars; private boolean mForceShowSystemBars; private boolean mShowingDream; @@ -1562,6 +1563,13 @@ public class DisplayPolicy { } /** + * @return true if the system bars are forced to be consumed + */ + public boolean areSystemBarsForcedConsumedLw() { + return mForceConsumeSystemBars; + } + + /** * @return true if the system bars are forced to stay visible */ public boolean areSystemBarsForcedShownLw() { @@ -2463,6 +2471,10 @@ public class DisplayPolicy { // We need to force showing system bars when the multi-window or freeform root task is // visible. mForceShowSystemBars = multiWindowTaskVisible || freeformRootTaskVisible; + // We need to force the consumption of the system bars if they are force shown or if they + // are controlled by a remote insets controller. + mForceConsumeSystemBars = mForceShowSystemBars + || mDisplayContent.getInsetsPolicy().remoteInsetsControllerControlsSystemBars(win); mDisplayContent.getInsetsPolicy().updateBarControlTarget(win); final boolean topAppHidesStatusBar = topAppHidesStatusBar(); diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 285e0ac1c67a..71fa532747d3 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -1831,7 +1831,7 @@ public class WindowManagerService extends IWindowManager.Stub prepareNoneTransitionForRelaunching(activity); } - if (displayPolicy.areSystemBarsForcedShownLw()) { + if (displayPolicy.areSystemBarsForcedConsumedLw()) { res |= WindowManagerGlobal.ADD_FLAG_ALWAYS_CONSUME_SYSTEM_BARS; } @@ -2557,7 +2557,7 @@ public class WindowManagerService extends IWindowManager.Stub if (win.mActivityRecord != null) { win.mActivityRecord.updateReportedVisibilityLocked(); } - if (displayPolicy.areSystemBarsForcedShownLw()) { + if (displayPolicy.areSystemBarsForcedConsumedLw()) { result |= WindowManagerGlobal.RELAYOUT_RES_CONSUME_ALWAYS_SYSTEM_BARS; } if (!win.isGoneForLayout()) { @@ -8879,7 +8879,7 @@ public class WindowManagerService extends IWindowManager.Stub : overrideScale; outInsetsState.scale(1f / compatScale); } - return dc.getDisplayPolicy().areSystemBarsForcedShownLw(); + return dc.getDisplayPolicy().areSystemBarsForcedConsumedLw(); } } finally { Binder.restoreCallingIdentity(origId); diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index d79011be7931..b601cc5897e2 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -3918,7 +3918,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP final boolean forceRelayout = syncWithBuffers || isDragResizeChanged; final DisplayContent displayContent = getDisplayContent(); final boolean alwaysConsumeSystemBars = - displayContent.getDisplayPolicy().areSystemBarsForcedShownLw(); + displayContent.getDisplayPolicy().areSystemBarsForcedConsumedLw(); final int displayId = displayContent.getDisplayId(); if (isDragResizeChanged) { |