Merge "Force consuming system bars if nav bar is shown forcibly" into udc-dev am: 495953eae7

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23657992

Change-Id: I69cdbcb11c2f9b17b8fc391bc8f9377a9ca43002
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Tiger Huang
2023-06-14 16:38:09 +00:00
committed by Automerger Merge Worker
4 changed files with 17 additions and 7 deletions

View File

@@ -177,7 +177,8 @@ public class InsetsState implements Parcelable {
if ((legacyWindowFlags & FLAG_FULLSCREEN) != 0) { if ((legacyWindowFlags & FLAG_FULLSCREEN) != 0) {
compatInsetsTypes &= ~statusBars(); compatInsetsTypes &= ~statusBars();
} }
if (clearsCompatInsets(windowType, legacyWindowFlags, windowingMode)) { if (clearsCompatInsets(windowType, legacyWindowFlags, windowingMode)
&& !alwaysConsumeSystemBars) {
compatInsetsTypes = 0; compatInsetsTypes = 0;
} }

View File

@@ -1111,8 +1111,13 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
: controller.getSystemBarsAppearance(); : controller.getSystemBarsAppearance();
if (insets != null) { if (insets != null) {
final boolean clearsCompatInsets = clearsCompatInsets(attrs.type, attrs.flags, mLastShouldAlwaysConsumeSystemBars = insets.shouldAlwaysConsumeSystemBars();
getResources().getConfiguration().windowConfiguration.getWindowingMode());
final boolean clearsCompatInsets =
clearsCompatInsets(attrs.type, attrs.flags,
getResources().getConfiguration().windowConfiguration
.getWindowingMode())
&& !mLastShouldAlwaysConsumeSystemBars;
final Insets stableBarInsets = insets.getInsetsIgnoringVisibility( final Insets stableBarInsets = insets.getInsetsIgnoringVisibility(
WindowInsets.Type.systemBars()); WindowInsets.Type.systemBars());
final Insets systemInsets = clearsCompatInsets final Insets systemInsets = clearsCompatInsets
@@ -1143,7 +1148,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
disallowAnimate |= (hasLeftStableInset != mLastHasLeftStableInset); disallowAnimate |= (hasLeftStableInset != mLastHasLeftStableInset);
mLastHasLeftStableInset = hasLeftStableInset; mLastHasLeftStableInset = hasLeftStableInset;
mLastShouldAlwaysConsumeSystemBars = insets.shouldAlwaysConsumeSystemBars();
mLastSuppressScrimTypes = insets.getSuppressScrimTypes(); mLastSuppressScrimTypes = insets.getSuppressScrimTypes();
} }

View File

@@ -2368,7 +2368,8 @@ public class DisplayPolicy {
// We need to force the consumption of the system bars if they are force shown or if they // 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. // are controlled by a remote insets controller.
mForceConsumeSystemBars = mForceShowSystemBars mForceConsumeSystemBars = mForceShowSystemBars
|| mDisplayContent.getInsetsPolicy().remoteInsetsControllerControlsSystemBars(win); || getInsetsPolicy().remoteInsetsControllerControlsSystemBars(win)
|| getInsetsPolicy().forcesShowingNavigationBars(win);
mDisplayContent.getInsetsPolicy().updateBarControlTarget(win); mDisplayContent.getInsetsPolicy().updateBarControlTarget(win);
final boolean topAppHidesStatusBar = topAppHidesSystemBar(Type.statusBars()); final boolean topAppHidesStatusBar = topAppHidesSystemBar(Type.statusBars());

View File

@@ -567,8 +567,7 @@ class InsetsPolicy {
return focusedWin; return focusedWin;
} }
} }
if (mPolicy.isForceShowNavigationBarEnabled() && focusedWin != null if (forcesShowingNavigationBars(focusedWin)) {
&& focusedWin.getActivityType() == ACTIVITY_TYPE_STANDARD) {
// When "force show navigation bar" is enabled, it means both force visible is true, and // When "force show navigation bar" is enabled, it means both force visible is true, and
// we are in 3-button navigation. In this mode, the navigation bar is forcibly shown // we are in 3-button navigation. In this mode, the navigation bar is forcibly shown
// when activity type is ACTIVITY_TYPE_STANDARD which means Launcher or Recent could // when activity type is ACTIVITY_TYPE_STANDARD which means Launcher or Recent could
@@ -604,6 +603,11 @@ class InsetsPolicy {
return focusedWin; return focusedWin;
} }
boolean forcesShowingNavigationBars(WindowState win) {
return mPolicy.isForceShowNavigationBarEnabled() && win != null
&& win.getActivityType() == ACTIVITY_TYPE_STANDARD;
}
/** /**
* Determines whether the remote insets controller should take control of system bars for all * Determines whether the remote insets controller should take control of system bars for all
* windows. * windows.