Provide a hook for forcing all system bars to be displayed at all times
Bug: 121257946
Test: manual
Change-Id: Ibbf41a03b0229b62366a42543e542af954a0ea8b
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index c042a8c..e1762df 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -320,7 +320,7 @@
public void resized(Rect frame, Rect overscanInsets, Rect contentInsets,
Rect visibleInsets, Rect stableInsets, Rect outsets, boolean reportDraw,
MergedConfiguration mergedConfiguration, Rect backDropRect, boolean forceLayout,
- boolean alwaysConsumeNavBar, int displayId,
+ boolean alwaysConsumeSystemBars, int displayId,
DisplayCutout.ParcelableWrapper displayCutout) {
Message msg = mCaller.obtainMessageIO(MSG_WINDOW_RESIZED,
reportDraw ? 1 : 0, outsets);
diff --git a/core/java/android/view/IWindow.aidl b/core/java/android/view/IWindow.aidl
index c06a1fe..699e795 100644
--- a/core/java/android/view/IWindow.aidl
+++ b/core/java/android/view/IWindow.aidl
@@ -53,7 +53,7 @@
void resized(in Rect frame, in Rect overscanInsets, in Rect contentInsets,
in Rect visibleInsets, in Rect stableInsets, in Rect outsets, boolean reportDraw,
in MergedConfiguration newMergedConfiguration, in Rect backDropFrame,
- boolean forceLayout, boolean alwaysConsumeNavBar, int displayId,
+ boolean forceLayout, boolean alwaysConsumeSystemBars, int displayId,
in DisplayCutout.ParcelableWrapper displayCutout);
/**
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index 9ee6585..e537ff1 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -291,6 +291,16 @@
oneway void statusBarVisibilityChanged(int displayId, int visibility);
/**
+ * When set to {@code true} the system bars will always be shown. This is true even if an app
+ * requests to be fullscreen by setting the system ui visibility flags. The
+ * functionality was added for the automotive case as a way to guarantee required content stays
+ * on screen at all times.
+ *
+ * @hide
+ */
+ oneway void setForceShowSystemBars(boolean show);
+
+ /**
* Called by System UI to notify of changes to the visibility of Recents.
*/
oneway void setRecentsVisibility(boolean visible);
diff --git a/core/java/android/view/InsetsController.java b/core/java/android/view/InsetsController.java
index 08f2e8d..bf16e3d 100644
--- a/core/java/android/view/InsetsController.java
+++ b/core/java/android/view/InsetsController.java
@@ -134,7 +134,7 @@
}
WindowInsets insets = state.calculateInsets(mFrame, mLastInsets.isRound(),
- mLastInsets.shouldAlwaysConsumeNavBar(), mLastInsets.getDisplayCutout(),
+ mLastInsets.shouldAlwaysConsumeSystemBars(), mLastInsets.getDisplayCutout(),
mLastLegacyContentInsets, mLastLegacyStableInsets, mLastLegacySoftInputMode,
null /* typeSideMap */);
mViewRoot.mView.dispatchWindowInsetsAnimationProgress(insets);
@@ -177,12 +177,12 @@
*/
@VisibleForTesting
public WindowInsets calculateInsets(boolean isScreenRound,
- boolean alwaysConsumeNavBar, DisplayCutout cutout, Rect legacyContentInsets,
+ boolean alwaysConsumeSystemBars, DisplayCutout cutout, Rect legacyContentInsets,
Rect legacyStableInsets, int legacySoftInputMode) {
mLastLegacyContentInsets.set(legacyContentInsets);
mLastLegacyStableInsets.set(legacyStableInsets);
mLastLegacySoftInputMode = legacySoftInputMode;
- mLastInsets = mState.calculateInsets(mFrame, isScreenRound, alwaysConsumeNavBar, cutout,
+ mLastInsets = mState.calculateInsets(mFrame, isScreenRound, alwaysConsumeSystemBars, cutout,
legacyContentInsets, legacyStableInsets, legacySoftInputMode,
null /* typeSideMap */);
return mLastInsets;
diff --git a/core/java/android/view/InsetsState.java b/core/java/android/view/InsetsState.java
index 6129b38..13b0cc0 100644
--- a/core/java/android/view/InsetsState.java
+++ b/core/java/android/view/InsetsState.java
@@ -17,9 +17,6 @@
package android.view;
import static android.view.ViewRootImpl.NEW_INSETS_MODE_FULL;
-import static android.view.ViewRootImpl.NEW_INSETS_MODE_IME;
-import static android.view.ViewRootImpl.NEW_INSETS_MODE_NONE;
-import static android.view.WindowInsets.Type.IME;
import static android.view.WindowInsets.Type.SIZE;
import static android.view.WindowInsets.Type.indexOf;
@@ -31,7 +28,6 @@
import android.os.Parcelable;
import android.util.ArrayMap;
import android.util.ArraySet;
-import android.util.SparseArray;
import android.util.SparseIntArray;
import android.view.WindowInsets.Type;
import android.view.WindowInsets.Type.InsetType;
@@ -40,7 +36,6 @@
import java.io.PrintWriter;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import java.util.ArrayList;
import java.util.Objects;
/**
@@ -130,7 +125,7 @@
* @return The calculated insets.
*/
public WindowInsets calculateInsets(Rect frame, boolean isScreenRound,
- boolean alwaysConsumeNavBar, DisplayCutout cutout,
+ boolean alwaysConsumeSystemBars, DisplayCutout cutout,
@Nullable Rect legacyContentInsets, @Nullable Rect legacyStableInsets,
int legacySoftInputMode, @Nullable @InsetSide SparseIntArray typeSideMap) {
Insets[] typeInsetsMap = new Insets[Type.SIZE];
@@ -180,7 +175,7 @@
}
}
return new WindowInsets(typeInsetsMap, typeMaxInsetsMap, typeVisibilityMap, isScreenRound,
- alwaysConsumeNavBar, cutout);
+ alwaysConsumeSystemBars, cutout);
}
private void processSource(InsetsSource source, Rect relativeFrame, boolean ignoreVisibility,
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index ab2cc66..d9cd556 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -28249,11 +28249,11 @@
final Rect mOutsets = new Rect();
/**
- * In multi-window we force show the navigation bar. Because we don't want that the surface
- * size changes in this mode, we instead have a flag whether the navigation bar size should
- * always be consumed, so the app is treated like there is no virtual navigation bar at all.
+ * In multi-window we force show the system bars. Because we don't want that the surface
+ * size changes in this mode, we instead have a flag whether the system bars sizes should
+ * always be consumed, so the app is treated like there are no virtual system bars at all.
*/
- boolean mAlwaysConsumeNavBar;
+ boolean mAlwaysConsumeSystemBars;
/**
* The internal insets given by this window. This value is
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index a28d662..945218e 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -512,7 +512,7 @@
final Rect mPendingBackDropFrame = new Rect();
final DisplayCutout.ParcelableWrapper mPendingDisplayCutout =
new DisplayCutout.ParcelableWrapper(DisplayCutout.NO_CUTOUT);
- boolean mPendingAlwaysConsumeNavBar;
+ boolean mPendingAlwaysConsumeSystemBars;
private InsetsState mTempInsets = new InsetsState();
final ViewTreeObserver.InternalInsetsInfo mLastGivenInsets
= new ViewTreeObserver.InternalInsetsInfo();
@@ -921,9 +921,9 @@
mPendingStableInsets.set(mAttachInfo.mStableInsets);
mPendingDisplayCutout.set(mAttachInfo.mDisplayCutout);
mPendingVisibleInsets.set(0, 0, 0, 0);
- mAttachInfo.mAlwaysConsumeNavBar =
- (res & WindowManagerGlobal.ADD_FLAG_ALWAYS_CONSUME_NAV_BAR) != 0;
- mPendingAlwaysConsumeNavBar = mAttachInfo.mAlwaysConsumeNavBar;
+ mAttachInfo.mAlwaysConsumeSystemBars =
+ (res & WindowManagerGlobal.ADD_FLAG_ALWAYS_CONSUME_SYSTEM_BARS) != 0;
+ mPendingAlwaysConsumeSystemBars = mAttachInfo.mAlwaysConsumeSystemBars;
mInsetsController.onStateChanged(mTempInsets);
if (DEBUG_LAYOUT) Log.v(mTag, "Added window " + mWindow);
if (res < WindowManagerGlobal.ADD_OKAY) {
@@ -1918,12 +1918,12 @@
if (sNewInsetsMode != NEW_INSETS_MODE_NONE) {
mLastWindowInsets = mInsetsController.calculateInsets(
mContext.getResources().getConfiguration().isScreenRound(),
- mAttachInfo.mAlwaysConsumeNavBar, displayCutout,
+ mAttachInfo.mAlwaysConsumeSystemBars, displayCutout,
contentInsets, stableInsets, mWindowAttributes.softInputMode);
} else {
mLastWindowInsets = new WindowInsets(contentInsets, stableInsets,
mContext.getResources().getConfiguration().isScreenRound(),
- mAttachInfo.mAlwaysConsumeNavBar, displayCutout);
+ mAttachInfo.mAlwaysConsumeSystemBars, displayCutout);
}
}
return mLastWindowInsets;
@@ -2126,7 +2126,7 @@
if (!mPendingOutsets.equals(mAttachInfo.mOutsets)) {
insetsChanged = true;
}
- if (mPendingAlwaysConsumeNavBar != mAttachInfo.mAlwaysConsumeNavBar) {
+ if (mPendingAlwaysConsumeSystemBars != mAttachInfo.mAlwaysConsumeSystemBars) {
insetsChanged = true;
}
if (lp.width == ViewGroup.LayoutParams.WRAP_CONTENT
@@ -2326,8 +2326,8 @@
final boolean surfaceSizeChanged = (relayoutResult
& WindowManagerGlobal.RELAYOUT_RES_SURFACE_RESIZED) != 0;
surfaceChanged |= surfaceSizeChanged;
- final boolean alwaysConsumeNavBarChanged =
- mPendingAlwaysConsumeNavBar != mAttachInfo.mAlwaysConsumeNavBar;
+ final boolean alwaysConsumeSystemBarsChanged =
+ mPendingAlwaysConsumeSystemBars != mAttachInfo.mAlwaysConsumeSystemBars;
final boolean colorModeChanged = hasColorModeChanged(lp.getColorMode());
if (contentInsetsChanged) {
mAttachInfo.mContentInsets.set(mPendingContentInsets);
@@ -2356,8 +2356,8 @@
// Need to relayout with content insets.
contentInsetsChanged = true;
}
- if (alwaysConsumeNavBarChanged) {
- mAttachInfo.mAlwaysConsumeNavBar = mPendingAlwaysConsumeNavBar;
+ if (alwaysConsumeSystemBarsChanged) {
+ mAttachInfo.mAlwaysConsumeSystemBars = mPendingAlwaysConsumeSystemBars;
contentInsetsChanged = true;
}
if (contentInsetsChanged || mLastSystemUiVisibility !=
@@ -4629,7 +4629,7 @@
mPendingOutsets.set((Rect) args.arg7);
mPendingBackDropFrame.set((Rect) args.arg8);
mForceNextWindowRelayout = args.argi1 != 0;
- mPendingAlwaysConsumeNavBar = args.argi2 != 0;
+ mPendingAlwaysConsumeSystemBars = args.argi2 != 0;
args.recycle();
@@ -7080,8 +7080,8 @@
destroySurface();
}
- mPendingAlwaysConsumeNavBar =
- (relayoutResult & WindowManagerGlobal.RELAYOUT_RES_CONSUME_ALWAYS_NAV_BAR) != 0;
+ mPendingAlwaysConsumeSystemBars =
+ (relayoutResult & WindowManagerGlobal.RELAYOUT_RES_CONSUME_ALWAYS_SYSTEM_BARS) != 0;
if (restore) {
params.restore();
@@ -7370,7 +7370,7 @@
private void dispatchResized(Rect frame, Rect overscanInsets, Rect contentInsets,
Rect visibleInsets, Rect stableInsets, Rect outsets, boolean reportDraw,
MergedConfiguration mergedConfiguration, Rect backDropFrame, boolean forceLayout,
- boolean alwaysConsumeNavBar, int displayId,
+ boolean alwaysConsumeSystemBars, int displayId,
DisplayCutout.ParcelableWrapper displayCutout) {
if (DEBUG_LAYOUT) Log.v(mTag, "Resizing " + this + ": frame=" + frame.toShortString()
+ " contentInsets=" + contentInsets.toShortString()
@@ -7410,7 +7410,7 @@
args.arg8 = sameProcessCall ? new Rect(backDropFrame) : backDropFrame;
args.arg9 = displayCutout.get(); // DisplayCutout is immutable.
args.argi1 = forceLayout ? 1 : 0;
- args.argi2 = alwaysConsumeNavBar ? 1 : 0;
+ args.argi2 = alwaysConsumeSystemBars ? 1 : 0;
args.argi3 = displayId;
msg.obj = args;
mHandler.sendMessage(msg);
@@ -8494,13 +8494,14 @@
public void resized(Rect frame, Rect overscanInsets, Rect contentInsets,
Rect visibleInsets, Rect stableInsets, Rect outsets, boolean reportDraw,
MergedConfiguration mergedConfiguration, Rect backDropFrame, boolean forceLayout,
- boolean alwaysConsumeNavBar, int displayId,
+ boolean alwaysConsumeSystemBars, int displayId,
DisplayCutout.ParcelableWrapper displayCutout) {
final ViewRootImpl viewAncestor = mViewAncestor.get();
if (viewAncestor != null) {
viewAncestor.dispatchResized(frame, overscanInsets, contentInsets,
visibleInsets, stableInsets, outsets, reportDraw, mergedConfiguration,
- backDropFrame, forceLayout, alwaysConsumeNavBar, displayId, displayCutout);
+ backDropFrame, forceLayout, alwaysConsumeSystemBars, displayId,
+ displayCutout);
}
}
diff --git a/core/java/android/view/WindowInsets.java b/core/java/android/view/WindowInsets.java
index aac0e34..ffa769a 100644
--- a/core/java/android/view/WindowInsets.java
+++ b/core/java/android/view/WindowInsets.java
@@ -83,7 +83,7 @@
* changes in this mode, we instead have a flag whether the navigation bar size should always
* be consumed, so the app is treated like there is no virtual navigation bar at all.
*/
- private final boolean mAlwaysConsumeNavBar;
+ private final boolean mAlwaysConsumeSystemBars;
private final boolean mSystemWindowInsetsConsumed;
private final boolean mStableInsetsConsumed;
@@ -111,10 +111,10 @@
* @deprecated Use {@link WindowInsets(SparseArray, SparseArray, boolean, boolean, DisplayCutout)}
*/
public WindowInsets(Rect systemWindowInsetsRect, Rect stableInsetsRect,
- boolean isRound, boolean alwaysConsumeNavBar, DisplayCutout displayCutout) {
+ boolean isRound, boolean alwaysConsumeSystemBars, DisplayCutout displayCutout) {
this(createCompatTypeMap(systemWindowInsetsRect), createCompatTypeMap(stableInsetsRect),
createCompatVisibilityMap(createCompatTypeMap(systemWindowInsetsRect)),
- isRound, alwaysConsumeNavBar, displayCutout);
+ isRound, alwaysConsumeSystemBars, displayCutout);
}
/**
@@ -133,7 +133,7 @@
@Nullable Insets[] typeMaxInsetsMap,
boolean[] typeVisibilityMap,
boolean isRound,
- boolean alwaysConsumeNavBar, DisplayCutout displayCutout) {
+ boolean alwaysConsumeSystemBars, DisplayCutout displayCutout) {
mSystemWindowInsetsConsumed = typeInsetsMap == null;
mTypeInsetsMap = mSystemWindowInsetsConsumed
? new Insets[SIZE]
@@ -146,7 +146,7 @@
mTypeVisibilityMap = typeVisibilityMap;
mIsRound = isRound;
- mAlwaysConsumeNavBar = alwaysConsumeNavBar;
+ mAlwaysConsumeSystemBars = alwaysConsumeSystemBars;
mDisplayCutoutConsumed = displayCutout == null;
mDisplayCutout = (mDisplayCutoutConsumed || displayCutout.isEmpty())
@@ -160,7 +160,7 @@
*/
public WindowInsets(WindowInsets src) {
this(src.mTypeInsetsMap, src.mTypeMaxInsetsMap, src.mTypeVisibilityMap, src.mIsRound,
- src.mAlwaysConsumeNavBar, displayCutoutCopyConstructorArgument(src));
+ src.mAlwaysConsumeSystemBars, displayCutoutCopyConstructorArgument(src));
}
private static DisplayCutout displayCutoutCopyConstructorArgument(WindowInsets w) {
@@ -443,7 +443,7 @@
return new WindowInsets(mSystemWindowInsetsConsumed ? null : mTypeInsetsMap,
mStableInsetsConsumed ? null : mTypeMaxInsetsMap,
mTypeVisibilityMap,
- mIsRound, mAlwaysConsumeNavBar,
+ mIsRound, mAlwaysConsumeSystemBars,
null /* displayCutout */);
}
@@ -489,7 +489,7 @@
public WindowInsets consumeSystemWindowInsets() {
return new WindowInsets(null, mStableInsetsConsumed ? null : mTypeMaxInsetsMap,
mTypeVisibilityMap,
- mIsRound, mAlwaysConsumeNavBar,
+ mIsRound, mAlwaysConsumeSystemBars,
displayCutoutCopyConstructorArgument(this));
}
@@ -729,15 +729,15 @@
@NonNull
public WindowInsets consumeStableInsets() {
return new WindowInsets(mSystemWindowInsetsConsumed ? null : mTypeInsetsMap, null,
- mTypeVisibilityMap, mIsRound, mAlwaysConsumeNavBar,
+ mTypeVisibilityMap, mIsRound, mAlwaysConsumeSystemBars,
displayCutoutCopyConstructorArgument(this));
}
/**
* @hide
*/
- public boolean shouldAlwaysConsumeNavBar() {
- return mAlwaysConsumeNavBar;
+ public boolean shouldAlwaysConsumeSystemBars() {
+ return mAlwaysConsumeSystemBars;
}
@Override
@@ -809,7 +809,7 @@
? null
: insetInsets(mTypeMaxInsetsMap, left, top, right, bottom),
mTypeVisibilityMap,
- mIsRound, mAlwaysConsumeNavBar,
+ mIsRound, mAlwaysConsumeSystemBars,
mDisplayCutoutConsumed
? null
: mDisplayCutout == null
@@ -824,7 +824,7 @@
WindowInsets that = (WindowInsets) o;
return mIsRound == that.mIsRound
- && mAlwaysConsumeNavBar == that.mAlwaysConsumeNavBar
+ && mAlwaysConsumeSystemBars == that.mAlwaysConsumeSystemBars
&& mSystemWindowInsetsConsumed == that.mSystemWindowInsetsConsumed
&& mStableInsetsConsumed == that.mStableInsetsConsumed
&& mDisplayCutoutConsumed == that.mDisplayCutoutConsumed
@@ -837,8 +837,9 @@
@Override
public int hashCode() {
return Objects.hash(Arrays.hashCode(mTypeInsetsMap), Arrays.hashCode(mTypeMaxInsetsMap),
- Arrays.hashCode(mTypeVisibilityMap), mIsRound, mDisplayCutout, mAlwaysConsumeNavBar,
- mSystemWindowInsetsConsumed, mStableInsetsConsumed, mDisplayCutoutConsumed);
+ Arrays.hashCode(mTypeVisibilityMap), mIsRound, mDisplayCutout,
+ mAlwaysConsumeSystemBars, mSystemWindowInsetsConsumed, mStableInsetsConsumed,
+ mDisplayCutoutConsumed);
}
@@ -900,7 +901,7 @@
private DisplayCutout mDisplayCutout;
private boolean mIsRound;
- private boolean mAlwaysConsumeNavBar;
+ private boolean mAlwaysConsumeSystemBars;
/**
* Creates a builder where all insets are initially consumed.
@@ -924,7 +925,7 @@
mStableInsetsConsumed = insets.mStableInsetsConsumed;
mDisplayCutout = displayCutoutCopyConstructorArgument(insets);
mIsRound = insets.mIsRound;
- mAlwaysConsumeNavBar = insets.mAlwaysConsumeNavBar;
+ mAlwaysConsumeSystemBars = insets.mAlwaysConsumeSystemBars;
}
/**
@@ -1119,8 +1120,8 @@
/** @hide */
@NonNull
- public Builder setAlwaysConsumeNavBar(boolean alwaysConsumeNavBar) {
- mAlwaysConsumeNavBar = alwaysConsumeNavBar;
+ public Builder setAlwaysConsumeSystemBars(boolean alwaysConsumeSystemBars) {
+ mAlwaysConsumeSystemBars = alwaysConsumeSystemBars;
return this;
}
@@ -1133,7 +1134,7 @@
public WindowInsets build() {
return new WindowInsets(mSystemInsetsConsumed ? null : mTypeInsetsMap,
mStableInsetsConsumed ? null : mTypeMaxInsetsMap, mTypeVisibilityMap,
- mIsRound, mAlwaysConsumeNavBar, mDisplayCutout);
+ mIsRound, mAlwaysConsumeSystemBars, mDisplayCutout);
}
}
diff --git a/core/java/android/view/WindowManagerGlobal.java b/core/java/android/view/WindowManagerGlobal.java
index 453c5e3..8a111cf 100644
--- a/core/java/android/view/WindowManagerGlobal.java
+++ b/core/java/android/view/WindowManagerGlobal.java
@@ -93,11 +93,11 @@
public static final int RELAYOUT_RES_SURFACE_RESIZED = 0x20;
/**
- * In multi-window we force show the navigation bar. Because we don't want that the surface size
- * changes in this mode, we instead have a flag whether the navigation bar size should always be
- * consumed, so the app is treated like there is no virtual navigation bar at all.
+ * In multi-window we force show the system bars. Because we don't want that the surface size
+ * changes in this mode, we instead have a flag whether the system bar sizes should always be
+ * consumed, so the app is treated like there is no virtual system bars at all.
*/
- public static final int RELAYOUT_RES_CONSUME_ALWAYS_NAV_BAR = 0x40;
+ public static final int RELAYOUT_RES_CONSUME_ALWAYS_SYSTEM_BARS = 0x40;
/**
* Flag for relayout: the client will be later giving
@@ -118,9 +118,10 @@
public static final int ADD_FLAG_IN_TOUCH_MODE = RELAYOUT_RES_IN_TOUCH_MODE;
/**
- * Like {@link #RELAYOUT_RES_CONSUME_ALWAYS_NAV_BAR}, but as a "hint" when adding the window.
+ * Like {@link #RELAYOUT_RES_CONSUME_ALWAYS_SYSTEM_BARS}, but as a "hint" when adding the
+ * window.
*/
- public static final int ADD_FLAG_ALWAYS_CONSUME_NAV_BAR = 0x4;
+ public static final int ADD_FLAG_ALWAYS_CONSUME_SYSTEM_BARS = 0x4;
public static final int ADD_OKAY = 0;
public static final int ADD_BAD_APP_TOKEN = -1;
diff --git a/core/java/com/android/internal/policy/DecorView.java b/core/java/com/android/internal/policy/DecorView.java
index c4626c2..b3cfa49 100644
--- a/core/java/com/android/internal/policy/DecorView.java
+++ b/core/java/com/android/internal/policy/DecorView.java
@@ -218,7 +218,7 @@
private boolean mLastHasRightStableInset = false;
private boolean mLastHasLeftStableInset = false;
private int mLastWindowFlags = 0;
- private boolean mLastShouldAlwaysConsumeNavBar = false;
+ private boolean mLastShouldAlwaysConsumeSystemBars = false;
private int mRootScrollY = 0;
@@ -1102,7 +1102,7 @@
disallowAnimate |= (hasLeftStableInset != mLastHasLeftStableInset);
mLastHasLeftStableInset = hasLeftStableInset;
- mLastShouldAlwaysConsumeNavBar = insets.shouldAlwaysConsumeNavBar();
+ mLastShouldAlwaysConsumeSystemBars = insets.shouldAlwaysConsumeSystemBars();
}
boolean navBarToRightEdge = isNavBarToRightEdge(mLastBottomInset, mLastRightInset);
@@ -1133,7 +1133,7 @@
(attrs.flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0
&& (sysUiVisibility & SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) == 0
&& (sysUiVisibility & SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0
- || mLastShouldAlwaysConsumeNavBar;
+ || mLastShouldAlwaysConsumeSystemBars;
// If we didn't request fullscreen layout, but we still got it because of the
// mForceWindowDrawsStatusBarBackground flag, also consume top inset.
@@ -1142,7 +1142,8 @@
&& (attrs.flags & FLAG_LAYOUT_IN_SCREEN) == 0
&& (attrs.flags & FLAG_LAYOUT_INSET_DECOR) == 0
&& mForceWindowDrawsStatusBarBackground
- && mLastTopInset != 0;
+ && mLastTopInset != 0
+ || mLastShouldAlwaysConsumeSystemBars;
int consumedTop = consumingStatusBar ? mLastTopInset : 0;
int consumedRight = consumingNavBar ? mLastRightInset : 0;
diff --git a/core/java/com/android/internal/view/BaseIWindow.java b/core/java/com/android/internal/view/BaseIWindow.java
index ae5c67d..fb9ff15 100644
--- a/core/java/com/android/internal/view/BaseIWindow.java
+++ b/core/java/com/android/internal/view/BaseIWindow.java
@@ -44,7 +44,7 @@
public void resized(Rect frame, Rect overscanInsets, Rect contentInsets, Rect visibleInsets,
Rect stableInsets, Rect outsets, boolean reportDraw,
MergedConfiguration mergedConfiguration, Rect backDropFrame, boolean forceLayout,
- boolean alwaysConsumeNavBar, int displayId,
+ boolean alwaysConsumeSystemBars, int displayId,
DisplayCutout.ParcelableWrapper displayCutout) {
if (reportDraw) {
try {
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 71e071c..ba539c4 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -914,6 +914,11 @@
case, this can be disabled (set to false). -->
<bool name="config_enableCarDockHomeLaunch">true</bool>
+ <!-- Control whether to force the display of System UI Bars at all times regardless of
+ System Ui Flags. This can be useful in the Automotive case if there's a requirement for
+ a UI element to be on screen at all times. -->
+ <bool name="config_forceShowSystemBars">false</bool>
+
<!-- HDMI behavior -->
<!-- The number of degrees to rotate the display when the device has HDMI connected
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 17ccc31..8a22764 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1713,6 +1713,7 @@
<java-symbol type="bool" name="config_enableLockScreenRotation" />
<java-symbol type="bool" name="config_enableLockScreenTranslucentDecor" />
<java-symbol type="bool" name="config_enableTranslucentDecor" />
+ <java-symbol type="bool" name="config_forceShowSystemBars" />
<java-symbol type="bool" name="config_lidControlsScreenLock" />
<java-symbol type="bool" name="config_lidControlsSleep" />
<java-symbol type="bool" name="config_lockDayNightMode" />