No status bar for external display
The test cases were failed to get the VR display because the
height of newly created display doesn’t match the expected
size. We shouldn’t remove status bar size from the display’s
height since there is no status bar on VR display (not even
on any external displays yet).
Bug: 117894098
Test: atest ActivityManagerVrDisplayTests
Change-Id: If053d3102cfadf511f1065f6475f37468e1d1836
diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java
index f1d77b9..a8e4085 100644
--- a/services/core/java/com/android/server/wm/DisplayPolicy.java
+++ b/services/core/java/com/android/server/wm/DisplayPolicy.java
@@ -222,6 +222,7 @@
private volatile int mDockMode = Intent.EXTRA_DOCK_STATE_UNDOCKED;
private volatile boolean mHdmiPlugged;
+ private volatile boolean mHasStatusBar;
private volatile boolean mHasNavigationBar;
// Can the navigation bar ever move to the side?
private volatile boolean mNavigationBarCanMove;
@@ -523,6 +524,7 @@
mNavigationBarCanMove = width != height && shortSizeDp < 600;
if (mDisplayContent.isDefaultDisplay) {
+ mHasStatusBar = true;
mHasNavigationBar = mContext.getResources().getBoolean(R.bool.config_showNavigationBar);
// Allow a system property to override this. Used by the emulator.
@@ -534,6 +536,7 @@
mHasNavigationBar = true;
}
} else {
+ mHasStatusBar = false;
mHasNavigationBar = mDisplayContent.getDisplay().supportsSystemDecorations();
}
}
@@ -589,6 +592,10 @@
return mHasNavigationBar;
}
+ public boolean hasStatusBar() {
+ return mHasStatusBar;
+ }
+
public boolean navigationBarCanMove() {
return mNavigationBarCanMove;
}
@@ -2493,12 +2500,19 @@
final int landscapeRotation = displayRotation.getLandscapeRotation();
final int seascapeRotation = displayRotation.getSeascapeRotation();
- mStatusBarHeightForRotation[portraitRotation] =
- mStatusBarHeightForRotation[upsideDownRotation] =
- res.getDimensionPixelSize(R.dimen.status_bar_height_portrait);
- mStatusBarHeightForRotation[landscapeRotation] =
- mStatusBarHeightForRotation[seascapeRotation] =
- res.getDimensionPixelSize(R.dimen.status_bar_height_landscape);
+ if (hasStatusBar()) {
+ mStatusBarHeightForRotation[portraitRotation] =
+ mStatusBarHeightForRotation[upsideDownRotation] =
+ res.getDimensionPixelSize(R.dimen.status_bar_height_portrait);
+ mStatusBarHeightForRotation[landscapeRotation] =
+ mStatusBarHeightForRotation[seascapeRotation] =
+ res.getDimensionPixelSize(R.dimen.status_bar_height_landscape);
+ } else {
+ mStatusBarHeightForRotation[portraitRotation] =
+ mStatusBarHeightForRotation[upsideDownRotation] =
+ mStatusBarHeightForRotation[landscapeRotation] =
+ mStatusBarHeightForRotation[seascapeRotation] = 0;
+ }
// Height of the navigation bar when presented horizontally at bottom
mNavigationBarHeightForRotationDefault[portraitRotation] =