Skip to content

Commit d939dd2

Browse files
dsandlerAndroid (Google) Code Review
authored andcommitted
Merge "Fix race condition in status bar init code." into ics-mr1
2 parents ade26e2 + 6e8db88 commit d939dd2

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public void start() {
252252
mWindowManager = IWindowManager.Stub.asInterface(
253253
ServiceManager.getService(Context.WINDOW_SERVICE));
254254

255-
super.start();
255+
super.start(); // calls makeStatusBarView()
256256

257257
addNavigationBar();
258258

@@ -270,12 +270,7 @@ protected View makeStatusBarView() {
270270

271271
Resources res = context.getResources();
272272

273-
mDisplay.getMetrics(mDisplayMetrics);
274-
if (DEBUG) {
275-
Slog.d(TAG, "makeStatusBarView: mDisplayMetrics=" + mDisplayMetrics);
276-
mDisplayMetrics = res.getDisplayMetrics();
277-
Slog.d(TAG, "makeStatusBarView: mDisplayMetrics2=" + mDisplayMetrics);
278-
}
273+
updateDisplaySize(); // populates mDisplayMetrics
279274
loadDimens();
280275

281276
mIconSize = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_icon_size);
@@ -1793,6 +1788,11 @@ public void run() {
17931788
}
17941789

17951790
void onBarViewAttached() {
1791+
// The status bar has just been attached to the view hierarchy; it's possible that the
1792+
// screen has rotated in-between when we set up the window and now, so let's double-check
1793+
// the display metrics just in case.
1794+
updateDisplaySize();
1795+
17961796
WindowManager.LayoutParams lp;
17971797
int pixelFormat;
17981798
Drawable bg;

0 commit comments

Comments
 (0)