summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Daniel Sandler <dsandler@android.com> 2011-10-26 15:40:51 -0400
committer Daniel Sandler <dsandler@android.com> 2011-10-26 20:29:58 -0400
commit6e8db88b4b31a6e0211561f25ee1a422e4797ba1 (patch)
treed19f598bf8fc48af0e4c6f5110730486bd00feb7
parent6e03b22015bd834da1a5755e75d7468e5b3b13c5 (diff)
Fix race condition in status bar init code.
There was a hole between the initial call to get the display metrics and the attachment of the status bar to its window, meaning there was an opportunity for the orientation to change without the status bar's orientation change handler being called. In this scenario the notification panel would be sized for the wrong orientation until the configuration changed again in some way. Bug: 5509445 Change-Id: Ib1bff79c317945a61ccfccddc073cce015f34caa
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 87e505bba084..c6a59d33eb0e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -252,7 +252,7 @@ public class PhoneStatusBar extends StatusBar {
mWindowManager = IWindowManager.Stub.asInterface(
ServiceManager.getService(Context.WINDOW_SERVICE));
- super.start();
+ super.start(); // calls makeStatusBarView()
addNavigationBar();
@@ -270,12 +270,7 @@ public class PhoneStatusBar extends StatusBar {
Resources res = context.getResources();
- mDisplay.getMetrics(mDisplayMetrics);
- if (DEBUG) {
- Slog.d(TAG, "makeStatusBarView: mDisplayMetrics=" + mDisplayMetrics);
- mDisplayMetrics = res.getDisplayMetrics();
- Slog.d(TAG, "makeStatusBarView: mDisplayMetrics2=" + mDisplayMetrics);
- }
+ updateDisplaySize(); // populates mDisplayMetrics
loadDimens();
mIconSize = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_icon_size);
@@ -1793,6 +1788,11 @@ public class PhoneStatusBar extends StatusBar {
}
void onBarViewAttached() {
+ // The status bar has just been attached to the view hierarchy; it's possible that the
+ // screen has rotated in-between when we set up the window and now, so let's double-check
+ // the display metrics just in case.
+ updateDisplaySize();
+
WindowManager.LayoutParams lp;
int pixelFormat;
Drawable bg;