Skip to content

Commit b30cd0a

Browse files
committed
NavBar: Don't resize in portrait docks when HDMI connected.
The computation moving the navbar up is too drastic when a device locked in a portrait dock is connected to a landscape external display (e.g. a TV). Instead, only do this if the aspect ratios of the device and external display are the same. Bug: 6513219 Change-Id: I7cfb1096b7d1a774032d22c4b0d7eb3177766c58
1 parent 7b996d1 commit b30cd0a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

policy/src/com/android/internal/policy/impl/PhoneWindowManager.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2278,7 +2278,12 @@ public void beginLayoutLw(int displayWidth, int displayHeight, int displayRotati
22782278
// It's a system nav bar or a portrait screen; nav bar goes on bottom.
22792279
int top = displayHeight - mNavigationBarHeightForRotation[displayRotation];
22802280
if (mHdmiPlugged) {
2281-
if (top > mExternalDisplayHeight) {
2281+
// Move the nav bar up if the external display is the same aspect ratio
2282+
// but shorter. This avoids clipping on the external display.
2283+
boolean sameAspect = mExternalDisplayHeight > 0 && displayHeight > 0
2284+
&& ((float) mExternalDisplayWidth / mExternalDisplayHeight > 1)
2285+
== ((float) displayWidth / displayHeight > 1);
2286+
if (sameAspect && top > mExternalDisplayHeight) {
22822287
top = mExternalDisplayHeight;
22832288
}
22842289
}

0 commit comments

Comments
 (0)