From e97528ee9ea1b32a8a7fd5e9a199ef5361c16738 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Tue, 26 Apr 2011 13:54:37 -0400 Subject: Account for race condition when attaching HDMI. The status bar figures out how tall it needs to be by subtracting 720 (for 720p HDMI output) from the display height. However, if the display is in the process of rotating to portrait when HDMI is attached (or for whatever other reason dispatches the HDMI_PLUGGED_STATE before the display has been rotated to landscape) this computation will be wrong. The quick fix is to compute the status bar height as shortSide - 720 rather than height - 720. Bug: 4284690 Change-Id: I3715264a9e32af1299777ccdbdc22ca60926cc79 --- .../src/com/android/systemui/statusbar/tablet/HeightReceiver.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/HeightReceiver.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/HeightReceiver.java index 90c9568..9924faa 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/HeightReceiver.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/HeightReceiver.java @@ -77,7 +77,9 @@ public class HeightReceiver extends BroadcastReceiver { if (plugged) { final DisplayMetrics metrics = new DisplayMetrics(); mWindowManager.getDefaultDisplay().getMetrics(metrics); - height = metrics.heightPixels - 720; + //Slog.i(TAG, "setPlugged: display metrics=" + metrics); + final int shortSide = Math.min(metrics.widthPixels, metrics.heightPixels); + height = shortSide - 720; } final int minHeight -- cgit v1.1