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
This commit is contained in:
@@ -222,6 +222,7 @@ public class DisplayPolicy {
|
||||
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 @@ public class DisplayPolicy {
|
||||
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 @@ public class DisplayPolicy {
|
||||
mHasNavigationBar = true;
|
||||
}
|
||||
} else {
|
||||
mHasStatusBar = false;
|
||||
mHasNavigationBar = mDisplayContent.getDisplay().supportsSystemDecorations();
|
||||
}
|
||||
}
|
||||
@@ -589,6 +592,10 @@ public class DisplayPolicy {
|
||||
return mHasNavigationBar;
|
||||
}
|
||||
|
||||
public boolean hasStatusBar() {
|
||||
return mHasStatusBar;
|
||||
}
|
||||
|
||||
public boolean navigationBarCanMove() {
|
||||
return mNavigationBarCanMove;
|
||||
}
|
||||
@@ -2493,12 +2500,19 @@ public class DisplayPolicy {
|
||||
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] =
|
||||
|
||||
@@ -79,6 +79,7 @@ public class DisplayPolicyTestsBase extends WindowTestsBase {
|
||||
resources.addOverride(R.dimen.navigation_bar_width, NAV_BAR_HEIGHT);
|
||||
when(mDisplayPolicy.getSystemUiContext()).thenReturn(context);
|
||||
when(mDisplayPolicy.hasNavigationBar()).thenReturn(true);
|
||||
when(mDisplayPolicy.hasStatusBar()).thenReturn(true);
|
||||
|
||||
final int shortSizeDp =
|
||||
Math.min(DISPLAY_WIDTH, DISPLAY_HEIGHT) * DENSITY_DEFAULT / DISPLAY_DENSITY;
|
||||
|
||||
Reference in New Issue
Block a user